Failed to run the command "zun host-show test"
Change-Id: I9a0de877f426348bc6fca6969d39078a0d3a10c6 Closes-Bug: #1715316
This commit is contained in:
@@ -57,7 +57,7 @@ class ComputeNodeTracker(object):
|
||||
def _get_compute_node(self, context):
|
||||
"""Returns compute node for the host"""
|
||||
try:
|
||||
return objects.ComputeNode.get_by_hostname(context, self.host)
|
||||
return objects.ComputeNode.get_by_name(context, self.host)
|
||||
except exception.ComputeNodeNotFound:
|
||||
LOG.warning("No compute node record for: %(host)s",
|
||||
{'host': self.host})
|
||||
|
||||
@@ -26,7 +26,8 @@ class ComputeNode(base.ZunPersistentObject, base.ZunObject):
|
||||
# Version 1.4: Add host operating system info
|
||||
# Version 1.5: Add host labels info
|
||||
# Version 1.6: Add mem_used to compute node
|
||||
VERSION = '1.6'
|
||||
# Version 1.7: Change get_by_hostname to get_by_name
|
||||
VERSION = '1.7'
|
||||
|
||||
fields = {
|
||||
'uuid': fields.UUIDField(read_only=True, nullable=False),
|
||||
@@ -98,7 +99,7 @@ class ComputeNode(base.ZunPersistentObject, base.ZunObject):
|
||||
return compute_node
|
||||
|
||||
@base.remotable_classmethod
|
||||
def get_by_hostname(cls, context, hostname):
|
||||
def get_by_name(cls, context, hostname):
|
||||
db_compute_node = dbapi.get_compute_node_by_hostname(
|
||||
context, hostname)
|
||||
return cls._from_db_object(context, cls(), db_compute_node)
|
||||
|
||||
@@ -37,12 +37,12 @@ class TestComputeNodeObject(base.DbTestCase):
|
||||
self.context, uuid)
|
||||
self.assertEqual(self.context, compute_node._context)
|
||||
|
||||
def test_get_by_hostname(self):
|
||||
def test_get_by_name(self):
|
||||
hostname = self.fake_compute_node['hostname']
|
||||
with mock.patch.object(self.dbapi, 'get_compute_node_by_hostname',
|
||||
autospec=True) as mock_get:
|
||||
mock_get.return_value = self.fake_compute_node
|
||||
compute_node = objects.ComputeNode.get_by_hostname(
|
||||
compute_node = objects.ComputeNode.get_by_name(
|
||||
self.context, hostname)
|
||||
mock_get.assert_called_once_with(self.context, hostname)
|
||||
self.assertEqual(self.context, compute_node._context)
|
||||
|
||||
@@ -353,7 +353,7 @@ object_data = {
|
||||
'ResourceClass': '1.1-d661c7675b3cd5b8c3618b68ba64324e',
|
||||
'ResourceProvider': '1.0-92b427359d5a4cf9ec6c72cbe630ee24',
|
||||
'ZunService': '1.1-b1549134bfd5271daec417ca8cabc77e',
|
||||
'ComputeNode': '1.6-33a173b969781644a95ea2925eb5cca2',
|
||||
'ComputeNode': '1.7-9b700eb146e9978d84e9ccc5849d90e2',
|
||||
'Capsule': '1.0-79e1df0e7013577b1066086ab06c7838',
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user