summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorSalvatore Orlando <salvatore.orlando@eu.citrix.com>2011-02-11 13:08:41 +0000
committerSalvatore Orlando <salvatore.orlando@eu.citrix.com>2011-02-11 13:08:41 +0000
commite32a0131cfa0d7655545aca50559d9988e62142d (patch)
tree077e201119c877866e8abcb2800064763635b9cb /nova
parent648a26d2980b54edafbf0c924a96e6be0dfdb794 (diff)
downloadnova-e32a0131cfa0d7655545aca50559d9988e62142d.tar.gz
nova-e32a0131cfa0d7655545aca50559d9988e62142d.tar.xz
nova-e32a0131cfa0d7655545aca50559d9988e62142d.zip
Following Rick and Jay's suggestions:
- Fixed LOG.debug for translation - improved vm_utils.VM_Helper.ensure_free_mem
Diffstat (limited to 'nova')
-rw-r--r--nova/virt/xenapi/vm_utils.py7
-rw-r--r--nova/virt/xenapi/vmops.py7
2 files changed, 7 insertions, 7 deletions
diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py
index c6ac969b9..dd5e74a85 100644
--- a/nova/virt/xenapi/vm_utils.py
+++ b/nova/virt/xenapi/vm_utils.py
@@ -144,10 +144,9 @@ class VMHelper(HelperBase):
mem = long(instance_type['memory_mb']) * 1024 * 1024
#get free memory from host
host = session.get_xenapi_host()
- host_free_mem = session.get_xenapi().host.compute_free_memory(host)
- if (host_free_mem < mem):
- return False
- return True
+ host_free_mem = long(session.get_xenapi().host.
+ compute_free_memory(host))
+ return host_free_mem >= mem
@classmethod
def create_vbd(cls, session, vm_ref, vdi_ref, userdevice, bootable):
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index e3c303d91..786768ab5 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -66,10 +66,11 @@ class VMOps(object):
if vm is not None:
raise exception.Duplicate(_('Attempted to create'
' non-unique name %s') % instance.name)
- #ensure enough free memory, otherwise don't bother
+ #ensure enough free memory is available
if not VMHelper.ensure_free_mem(self._session, instance):
- LOG.exception(_('instance %s: not enough free memory'),
- instance['name'])
+ name = instance['name']
+ LOG.exception(_('instance %(name)s: not enough free memory')
+ % locals())
db.instance_set_state(context.get_admin_context(),
instance['id'],
power_state.SHUTDOWN)