Require maintenance mode for setting IPMI credentials
Otherwise Ironic power sync loop is going to make us cry. Implements: blueprint setup-ipmi-credentials-take2 Change-Id: I2796ba2d74ba328605e7133139b1b3ebfba7ce36
This commit is contained in:
parent
e69dd8222e
commit
c46b21aef9
ironic_discoverd
@ -38,6 +38,11 @@ def _validate_ipmi_credentials(node, new_ipmi_credentials):
|
||||
raise utils.Error(
|
||||
'IPMI credentials setup is disabled in configuration')
|
||||
|
||||
if not node.maintenance:
|
||||
# Otherwise Ironic is going to interfer
|
||||
raise utils.Error('Node should be in maintenance mode to set '
|
||||
'IPMI credentials on it')
|
||||
|
||||
new_username, new_password = new_ipmi_credentials
|
||||
if not new_username:
|
||||
new_username = node.driver_info.get('ipmi_username')
|
||||
|
@ -285,6 +285,7 @@ class TestSetIpmiCredentials(BaseTest):
|
||||
conf.CONF.set('discoverd', 'enable_setting_ipmi_credentials', 'true')
|
||||
self.new_creds = ('user', 'password')
|
||||
self.cached_node.options['new_ipmi_credentials'] = self.new_creds
|
||||
self.node.maintenance = True
|
||||
|
||||
def test_ok(self, client_mock, add_mock, filters_mock):
|
||||
cli = self._prepare(client_mock)
|
||||
@ -347,3 +348,10 @@ class TestSetIpmiCredentials(BaseTest):
|
||||
|
||||
self.assertRaises(utils.Error, introspect.introspect, self.uuid,
|
||||
new_ipmi_credentials=self.new_creds)
|
||||
|
||||
def test_require_maintenance(self, client_mock, add_mock, filters_mock):
|
||||
self.node.maintenance = False
|
||||
self._prepare(client_mock)
|
||||
|
||||
self.assertRaises(utils.Error, introspect.introspect, self.uuid,
|
||||
new_ipmi_credentials=self.new_creds)
|
||||
|
Loading…
x
Reference in New Issue
Block a user