Consider dropping check on power state

This patch set stops to check the power state of the physical machine
before deploy.

Change-Id: Icde18ec2fffd269605e78b1d5a9a0c080929a5b5
Closes-Bug: #1414986
This commit is contained in:
YuikoTakada 2015-03-02 03:59:52 +00:00
parent 4d589a8593
commit 49a85dba98
2 changed files with 1 additions and 24 deletions

View File

@ -29,7 +29,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'}
PASSWORD_ACCEPTED_CHARS = set(string.ascii_letters + string.digits)
PASSWORD_MAX_LENGTH = 20 # IPMI v2.0
@ -90,14 +89,8 @@ def introspect(uuid, new_ipmi_credentials=None):
' "%(state)s" and maintenance mode off')
raise utils.Error(msg % {'node': node.uuid,
'state': provision_state})
power_state = node.power_state
if power_state and power_state.lower() not in VALID_POWER_STATES:
msg = _('Refusing to introspect node %(node)s with power state'
' "%(state)s" and maintenance mode off')
raise utils.Error(msg % {'node': node.uuid, 'state': power_state})
else:
LOG.info(_LI('Node %s is in maintenance mode, skipping power and'
LOG.info(_LI('Node %s is in maintenance mode, skipping'
' provision states check'), node.uuid)
if new_ipmi_credentials:

View File

@ -257,22 +257,6 @@ class TestIntrospect(BaseTest):
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 %s with power state "power on"' % self.uuid,
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)
@mock.patch.object(eventlet.greenthread, 'spawn_n',
lambda f, *a, **kw: f(*a, **kw) and None)