virt: update overhead to take into account vCPUs
This commit updates the method responsible to compute the overhead to take into account vCPUs. implements blueprint libvirt-emulator-threads-policy Change-Id: I42c9de1f2c548f5ffc5d6bd1598aee10c70ca568
This commit is contained in:
parent
f6f1bac379
commit
9e958db331
@ -148,6 +148,9 @@ class ResourceTracker(object):
|
||||
LOG.debug("Disk overhead for %(flavor)d GB instance; %(overhead)d "
|
||||
"GB", {'flavor': instance.flavor.root_gb,
|
||||
'overhead': overhead.get('disk_gb', 0)})
|
||||
LOG.debug("CPU overhead for %(flavor)d vCPUs instance; %(overhead)d "
|
||||
"vCPU(s)", {'flavor': instance.flavor.vcpus,
|
||||
'overhead': overhead.get('vcpus', 0)})
|
||||
|
||||
cn = self.compute_nodes[nodename]
|
||||
pci_requests = objects.InstancePCIRequests.get_by_instance_uuid(
|
||||
@ -238,6 +241,9 @@ class ResourceTracker(object):
|
||||
LOG.debug("Disk overhead for %(flavor)d GB instance; %(overhead)d "
|
||||
"GB", {'flavor': instance.flavor.root_gb,
|
||||
'overhead': overhead.get('disk_gb', 0)})
|
||||
LOG.debug("CPU overhead for %(flavor)d vCPUs instance; %(overhead)d "
|
||||
"vCPU(s)", {'flavor': instance.flavor.vcpus,
|
||||
'overhead': overhead.get('vcpus', 0)})
|
||||
|
||||
cn = self.compute_nodes[nodename]
|
||||
|
||||
@ -763,16 +769,18 @@ class ResourceTracker(object):
|
||||
def _update_usage(self, usage, nodename, sign=1):
|
||||
mem_usage = usage['memory_mb']
|
||||
disk_usage = usage.get('root_gb', 0)
|
||||
vcpus_usage = usage.get('vcpus', 0)
|
||||
|
||||
overhead = self.driver.estimate_instance_overhead(usage)
|
||||
mem_usage += overhead['memory_mb']
|
||||
disk_usage += overhead.get('disk_gb', 0)
|
||||
vcpus_usage += overhead.get('vcpus', 0)
|
||||
|
||||
cn = self.compute_nodes[nodename]
|
||||
cn.memory_mb_used += sign * mem_usage
|
||||
cn.local_gb_used += sign * disk_usage
|
||||
cn.local_gb_used += sign * usage.get('ephemeral_gb', 0)
|
||||
cn.vcpus_used += sign * usage.get('vcpus', 0)
|
||||
cn.vcpus_used += sign * vcpus_usage
|
||||
|
||||
# free ram and disk may be negative, depending on policy:
|
||||
cn.free_ram_mb = cn.memory_mb - cn.memory_mb_used
|
||||
|
@ -404,6 +404,7 @@ def overhead_zero(instance):
|
||||
return {
|
||||
'memory_mb': 0,
|
||||
'disk_gb': 0,
|
||||
'vcpus': 0,
|
||||
}
|
||||
|
||||
|
||||
|
@ -203,7 +203,8 @@ class ComputeDriver(object):
|
||||
:returns: Dict of estimated overhead values.
|
||||
"""
|
||||
return {'memory_mb': 0,
|
||||
'disk_gb': 0}
|
||||
'disk_gb': 0,
|
||||
'vcpus': 0}
|
||||
|
||||
def list_instances(self):
|
||||
"""Return the names of all the instances known to the virtualization
|
||||
|
Loading…
Reference in New Issue
Block a user