Fixed a bug when a VM does not exist

This commit is contained in:
Anton Beloglazov 2012-10-05 16:35:30 +10:00
parent 08f1d4e2a2
commit f88cc129cb

View File

@ -363,10 +363,11 @@ def get_max_ram(vir_connection, uuid):
:return: The maximum RAM of the VM in MB.
:rtype: int|None
"""
domain = vir_connection.lookupByUUIDString(uuid)
if domain:
try:
domain = vir_connection.lookupByUUIDString(uuid)
return domain.maxMemory() / 1024
return None
except libvirt.libvirtError:
return None
@contract