Refactoring: drop features incompatible with Kilo changes

Dropped are:
* Check for on_discovery field (superseded by node_cache)
* Forcing maintenance mode (Juno UI does it anyway)

Change-Id: Icdb76d7ee3163873c805cf7658749b7212948f26
This commit is contained in:
Dmitry Tantsur 2014-12-08 20:52:52 +01:00
parent 3312522af2
commit bc9a5d9e5d
2 changed files with 3 additions and 34 deletions

View File

@ -49,12 +49,6 @@ def process(node_info):
cached_node.uuid,
code=404)
if not node.extra.get('on_discovery'):
LOG.error('Node is not on discovery, cannot proceed')
raise utils.DiscoveryFailed('Node %s is not on discovery' %
cached_node.uuid,
code=403)
updated = _process_node(ironic, node, node_info, cached_node)
return {'node': updated.to_dict()}
@ -149,10 +143,6 @@ def discover(uuids):
raise utils.DiscoveryFailed("Cannot get node %s: %s" % (uuid, exc))
_validate(ironic, node)
if node.extra.get('on_discovery'):
LOG.warning('Node %s seems to be on discovery already', node.uuid)
nodes.append(node)
LOG.info('Proceeding with discovery on nodes %s', [n.uuid for n in nodes])
@ -191,13 +181,7 @@ def _background_discover(ironic, nodes):
{'op': 'add', 'path': '/extra/discovery_timestamp',
'value': str(time.time())}]
for node in nodes:
node_patch = []
if not node.maintenance:
LOG.warning('Node %s will be put in maintenance mode', node.uuid)
node_patch.append(
{'op': 'replace', 'path': '/maintenance', 'value': 'true'})
ironic.node.update(node.uuid, patch + node_patch)
ironic.node.update(node.uuid, patch)
all_macs = set()
for node in nodes:

View File

@ -191,15 +191,6 @@ class TestProcess(BaseTest):
self.good_interfaces = ['em1', 'em5']
self._do_test(client_mock, pop_mock, filters_mock, pre_mock, post_mock)
def test_not_on_discovery(self, client_mock, pop_mock, filters_mock,
pre_mock, post_mock):
del self.node.extra['on_discovery']
self.assertRaisesRegexp(utils.DiscoveryFailed,
'not on discovery',
self._do_test,
client_mock, pop_mock, filters_mock, pre_mock,
post_mock)
def test_not_found(self, client_mock, pop_mock, filters_mock, pre_mock,
post_mock):
cli = client_mock.return_value
@ -313,14 +304,8 @@ class TestDiscover(BaseTest):
{'op': 'add', 'path': '/extra/discovery_timestamp',
'value': '42.0'}]
cli.node.update.assert_any_call('uuid1', patch)
cli.node.update.assert_any_call(
'uuid2',
patch +
[{'op': 'replace', 'path': '/maintenance', 'value': 'true'}])
cli.node.update.assert_any_call(
'uuid3',
patch +
[{'op': 'replace', 'path': '/maintenance', 'value': 'true'}])
cli.node.update.assert_any_call('uuid2', patch)
cli.node.update.assert_any_call('uuid3', patch)
self.assertEqual(3, cli.node.update.call_count)
spawn_mock.assert_called_once_with(discoverd._background_discover,
cli, ANY)