>From b643d6cb958b785664a65054e25636723784ae88 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Fri, 10 Jun 2011 10:25:35 -0400 Subject: [PATCH] Check all devices for activity. As pointed out by Steve Dake, some machines are slow enough that just checking for activity on the destination disk isn't enough. We actually also need to check for activity on the CD device. Change the inactivity mechanism to take all disk devices for the libvirt domain into account. Signed-off-by: Chris Lalancette --- oz/Guest.py | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-) diff --git a/oz/Guest.py b/oz/Guest.py index a0d1385..4e51b37 100644 --- a/oz/Guest.py +++ b/oz/Guest.py @@ -393,11 +393,13 @@ class Guest(object): # monitored for activity during the installation domxml = libvirt_dom.XMLDesc(0) doc = libxml2.parseMemory(domxml, len(domxml)) - disktarget = doc.xpathEval("/domain/devices/disk[@device='disk']/target") - if len(disktarget) < 1: + disktargets = doc.xpathEval("/domain/devices/disk/target") + if len(disktargets) < 1: raise oz.OzException.OzException("Could not find disk target") - diskdev = disktarget[0].prop('dev') - if diskdev is None: + targetdevs = [] + for target in disktargets: + targetdevs.append(target.prop('dev')) + if not targetdevs: raise oz.OzException.OzException("Could not find disk target device") last_disk_activity = 0 @@ -407,7 +409,11 @@ class Guest(object): if count % 10 == 0: self.log.debug("Waiting for %s to finish installing, %d/%d" % (self.tdl.name, count, origcount)) try: - rd_req, rd_bytes, wr_req, wr_bytes, errs = libvirt_dom.blockStats(diskdev) + total_req = 0 + for dev in targetdevs: + rd_req, rd_bytes, wr_req, wr_bytes, errs = libvirt_dom.blockStats(dev) + total_req += rd_req + wr_req + except libvirt.libvirtError, e: self.log.debug("Libvirt Domain Info Failed:") self.log.debug(" code is %d" % e.get_error_code()) @@ -430,7 +436,7 @@ class Guest(object): self.capture_screenshot(libvirt_dom.XMLDesc(0)) raise oz.OzException.OzException("No disk activity in %d seconds, failing" % (inactivity_timeout)) - if (rd_req + wr_req) == last_disk_activity: + if total_req == last_disk_activity: # if we saw no read or write requests since the last iteration, # decrement our activity timer inactivity_countdown -= 1 @@ -438,7 +444,7 @@ class Guest(object): # if we did see some activity, then we can reset the timer inactivity_countdown = inactivity_timeout - last_disk_activity = rd_req + wr_req + last_disk_activity = total_req count -= 1 time.sleep(1) -- 1.7.4.4