Merge "vmware: delete cpu_info data from get_available_resource"
This commit is contained in:
commit
dbee058d2f
@ -322,6 +322,13 @@ class ResourceTracker(object):
|
||||
return
|
||||
resources['host_ip'] = CONF.my_ip
|
||||
|
||||
# We want the 'cpu_info' to be None from the POV of the
|
||||
# virt driver, but the DB requires it to be non-null so
|
||||
# just force it to empty string
|
||||
if ("cpu_info" not in resources or
|
||||
resources["cpu_info"] is None):
|
||||
resources["cpu_info"] = ''
|
||||
|
||||
# TODO(berrange): remove this once all virt drivers are updated
|
||||
# to report topology
|
||||
if "numa_topology" not in resources:
|
||||
|
@ -28,7 +28,6 @@ from eventlet import greenthread
|
||||
import mock
|
||||
from mox3 import mox
|
||||
from oslo.config import cfg
|
||||
from oslo.serialization import jsonutils
|
||||
from oslo.utils import timeutils
|
||||
from oslo.utils import units
|
||||
from oslo.vmware import exceptions as vexc
|
||||
@ -2175,10 +2174,6 @@ class VMwareAPIVMTestCase(test.NoDBTestCase):
|
||||
|
||||
def test_get_available_resource(self):
|
||||
stats = self.conn.get_available_resource(self.node_name)
|
||||
cpu_info = {"model": ["Intel(R) Xeon(R)", "Intel(R) Xeon(R)"],
|
||||
"vendor": ["Intel", "Intel"],
|
||||
"topology": {"cores": 16,
|
||||
"threads": 32}}
|
||||
self.assertEqual(stats['vcpus'], 32)
|
||||
self.assertEqual(stats['local_gb'], 1024)
|
||||
self.assertEqual(stats['local_gb_used'], 1024 - 500)
|
||||
@ -2187,7 +2182,7 @@ class VMwareAPIVMTestCase(test.NoDBTestCase):
|
||||
self.assertEqual(stats['hypervisor_type'], 'VMware vCenter Server')
|
||||
self.assertEqual(stats['hypervisor_version'], 5001000)
|
||||
self.assertEqual(stats['hypervisor_hostname'], self.node_name)
|
||||
self.assertEqual(stats['cpu_info'], jsonutils.dumps(cpu_info))
|
||||
self.assertIsNone(stats['cpu_info'])
|
||||
self.assertEqual(stats['supported_instances'],
|
||||
'[["i686", "vmware", "hvm"], ["x86_64", "vmware", "hvm"]]')
|
||||
|
||||
|
@ -100,22 +100,14 @@ class VMwareVMUtilTestCase(test.NoDBTestCase):
|
||||
session = fake.FakeSession()
|
||||
with mock.patch.object(session, '_call_method', fake_call_method):
|
||||
result = vm_util.get_stats_from_cluster(session, "cluster1")
|
||||
cpu_info = {}
|
||||
mem_info = {}
|
||||
if connection_state == "connected" and not maintenance_mode:
|
||||
cpu_info['vcpus'] = 32
|
||||
cpu_info['cores'] = 16
|
||||
cpu_info['vendor'] = ["Intel", "Intel"]
|
||||
cpu_info['model'] = ["Intel(R) Xeon(R)",
|
||||
"Intel(R) Xeon(R)"]
|
||||
vcpus = 32
|
||||
else:
|
||||
cpu_info['vcpus'] = 16
|
||||
cpu_info['cores'] = 8
|
||||
cpu_info['vendor'] = ["Intel"]
|
||||
cpu_info['model'] = ["Intel(R) Xeon(R)"]
|
||||
vcpus = 16
|
||||
mem_info['total'] = 5120
|
||||
mem_info['free'] = 3072
|
||||
expected_stats = {'cpu': cpu_info, 'mem': mem_info}
|
||||
expected_stats = {'vcpus': vcpus, 'mem': mem_info}
|
||||
self.assertEqual(expected_stats, result)
|
||||
|
||||
def test_get_stats_from_cluster_hosts_connected_and_active(self):
|
||||
|
@ -428,7 +428,11 @@ class VMwareVCDriver(driver.ComputeDriver):
|
||||
'hypervisor_type': host_stats['hypervisor_type'],
|
||||
'hypervisor_version': host_stats['hypervisor_version'],
|
||||
'hypervisor_hostname': host_stats['hypervisor_hostname'],
|
||||
'cpu_info': jsonutils.dumps(host_stats['cpu_info']),
|
||||
# The VMWare driver manages multiple hosts, so there are
|
||||
# likely many different CPU models in use. As such it is
|
||||
# impossible to provide any meaningful info on the CPU
|
||||
# model of the "host"
|
||||
'cpu_info': None,
|
||||
'supported_instances': jsonutils.dumps(
|
||||
host_stats['supported_instances']),
|
||||
'numa_topology': None,
|
||||
|
@ -69,11 +69,7 @@ class VCState(object):
|
||||
stats = vm_util.get_stats_from_cluster(self._session, self._cluster)
|
||||
about_info = self._session._call_method(vim_util, "get_about_info")
|
||||
data = {}
|
||||
data["vcpus"] = stats['cpu']['vcpus']
|
||||
data["cpu_info"] = {"vendor": stats['cpu']['vendor'],
|
||||
"model": stats['cpu']['model'],
|
||||
"topology": {"cores": stats['cpu']['cores'],
|
||||
"threads": stats['cpu']['vcpus']}}
|
||||
data["vcpus"] = stats['vcpus']
|
||||
data["disk_total"] = capacity / units.Gi
|
||||
data["disk_available"] = freespace / units.Gi
|
||||
data["disk_used"] = data["disk_total"] - data["disk_available"]
|
||||
|
@ -964,7 +964,7 @@ def get_vm_state_from_name(session, vm_name):
|
||||
|
||||
def get_stats_from_cluster(session, cluster):
|
||||
"""Get the aggregate resource stats of a cluster."""
|
||||
cpu_info = {'vcpus': 0, 'cores': 0, 'vendor': [], 'model': []}
|
||||
vcpus = 0
|
||||
mem_info = {'total': 0, 'free': 0}
|
||||
# Get the Host and Resource Pool Managed Object Refs
|
||||
prop_dict = session._call_method(vim_util, "get_dynamic_properties",
|
||||
@ -985,10 +985,7 @@ def get_stats_from_cluster(session, cluster):
|
||||
runtime_summary.connectionState == "connected"):
|
||||
# Total vcpus is the sum of all pCPUs of individual hosts
|
||||
# The overcommitment ratio is factored in by the scheduler
|
||||
cpu_info['vcpus'] += hardware_summary.numCpuThreads
|
||||
cpu_info['cores'] += hardware_summary.numCpuCores
|
||||
cpu_info['vendor'].append(hardware_summary.vendor)
|
||||
cpu_info['model'].append(hardware_summary.cpuModel)
|
||||
vcpus += hardware_summary.numCpuThreads
|
||||
|
||||
res_mor = prop_dict.get('resourcePool')
|
||||
if res_mor:
|
||||
@ -1000,7 +997,7 @@ def get_stats_from_cluster(session, cluster):
|
||||
# overallUsage is the hypervisor's view of memory usage by VM's
|
||||
consumed = int(res_usage.overallUsage / units.Mi)
|
||||
mem_info['free'] = mem_info['total'] - consumed
|
||||
stats = {'cpu': cpu_info, 'mem': mem_info}
|
||||
stats = {'vcpus': vcpus, 'mem': mem_info}
|
||||
return stats
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user