From 0c70a3062363ccb262c47945618822decaf12cfe Mon Sep 17 00:00:00 2001 From: YuikoTakada Date: Mon, 2 Mar 2015 03:59:52 +0000 Subject: [PATCH] Consider dropping check on power state This patch set stops to check the power state of the physical machine before deploy. (cherry picked from commit 49a85dba982a9acb5481038ce5ce3ec1c3e8b577) Conflicts: ironic_discoverd/introspect.py ironic_discoverd/test/test_introspect.py Change-Id: Icde18ec2fffd269605e78b1d5a9a0c080929a5b5 Closes-Bug: #1414986 --- ironic_discoverd/introspect.py | 7 ------- ironic_discoverd/test/test_introspect.py | 16 ---------------- 2 files changed, 23 deletions(-) diff --git a/ironic_discoverd/introspect.py b/ironic_discoverd/introspect.py index 78803d9fd..13175e4e1 100644 --- a/ironic_discoverd/introspect.py +++ b/ironic_discoverd/introspect.py @@ -27,7 +27,6 @@ from ironic_discoverd import utils LOG = logging.getLogger("ironic_discoverd.introspect") # See http://specs.openstack.org/openstack/ironic-specs/specs/kilo/new-ironic-state-machine.html # noqa VALID_STATES = {'enroll', 'manageable', 'inspecting'} -VALID_POWER_STATES = {'power off'} def introspect(uuid, setup_ipmi_credentials=False): @@ -56,12 +55,6 @@ def introspect(uuid, setup_ipmi_credentials=False): msg = ('Refusing to introspect node %s with provision state "%s" ' 'and maintenance mode off') raise utils.Error(msg % (node.uuid, provision_state)) - - power_state = node.power_state - if power_state and power_state.lower() not in VALID_POWER_STATES: - msg = ('Refusing to introspect node %s with power state "%s" ' - 'and maintenance mode off') - raise utils.Error(msg % (node.uuid, power_state)) else: LOG.info('Node %s is in maintenance mode, skipping power and provision' ' states check') diff --git a/ironic_discoverd/test/test_introspect.py b/ironic_discoverd/test/test_introspect.py index d34ce17ac..21c8c3662 100644 --- a/ironic_discoverd/test/test_introspect.py +++ b/ironic_discoverd/test/test_introspect.py @@ -292,19 +292,3 @@ class TestIntrospect(test_base.NodeTest): self.assertEqual(0, cli.node.set_power_state.call_count) self.assertEqual(0, cli.node.update.call_count) self.assertFalse(add_mock.called) - - def test_wrong_power_state(self, client_mock, add_mock, filters_mock): - self.node.power_state = 'power on' - cli = client_mock.return_value - cli.node.get.return_value = self.node - - self.assertRaisesRegexp( - utils.Error, - 'node uuid with power state "power on"', - introspect.introspect, self.uuid) - - self.assertEqual(0, cli.node.list_ports.call_count) - self.assertEqual(0, filters_mock.call_count) - self.assertEqual(0, cli.node.set_power_state.call_count) - self.assertEqual(0, cli.node.update.call_count) - self.assertFalse(add_mock.called)