diff options
| author | kirankv <kiran-kumar.vaddi@hp.com> | 2013-05-17 07:14:44 -0700 |
|---|---|---|
| committer | kirankv <kiran-kumar.vaddi@hp.com> | 2013-06-03 00:32:50 -0700 |
| commit | 1985b176adff8252886c09f36c075af4144cb95f (patch) | |
| tree | 5d930954f924eba6a284794fc85087f3bb1d2dd3 | |
| parent | 0afcc051a99443004510458da32e507385d58873 (diff) | |
| download | nova-1985b176adff8252886c09f36c075af4144cb95f.tar.gz nova-1985b176adff8252886c09f36c075af4144cb95f.tar.xz nova-1985b176adff8252886c09f36c075af4144cb95f.zip | |
Fix VMwareVCdriver reporting incorrect stats
fix bug #1180779
VMware nova compute drivers VMwareESXDriver and VMwareVCDriver
currently report stats for the column local_gb in MB instead of in GB
The fix would be to modify vmwareapi/host.py to ensure the values
reported for disk space are calculated in GB instead of MB.
Fix is done by further dividing the existing MB value by 1024 to
convert to GB.
The unit tests to check for capacity and freespace have been modified
to check for GB.
Change-Id: I0610047ee2bddefe0ccb46568c0f48de4c0941af
| -rw-r--r-- | nova/tests/virt/vmwareapi/test_vmwareapi_vm_util.py | 7 | ||||
| -rw-r--r-- | nova/virt/vmwareapi/fake.py | 5 | ||||
| -rw-r--r-- | nova/virt/vmwareapi/host.py | 8 |
3 files changed, 11 insertions, 9 deletions
diff --git a/nova/tests/virt/vmwareapi/test_vmwareapi_vm_util.py b/nova/tests/virt/vmwareapi/test_vmwareapi_vm_util.py index eda2c25f9..123a314c1 100644 --- a/nova/tests/virt/vmwareapi/test_vmwareapi_vm_util.py +++ b/nova/tests/virt/vmwareapi/test_vmwareapi_vm_util.py @@ -1,5 +1,6 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -# + +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # Copyright 2013 Canonical Corp. # All Rights Reserved. # @@ -41,8 +42,8 @@ class VMwareVMUtilTestCase(test.TestCase): fake_session([fake.Datastore()])) self.assertEquals(result[1], "fake-ds") - self.assertEquals(result[2], 1024 * 1024 * 1024) - self.assertEquals(result[3], 1024 * 1024 * 500) + self.assertEquals(result[2], 1024 * 1024 * 1024 * 1024) + self.assertEquals(result[3], 1024 * 1024 * 500 * 1024) def test_get_datastore_ref_and_name_without_datastore(self): diff --git a/nova/virt/vmwareapi/fake.py b/nova/virt/vmwareapi/fake.py index 86b6e5fc2..d8e2eb217 100644 --- a/nova/virt/vmwareapi/fake.py +++ b/nova/virt/vmwareapi/fake.py @@ -1,5 +1,6 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 +# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # Copyright (c) 2012 VMware, Inc. # Copyright (c) 2011 Citrix Systems, Inc. # Copyright 2011 OpenStack Foundation @@ -255,8 +256,8 @@ class Datastore(ManagedObject): super(Datastore, self).__init__("Datastore") self.set("summary.type", "VMFS") self.set("summary.name", "fake-ds") - self.set("summary.capacity", 1024 * 1024 * 1024) - self.set("summary.freeSpace", 500 * 1024 * 1024) + self.set("summary.capacity", 1024 * 1024 * 1024 * 1024) + self.set("summary.freeSpace", 500 * 1024 * 1024 * 1024) class HostNetworkSystem(ManagedObject): diff --git a/nova/virt/vmwareapi/host.py b/nova/virt/vmwareapi/host.py index 8c62c5ce9..7abff5678 100644 --- a/nova/virt/vmwareapi/host.py +++ b/nova/virt/vmwareapi/host.py @@ -126,8 +126,8 @@ class HostState(object): "sockets": summary.hardware.numCpuPkgs, "threads": summary.hardware.numCpuThreads} } - data["disk_total"] = ds[2] / (1024 * 1024) - data["disk_available"] = ds[3] / (1024 * 1024) + data["disk_total"] = ds[2] / (1024 * 1024 * 1024) + data["disk_available"] = ds[3] / (1024 * 1024 * 1024) data["disk_used"] = data["disk_total"] - data["disk_available"] data["host_memory_total"] = summary.hardware.memorySize / (1024 * 1024) data["host_memory_free"] = data["host_memory_total"] - \ @@ -193,8 +193,8 @@ class VCState(object): "sockets": summary.hardware.numCpuPkgs, "threads": summary.hardware.numCpuThreads} } - data["disk_total"] = ds[2] / (1024 * 1024) - data["disk_available"] = ds[3] / (1024 * 1024) + data["disk_total"] = ds[2] / (1024 * 1024 * 1024) + data["disk_available"] = ds[3] / (1024 * 1024 * 1024) data["disk_used"] = data["disk_total"] - data["disk_available"] data["host_memory_total"] = summary.hardware.memorySize / (1024 * 1024) data["host_memory_free"] = data["host_memory_total"] -\ |
