Catch network lookup errors if a domain is dying. (Hiroyuki Kaguchi)

This commit is contained in:
Cole Robinson
2008-03-14 10:15:27 -04:00
parent d98940105e
commit 9cc27de815
+18
View File
@@ -584,6 +584,7 @@ class vmmConnection(gobject.GObject):
logging.warn("Unable to list inactive networks")
for name in newActiveNetNames:
try:
net = self.vmm.networkLookupByName(name)
uuid = self.uuidstr(net.UUID())
if not oldNets.has_key(uuid):
@@ -596,7 +597,11 @@ class vmmConnection(gobject.GObject):
self.nets[uuid].set_active(True)
startNets[uuid] = self.nets[uuid]
del oldNets[uuid]
except libvirt.libvirtError:
logging.warn("Couldn't fetch active network name '" + name + "'")
for name in newInactiveNetNames:
try:
net = self.vmm.networkLookupByName(name)
uuid = self.uuidstr(net.UUID())
if not oldNets.has_key(uuid):
@@ -608,6 +613,8 @@ class vmmConnection(gobject.GObject):
self.nets[uuid].set_active(False)
stopNets[uuid] = self.nets[uuid]
del oldNets[uuid]
except libvirt.libvirtError:
logging.warn("Couldn't fetch inactive network name '" + name + "'")
oldActiveIDs = {}
oldInactiveNames = {}
@@ -626,7 +633,12 @@ class vmmConnection(gobject.GObject):
# Now we can clear the list of actives from the last time through
self.activeUUIDs = []
newActiveIDs = []
try:
newActiveIDs = self.vmm.listDomainsID()
except:
logging.warn("Unable to list active domains")
newInactiveNames = []
try:
newInactiveNames = self.vmm.listDefinedDomains()
@@ -656,6 +668,7 @@ class vmmConnection(gobject.GObject):
# May be a new VM, we have no choice but
# to create the wrapper so we can see
# if its a previously inactive domain.
try:
vm = self.vmm.lookupByID(id)
uuid = self.uuidstr(vm.UUID())
maybeNewUUIDs[uuid] = vm
@@ -663,6 +676,8 @@ class vmmConnection(gobject.GObject):
startedUUIDs.append(uuid)
#print "Maybe new active " + str(maybeNewUUIDs[uuid].get_name()) + " " + uuid
self.activeUUIDs.append(uuid)
except libvirt.libvirtError:
logging.debug("Couldn't fetch domain id " + str(id) + "; it probably went away")
# Filter out inactive domains which haven't changed
if newInactiveNames != None:
@@ -741,7 +756,10 @@ class vmmConnection(gobject.GObject):
# Finally, we sample each domain
now = time()
try:
self.hostinfo = self.vmm.getInfo()
except:
logging.warn("Unable to get host information")
updateVMs = self.vms
if noStatsUpdate: