Trim the fat from InstanceInfo

nova.virt.hardware.InstanceInfo had several fields that have never been
used since their inception two and a half years ago [1]. This change set
removes them. They are (were):

max_mem_kb: (int) the maximum memory in KBytes
allowed mem_kb: (int) the memory in KBytes used by the instance
num_cpu: (int) the number of virtual CPUs for the
         instance
cpu_time_ns: (int) the CPU time used in nanoseconds

We also rename the 'id' field to 'internal_id' for two reasons: First,
because 'id' is a builtin; second, to emphasize that this is not
(necessarily) tied to the Instance's real id/uuid.

[1] https://review.openstack.org/#/c/133777

(cherry-picked from commit 5db9389c01b0cb6eeacf57c22550876ffcd1a87c)

Change-Id: I53408ca96674fbe98be25a0ade68fd7416b38436
This commit is contained in:
Claudiu Belu 2017-09-07 11:46:26 +03:00
parent bd12ddf55e
commit fe5cbf455d
2 changed files with 2 additions and 10 deletions

View File

@ -140,11 +140,7 @@ class VMOps(object):
info = self._vmutils.get_vm_summary_info(instance_name)
state = constants.HYPERV_POWER_STATE[info['EnabledState']]
return hardware.InstanceInfo(state=state,
max_mem_kb=info['MemoryUsage'],
mem_kb=info['MemoryUsage'],
num_cpu=info['NumberOfProcessors'],
cpu_time_ns=info['UpTime'])
return hardware.InstanceInfo(state=state)
def _create_root_device(self, context, instance, root_disk_info, vm_gen):
path = None

View File

@ -116,11 +116,7 @@ class VMOpsTestCase(test_base.HyperVBaseTestCase):
return fake_info[key]
mock_info.__getitem__.side_effect = getitem
expected = hardware.InstanceInfo(state=constants.HYPERV_POWER_STATE[2],
max_mem_kb=mock.sentinel.FAKE_MEM_KB,
mem_kb=mock.sentinel.FAKE_MEM_KB,
num_cpu=mock.sentinel.FAKE_NUM_CPU,
cpu_time_ns=mock.sentinel.FAKE_CPU_NS)
expected = hardware.InstanceInfo(state=constants.HYPERV_POWER_STATE[2])
self._vmops._vmutils.vm_exists.return_value = vm_exists
self._vmops._vmutils.get_vm_summary_info.return_value = mock_info