Skip nodes under maintenance on baremetal boot config

Cpenstack baremetal configure boot failed on nodes with
maintenance=True. These nodes are skipped now.

Change-Id: I556e8f232b65804a192d1fa5aba2f2e50d8aa57c
Resolves: rhbz#1235325
This commit is contained in:
Marek Aufart
2015-06-29 14:12:58 +02:00
parent b234001407
commit e426ef07ef
2 changed files with 16 additions and 1 deletions

View File

@@ -693,3 +693,18 @@ class TestConfigureBaremetalBoot(fakes.TestBaremetal):
self.assertRaises(exceptions.Timeout,
self.cmd.take_action,
parsed_args)
@mock.patch('openstackclient.common.utils.find_resource', autospec=True)
def test_configure_boot_skip_maintenance(self, find_resource_mock):
find_resource_mock.return_value = mock.Mock(id="IDIDID")
bm_client = self.app.client_manager.rdomanager_oscplugin.baremetal()
bm_client.node.list.return_value = [
mock.Mock(uuid="ABCDEFGH", maintenance=False),
]
parsed_args = self.check_parser(self.cmd, [], [])
self.cmd.take_action(parsed_args)
self.assertEqual(bm_client.node.list.mock_calls, [mock.call(
maintenance=False)])

View File

@@ -376,7 +376,7 @@ class ConfigureBaremetalBoot(command.Command):
self.log.debug("Using kernel ID: {0} and ramdisk ID: {1}".format(
kernel_id, ramdisk_id))
for node in bm_client.node.list():
for node in bm_client.node.list(maintenance=False):
# NOTE(bnemec): Ironic won't let us update the node while the
# power_state is transitioning.
if node.power_state is None: