Author: gnichols
Date: 2011-03-16 00:07:15 +0000 (Wed, 16 Mar 2011)
New Revision: 816
Modified:
trunk/v7/fvtest.py
Log:
682115 - RHEL 6.1 fv tests fail on spuriou stderr output of virt-install and kpartx
Modified: trunk/v7/fvtest.py
===================================================================
--- trunk/v7/fvtest.py 2011-03-16 00:03:52 UTC (rev 815)
+++ trunk/v7/fvtest.py 2011-03-16 00:07:15 UTC (rev 816)
@@ -30,7 +30,7 @@
from v7.tags import Constants, DeviceClass, Tags, TestTag
from v7.hal import Hal
from v7.device import Device
-from v7.command import Command, V7CommandException
+from v7.command import Command, V7CommandException, V7CommandError, V7CommandErrorOutput
from v7.environment import Environment
from v7.certificationtest import CertificationDocument
from v7.redhatrelease import RedHatRelease
@@ -286,7 +286,11 @@
print "Using loopback device " + self.loopBackDevice + " for
guest data image"
loop = os.path.basename(self.loopBackDevice)
Command("losetup " + self.loopBackDevice + " " +
os.path.join(self.guestImageDirectory, self.dataImageFile)).echo()
- Command("kpartx -av " + self.loopBackDevice).echo()
+ try:
+ Command("kpartx -av " + self.loopBackDevice).echo()
+ except V7CommandErrorOutput, exception:
+ print "Warning: %s" % exception
+ exception.command.printErrors()
partition = Command("ls
/dev/mapper").getString(regex="%sp[0-9]" % loop, singleLine=False)
Command("mount /dev/mapper/" + partition + "
/mnt").run()
print "Mounted /dev/mapper/" + partition + " on /mnt"
@@ -304,10 +308,11 @@
except V7CommandException, e:
print "Error: could not mount data image"
print e
+ e.command.printErrors()
return False
return True
- def unmountDataImage(self):
+ def unmountDataImage(self, ignoreErrors=False):
print "Unmounting /mnt"
sys.stdout.flush()
try:
@@ -317,8 +322,10 @@
Command("kpartx -dv " + self.loopBackDevice).echo()
Command("losetup -d " + self.loopBackDevice).echo()
except V7CommandException, e:
- print e
- print "Error: could not unmount data image."
+ if not ignoreErrors:
+ print "Error: could not unmount data image."
+ print e
+ e.command.printErrors()
return False
return True
@@ -326,7 +333,7 @@
# mount the data image and then write test info
try:
dataImagePath = os.path.join(self.guestImageDirectory, self.dataImageFile)
- self.unmountDataImage()
+ self.unmountDataImage(ignoreErrors=True)
if not self.mountDataImage():
return False
guestScriptFile = "/mnt/v7-guest-script"
@@ -368,9 +375,12 @@
print virtInstall
try:
Command(virtInstall).echo()
- except V7CommandException, e:
- print "Error: could not generate guest config file."
- print e
+ except V7CommandErrorOutput, exception:
+ # ignore spurious stderr output: BZ 687526
+ print "Warning: %s" % exception
+ exception.command.printErrors()
+ except V7CommandException, exception:
+ print "Error: could not generate guest config file:%s" %
exception
return False
return True
@@ -439,6 +449,9 @@
try:
Command("virsh start %s" % self.guestName).echo()
print "FV Guest started ..."
+ except V7CommandErrorOutput, exception:
+ print "Warning: %s" % exception
+ exception.command.printErrors()
except V7CommandException, e:
print "Error: could not start the FV Guest."
print e
@@ -452,10 +465,10 @@
while 1:
if count == self.waitTime:
try:
+ print "time out: destroying the guest."
Command("virsh destroy %s" % self.guestName).echo()
- print "time out, the FV Guest was destroyed."
- except V7CommandException, e:
- pass
+ except V7CommandException, exception:
+ print "Warning: %s" % exception
return False
else:
time.sleep(60)
Show replies by date