Ensure networks are running before starting node

If you create an environment and want to start a node prior to running
the admin setup action, it will fail because the networks are not
currently started.  This change makes sure the networks are started
before starting the node via the node-start shell command.

Change-Id: I336ea88950e9239d02d3c72c49b3d17eb264e6c3
This commit is contained in:
Alex Schultz 2017-10-19 15:17:22 -06:00 committed by Dennis Dmitriev
parent 750d443537
commit 6847377d9a
2 changed files with 7 additions and 0 deletions

View File

@ -417,6 +417,9 @@ class Shell(object):
self.env.get_admin_ip()))
def do_node_start(self):
# ensure networks are running prior to starting a node
for group in self.env.get_groups():
group.start_networks()
# TODO(astudenov): add positional argument instead of
# checking that option is present
self.check_param_show_help(self.params.node_name)

View File

@ -679,9 +679,13 @@ class TestShell(unittest.TestCase):
iface='eth1')
def test_node_start(self):
group = mock.Mock(spec=models.Group)
self.env_mocks['env1'].get_groups.return_value = [group]
sh = shell.Shell(['node-start', 'env1', '-N', 'slave-01'])
sh.execute()
group.start_networks.assert_called_once_with()
self.client_inst.get_env.assert_called_once_with('env1')
self.nodes['env1']['slave-01'].start.assert_called_once_with()