Use correct Node id attribute
According to the openstacksdk docs[1] the Node uuid is stored in the id attribute. This change removes the get_node shim which adds the uuid attribute, and replaces any calls to Node.uuid with Node.id. This will stop the many log debug warnings about this attribute: DEBUG openstack.resource [-] Attribute [uuid] not found in [<openstack.resource._ComponentManager object at 0x7f417e43aa20>]: 'uuid'. __getattribute__ /usr/lib/python3.6/site-packages/openstack/resource.py:623 Calls to NodeInfo.uuid or db.Node.uuid remain unchanged. Change-Id: Icd3de82877c6a53d32b4c9fd3e500d3cd9d7fb17 Story: 2008379 Task: 41300
This commit is contained in:
parent
80b5852fb3
commit
c387cf305c
@ -120,7 +120,7 @@ def get_ipmi_address(node):
|
||||
msg = _('Failed to resolve the hostname (%(value)s)'
|
||||
' for node %(uuid)s')
|
||||
raise utils.Error(msg % {'value': value,
|
||||
'uuid': node.uuid},
|
||||
'uuid': node.id},
|
||||
node_info=node)
|
||||
|
||||
return (value, ipv4, ipv6) if ipv4 or ipv6 else none_address
|
||||
@ -178,7 +178,6 @@ def get_node(node_id, ironic=None, **kwargs):
|
||||
|
||||
try:
|
||||
node = ironic.get_node(node_id, **kwargs)
|
||||
node.uuid = node.id
|
||||
except os_exc.ResourceNotFound:
|
||||
raise NotFound(node_id)
|
||||
except os_exc.BadRequestException as exc:
|
||||
@ -244,7 +243,7 @@ def lookup_node_by_bmc_addresses(addresses, introspection_data=None,
|
||||
# inspected, i.e. inspect wait, and then fallback
|
||||
# to the rest of the physical nodes so we limit
|
||||
# overall-impact of the operation.
|
||||
nodes = ironic.nodes(fields=('id', 'driver_info'), limit=None)
|
||||
nodes = ironic.nodes(fields=('uuid', 'driver_info'), limit=None)
|
||||
found = set()
|
||||
for node in nodes:
|
||||
bmc_address, bmc_ipv4, bmc_ipv6 = get_ipmi_address(node)
|
||||
|
@ -400,7 +400,7 @@ def _get_data(node_id, processed):
|
||||
try:
|
||||
if not uuidutils.is_uuid_like(node_id):
|
||||
node = ir_utils.get_node(node_id, fields=['uuid'])
|
||||
node_id = node.uuid
|
||||
node_id = node.id
|
||||
res = process.get_introspection_data(node_id, processed=processed)
|
||||
return res, 200, {'Content-Type': 'application/json'}
|
||||
except utils.IntrospectionDataStoreDisabled:
|
||||
@ -440,7 +440,7 @@ def api_introspection_reapply(node_id):
|
||||
|
||||
if not uuidutils.is_uuid_like(node_id):
|
||||
node = ir_utils.get_node(node_id, fields=['uuid'])
|
||||
node_id = node.uuid
|
||||
node_id = node.id
|
||||
|
||||
client = get_client_compat()
|
||||
client.call({}, 'do_reapply', node_uuid=node_id, data=data)
|
||||
|
@ -778,7 +778,7 @@ def get_node(node_id, ironic=None):
|
||||
uuid = node_id
|
||||
else:
|
||||
node = ir_utils.get_node(node_id, ironic=ironic)
|
||||
uuid = node.uuid
|
||||
uuid = node.id
|
||||
|
||||
row = db.model_query(db.Node).filter_by(uuid=uuid).first()
|
||||
if row is None:
|
||||
|
@ -71,7 +71,7 @@ class TestGetIpmiAddress(base.BaseTest):
|
||||
def test_bad_hostname_errors(self, mock_socket):
|
||||
node = mock.Mock(spec=['driver_info', 'uuid'],
|
||||
driver_info={'ipmi_address': 'meow'},
|
||||
uuid='uuid1')
|
||||
id='uuid1')
|
||||
mock_socket.side_effect = socket.gaierror('Boom')
|
||||
self.assertRaises(utils.Error, ir_utils.get_ipmi_address, node)
|
||||
|
||||
|
@ -494,7 +494,7 @@ class TestApiReapply(BaseAPITest):
|
||||
|
||||
@mock.patch.object(ir_utils, 'get_node', autospec=True)
|
||||
def test_reapply_with_node_name(self, get_mock):
|
||||
get_mock.return_value = mock.Mock(uuid=self.uuid)
|
||||
get_mock.return_value = mock.Mock(id=self.uuid)
|
||||
self.app.post('/v1/introspection/%s/data/unprocessed' %
|
||||
'fake-node')
|
||||
self.client_mock.call.assert_called_once_with({}, 'do_reapply',
|
||||
|
Loading…
Reference in New Issue
Block a user