diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-06-26 21:38:37 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-06-26 21:38:37 +0000 |
| commit | a407084659ce3d0dbbaa4a28bfe09d8294a54bdc (patch) | |
| tree | 88a7b2d67d8821c8b87c792bdc4c3a7f6423c3ff | |
| parent | 1a169b8bf98a7fa0c1361ac942bbd9d4041f8e63 (diff) | |
| parent | 78352b98a96946145bec9010872d8f2769691ac2 (diff) | |
| download | nova-a407084659ce3d0dbbaa4a28bfe09d8294a54bdc.tar.gz nova-a407084659ce3d0dbbaa4a28bfe09d8294a54bdc.tar.xz nova-a407084659ce3d0dbbaa4a28bfe09d8294a54bdc.zip | |
Merge "fix libvirt get_memory_mb_total() with xen"
| -rw-r--r-- | nova/virt/libvirt/connection.py | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index cffd22661..eb47c7a5f 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -1828,26 +1828,14 @@ class LibvirtDriver(driver.ComputeDriver): "This error can be safely ignored for now.")) return 0 - @staticmethod - def get_memory_mb_total(): + def get_memory_mb_total(self): """Get the total memory size(MB) of physical computer. :returns: the total amount of memory(MB). """ - if sys.platform.upper() not in ['LINUX2', 'LINUX3']: - return 0 - - if FLAGS.libvirt_type == 'xen': - meminfo = self._conn.getInfo()[1] - # this is in MB - return meminfo - else: - meminfo = open('/proc/meminfo').read().split() - idx = meminfo.index('MemTotal:') - # transforming KB to MB - return int(meminfo[idx + 1]) / 1024 + return self._conn.getInfo()[1] @staticmethod def get_local_gb_total(): |
