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:
@@ -693,3 +693,18 @@ class TestConfigureBaremetalBoot(fakes.TestBaremetal):
|
|||||||
self.assertRaises(exceptions.Timeout,
|
self.assertRaises(exceptions.Timeout,
|
||||||
self.cmd.take_action,
|
self.cmd.take_action,
|
||||||
parsed_args)
|
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)])
|
||||||
|
@@ -376,7 +376,7 @@ class ConfigureBaremetalBoot(command.Command):
|
|||||||
self.log.debug("Using kernel ID: {0} and ramdisk ID: {1}".format(
|
self.log.debug("Using kernel ID: {0} and ramdisk ID: {1}".format(
|
||||||
kernel_id, ramdisk_id))
|
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
|
# NOTE(bnemec): Ironic won't let us update the node while the
|
||||||
# power_state is transitioning.
|
# power_state is transitioning.
|
||||||
if node.power_state is None:
|
if node.power_state is None:
|
||||||
|
Reference in New Issue
Block a user