Bug 13895 - OVM zone z1 hosts went to Alert state, VMs in stopped state and stopping state

return VM in Error if it is no longer on primary storage
reviewed-by: edison
This commit is contained in:
frank 2012-02-21 14:36:55 -08:00
parent 142d3efe0b
commit f2826af1ae
1 changed files with 8 additions and 4 deletions

View File

@ -205,10 +205,14 @@ class OvmHost(OvmObject):
dct = {}
host = OvmHost()
for name, id in l:
vmPath = host._getVmPathFromPrimaryStorage(name)
vmStatus = db_get_vm(vmPath)
dct[name] = vmStatus['status']
try:
vmPath = host._getVmPathFromPrimaryStorage(name)
vmStatus = db_get_vm(vmPath)
dct[name] = vmStatus['status']
except Exception, e:
logger.debug(OvmHost.getAllVms, "Cannot find link for %s on primary storage, treat it as Error"%name)
dct[name] = 'ERROR'
scanStoppedVmOnPrimaryStorage(dct)
rs = toGson(dct)
logger.info(OvmHost.getAllVms, rs)