Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 832152 Details for
Bug 1034808
RHEL7 FV tests should use updated KVM guest image containing a RHEL 6.5 guest
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch for updating FV tests to use KVM images
0001-1034808-RHEL7-FV-tests-should-use-updated-KVM-guest-.patch (text/plain), 22.22 KB, created by
Greg Nichols
on 2013-12-03 15:30:08 UTC
(
hide
)
Description:
patch for updating FV tests to use KVM images
Filename:
MIME Type:
Creator:
Greg Nichols
Created:
2013-12-03 15:30:08 UTC
Size:
22.22 KB
patch
obsolete
>From eddbb5961862b26eae6275d093fc9d9e5d2410a1 Mon Sep 17 00:00:00 2001 >From: Greg Nichols <gnichols@redhat.com> >Date: Tue, 3 Dec 2013 10:26:01 -0500 >Subject: [PATCH] 1034808 - RHEL7 FV tests should use updated KVM guest image > containing a RHEL 6.5 guest > >--- > hwcert/fvtest.py | 223 ++++++++++++----------------------- > hwcert/tags.py | 8 +- > tests/fv_network/fv_network.py | 8 +- > tools/fv-guest/fv-domU-ks-x86_64.cfg | 10 +- > tools/fv-guest/fv-domU-rc.local | 2 +- > tools/fv-guest/fv-domU-readme.txt | 82 +++++++++++++ > 6 files changed, 170 insertions(+), 163 deletions(-) > >diff --git a/hwcert/fvtest.py b/hwcert/fvtest.py >index b915270..727ad8e 100644 >--- a/hwcert/fvtest.py >+++ b/hwcert/fvtest.py >@@ -26,7 +26,7 @@ import time > from xml.dom.minidom import getDOMImplementation, parseString > > from hwcert.test import Test >-from hwcert.tags import Constants, DeviceClass, Tags, TestTag >+from hwcert.tags import Constants, DeviceClass, Tags, TestTag, RHEL > from hwcert.device import Device > from hwcert.command import Command, HwCertCommandException, HwCertCommandError, HwCertCommandErrorOutput > from hwcert.environment import Environment >@@ -39,7 +39,7 @@ PASSED = 0 > FAILED = 1 > > class FvTest(Test): >- >+ > def __init__(self, name): > Test.__init__(self, name) > self.deviceClass = DeviceClass.system >@@ -48,7 +48,7 @@ class FvTest(Test): > self.guestImageFile = 'hwcert-' + self.hardwarePlatform + '.img' > self.loopBackDevice = None > self.dataImageFile = 'hwcertData.img' >- >+ > # defaults > self.hwcertCommandInGuest = Constants.hwcert_backend + " certify " > self.testToRun = "" >@@ -62,57 +62,47 @@ class FvTest(Test): > except HwCertCommandException, e: > print "Error: can't create guest image mountpoint " + self.mountPoint > raise >- >+ > def tags(self): > return [TestTag.noninteractive, TestTag.certification, TestTag.virtualization] >- >+ > def __pickHypervisor(self): >- """ Pick whether xen or kvm virtualization is to be tested """ >- self.hypervisor = Constants.kvm # default >- >- # if we're running xen, then do xen >- if self.redHatRelease.getKernelFlavor() == Constants.xen: >- self.hypervisor = Constants.xen >+ self.hypervisor = Constants.kvm > > def __setUpHypervisor(self): > """ configure the test for the specific hypervisor (kvm or xen) """ > if self.hypervisor is None: > print "Error: no hypervisor set" > return >- >+ > # check cpu flags, just to log the results. > self.__hasVirtualizationCPUFlags(verbose=True) >- >- if self.hypervisor == Constants.xen: >- print "Testing xen virtualization" >- self.guestConfigFile = 'hwcert-' + self.hardwarePlatform >- self.guestConfigPath = os.path.join(self.environment.getGuestConfigDirectory(), self.guestConfigFile) >- self.guestImageDirectory = self.environment.getGuestImageDirectory() >- else: # assume kvm - for manual test scheduling >- print "Testing kvm virtualization" >- self.hypervisor = Constants.kvm >- self.guestConfigFile = 'hwcert-' + self.hardwarePlatform + ".xml" >- self.guestConfigPath = os.path.join(self.environment.getKVMGuestConfigDirectory(), self.guestConfigFile) >- self.guestImageDirectory = self.environment.getKVMGuestImageDirectory() >- >- # check and start libvirtd >- try: >- Command("systemctl enable libvirtd.service").echo() >- Command("systemctl start libvirtd.service").echo() >- print "libvirtd is running" >- except HwCertCommandException, e: >- print "Warning: libvirtd may not be running" >- print e >- >- # check the kvm modules >- try: >- kvmModulesScript = "/etc/sysconfig/modules/kvm.modules" >- if os.path.exists(kvmModulesScript): >- Command(kvmModulesScript).echo() >- except HwCertCommandException, e: >- print "Warning: kvm modules may not be running" >- print e >- >+ >+ print "Testing kvm virtualization" >+ self.hypervisor = Constants.kvm >+ self.guestConfigFile = 'hwcert-' + self.hardwarePlatform + ".xml" >+ self.guestConfigPath = os.path.join(self.environment.getKVMGuestConfigDirectory(), self.guestConfigFile) >+ self.guestConfigDirectory = self.environment.getKVMGuestConfigDirectory() >+ self.guestImageDirectory = self.environment.getKVMGuestImageDirectory() >+ >+ # check and start libvirtd >+ try: >+ Command("systemctl enable libvirtd.service").echo() >+ Command("systemctl start libvirtd.service").echo() >+ print "libvirtd is running" >+ except HwCertCommandException, e: >+ print "Warning: libvirtd may not be running" >+ print e >+ >+ # check the kvm modules >+ try: >+ kvmModulesScript = "/etc/sysconfig/modules/kvm.modules" >+ if os.path.exists(kvmModulesScript): >+ Command(kvmModulesScript).echo() >+ except HwCertCommandException, e: >+ print "Warning: kvm modules may not be running" >+ print e >+ > def __isHVMCapableViaLibvirt(self): > """ determine if system is FV/hvm capable, via virsh from libvirt """ > virsh = Command("virsh capabilities") >@@ -144,10 +134,10 @@ class FvTest(Test): > except IOError: > if self.debug != Constants.off: > print "Note: could not read " + capabilities >- >+ > #otherwise > return False >- >+ > def __hasVirtualizationCPUFlags(self, verbose=False): > """ check cpuinfo for virtualization flags """ > cpuflags = Command("fgrep flags /proc/cpuinfo") >@@ -159,15 +149,14 @@ class FvTest(Test): > except HwCertCommandException: > if verbose or self.debug != Constants.off: > print "Note: /proc/cpuinfo does not have vmx, smx, or svm flags" >- >+ > return False >- >+ > def configureHypervisor(self): > # determine whether to use xen or kvm virtualization > self.__pickHypervisor() > # configure test for the righ hypervisor > self.__setUpHypervisor() >- > > def plan(self, planner): > tests = list() >@@ -180,25 +169,20 @@ class FvTest(Test): > # Fedora x86_64 > elif "Fedora" in self.redHatRelease.getProduct() and self.redHatRelease.getArch() == Constants.x86_64: > osSupport = True >- >+ > # check libvirt, capabilities file, or cpuflags > if osSupport and (self.__isHVMCapableViaLibvirt() or self.__isHVMInCapabilitiesFile() or self.__hasVirtualizationCPUFlags()): > test = self.makeCopy() > tests.append(test) > return tests >- >+ > def getRequiredRPMs(self): > self.__pickHypervisor() >- rpms = ["libvirt", "libvirt-python", "virt-install"] >- if self.hypervisor == Constants.kvm: >- rpms.append("qemu-kvm") >- rpms.append("qemu-kvm-tools") >- # as of RHEL7 Alpha3 - seems to be missing qemu-system-x86 ala Fedora 18 >- rpms.extend(["seabios", "seabios-bin", "ipxe-roms-qemu", "qemu-kvm-common"]) >- elif self.hypervisor == Constants.xen: >- rpms.append("xen") >+ rpms = ["libvirt", "libvirt-python", "virt-install, qemu-kvm, qemu-kvm-tools"] >+ # as of RHEL7 Alpha3 - seems to be missing qemu-system-x86 ala Fedora 18 >+ rpms.extend(["seabios", "seabios-bin", "ipxe-roms-qemu", "qemu-kvm-common"]) > return rpms >- >+ > def verifyGuest(self): > guestName = None > try: >@@ -212,45 +196,49 @@ class FvTest(Test): > except: > print "Verified that guest " + self.guestName + " is not running" > pass >- >+ > return self.verifyGuestFiles() >- >- >+ >+ > def verifyGuestFiles(self): > if not self.verifyFile(self.guestImageDirectory, self.dataImageFile): > return False >- > if not self.verifyFile(self.guestImageDirectory, self.guestImageFile): > return False >- >- if os.path.exists(self.guestConfigPath): >- print "Verified: " + self.guestConfigPath >- elif not self.generateGuestConfigFile(): >+ if not self.verifyFile(self.guestConfigDirectory, self.guestConfigFile): > return False >- >+ > print "Guest files verified" > sys.stdout.flush() >+ print "Restarting libvirtd:" >+ try: >+ Command("systemctl restart libvirtd.service").echo() >+ except HwCertCommandException, exception: >+ print "Error: could not restart libvirtd:" >+ print exception >+ return False >+ > return True > > def verifyFile(self, destinationDirectory, filename): >- >+ > filePath = os.path.join(destinationDirectory, filename) > if os.path.exists(filePath): > print "Verified: " + filePath > return True >- >+ > # otherwise > print "Note: " + filePath + " not found, attempting download" > return self.installFile(destinationDirectory, filename) >- >+ > def installFile(self, destinationDirectory, filename): > sys.stdout.flush() > urlsToTry = list() > if self.getTestServer() and self.getTestServer() != "unknown": >- urlsToTry.append("http://" + self.getTestServer() + "/hwcert/fv-images/" + filename + ".tar.bz2") >+ urlsToTry.append("http://%s/hwcert/fv-images/%s/%s.tar.bz2" % (self.getTestServer(), RHEL.major, filename)) > else: > print "Warning: no hwcert test server set - can not look for guest files there" >- urlsToTry.append(self.environment.getPartnerServerURL() + "/RHEL5/fv-images/" + filename + ".tar.bz2") >+ urlsToTry.append("%s/fv-images/%s/%s.tar.bz2" % (self.environment.getPartnerServerURL(), RHEL.major, filename)) > > for url in urlsToTry: > if os.system("wget " + url) == 0: >@@ -303,10 +291,10 @@ class FvTest(Test): > # otherwise > print "Warning: %s is not ready." % loop > retries = retries - 1 >- >+ > Command("mount /dev/mapper/" + partition + " " + self.mountPoint).run() > print "Mounted /dev/mapper/" + partition + " on " + self.mountPoint >- >+ > # check image meta-data > self.imageMetaData = None > try: >@@ -314,7 +302,7 @@ class FvTest(Test): > print self.imageMetaData > except: > print "Warning: could not find hwcert image meta-data" >- >+ > if self.debug != Constants.off: > Command("df -h " + self.mountPoint).echo() > Command("ls -al " + self.mountPoint).echo() >@@ -324,7 +312,7 @@ class FvTest(Test): > e.command.printErrors() > return False > return True >- >+ > def unmountDataImage(self, ignoreErrors=False): > print "Unmounting " + self.mountPoint > sys.stdout.flush() >@@ -393,68 +381,7 @@ class FvTest(Test): > print e > return False > >- def generateGuestConfigFile(self): >- guestImagePath = os.path.join(self.guestImageDirectory, self.guestImageFile) >- guestDataPath = os.path.join(self.guestImageDirectory, self.dataImageFile) >- if self.hypervisor == Constants.kvm: >- virtInstall = "virt-install --name " + self.guestName + " --ram 512 --disk path=" + guestImagePath + " --disk path=" + guestDataPath + " --network network:default --vnc --import --noreboot --noautoconsole" >- print virtInstall >- try: >- Command(virtInstall).echo() >- except HwCertCommandErrorOutput, exception: >- # ignore spurious stderr output: BZ 687526 >- print "Warning: %s" % exception >- exception.command.printErrors() >- except HwCertCommandException, exception: >- print "Error: could not generate guest config file:%s" % exception >- return False >- return True >- >- # otherwise, use direct config generation for xen >- try: >- ifconfig = Command("ifconfig") >- xenbr = ifconfig.getString(regex="eth(?P<xenbrNumber>[0-9]+)", regexGroup="xenbrNumber", singleLine=False) >- except Exception, e: >- print "Warning: could not determine xen bridge device, assuming xenbr0" >- print e >- xenbr = "0" >- >- try: >- arch = Command("uname -i").getString() >- >- guestConfigPath = os.path.join(self.environment.getGuestConfigDirectory(), self.guestConfigFile) >- guestConfig = open(guestConfigPath, "w") >- guestConfig.write("name = \"" + self.guestName + "\"\n") >- guestConfig.write("maxmem = 512\n") >- guestConfig.write("memory = 512\n") >- guestConfig.write("vcpus = 1\n") >- guestConfig.write("builder = \"hvm\"\n") >- guestConfig.write("kernel = \"/usr/lib/xen/boot/hvmloader\"\n") >- guestConfig.write("boot = \"c\"\n") >- guestConfig.write("acpi = 1\n") >- guestConfig.write("apic = 1\n") >- guestConfig.write("localtime = 0\n") >- guestConfig.write("on_poweroff = \"destroy\"\n") >- guestConfig.write("on_reboot = \"restart\"\n") >- guestConfig.write("on_crash = \"restart\"\n") >- if arch == "x86_64": >- guestConfig.write("device_model = \"/usr/lib64/xen/bin/qemu-dm\"\n") >- else: >- guestConfig.write("device_model = \"/usr/lib/xen/bin/qemu-dm\"\n") >- guestConfig.write("sdl = 0\n") >- guestConfig.write("vnc = 1\n") >- guestConfig.write("vncunused = 1\n") >- guestImagePath = os.path.join(self.environment.getGuestImageDirectory(), self.guestImageFile) >- guestDataPath = os.path.join(self.environment.getGuestImageDirectory(), self.dataImageFile) >- guestConfig.write("disk = [ \"file:" + guestImagePath + ",hda,w\", \",hdc:cdrom,r\", \"file:" + guestDataPath + ",hdb,w\" ]\n") >- guestConfig.write("vif = [ \"mac=00:16:3e:76:b5:99,bridge=xenbr%s\" ]\n" % xenbr) >- guestConfig.write("serial = \"pty\"\n") >- guestConfig.close() >- return True >- except Exception, e: >- print "Error: could not generate guest config file" >- print e >- return False >+ > > > def runGuest(self): >@@ -516,7 +443,6 @@ class FvTest(Test): > > return success > >- > def getGuestResults(self): > # mount the data image and see if the result rpm is there > result = True >@@ -529,7 +455,7 @@ class FvTest(Test): > print "Error: could not find guest test results" > print e > result = False >- >+ > try: > self.unmountDataImage() > except: >@@ -556,30 +482,29 @@ class FvTest(Test): > # otherwise > print "Error: " + test.getName() + " run on guest Failed" > return False >- >- >+ > def run(self): >- >+ > # determine whether to use xen or kvm virtualization > self.configureHypervisor() > # verify the guest, start if necessary > if not self.verifyGuest(): > return FAILED >- >+ > # submit the tasks to the guest > if not self.submitTasks(): > return FAILED >- >+ > # run the guest, wait for results, > if not self.runGuest(): > return FAILED >- >+ > # then copy the results.xml, and get the guest return value > if not self.getGuestResults(): > return FAILED >- >+ > return PASSED >- >+ > > if __name__ == "__main__": > test = FvTest() >diff --git a/hwcert/tags.py b/hwcert/tags.py >index 4628d9a..6712c47 100644 >--- a/hwcert/tags.py >+++ b/hwcert/tags.py >@@ -150,8 +150,6 @@ class Constants: > user = "user" > DEVICE = "DEVICE" > device = "device" >- RHEL5 = "RHEL5" >- RHEL4 = "RHEL4" > OSCommand = "OSCommand" > FunctionKey = "FunctionKey" > memory = "mem" >@@ -282,5 +280,7 @@ class SystemCategories: > if "_" not in key and "getAll" not in key: > categories.append(vars(SystemCategories)[key]) > return categories >- >- >+ >+class RHEL: >+ major = "RHEL7" >+ >diff --git a/tests/fv_network/fv_network.py b/tests/fv_network/fv_network.py >index 0301fbe..a1b7657 100644 >--- a/tests/fv_network/fv_network.py >+++ b/tests/fv_network/fv_network.py >@@ -24,17 +24,17 @@ from hwcert.tags import Constants > > > class FvNetworkTest(FvTest): >- >+ > def __init__(self): > FvTest.__init__(self, name="fv_network") > self.hwcertCommandInGuest = Constants.hwcert_backend + " run " >- self.testToRun = 'network' >- >+ self.testToRun = '100MegEthernet' >+ > def run(self): > if self.getTestServer() == None or self.getTestServer() == "unknown": > print "Error: No test server was set, test abort" > return 1 >- >+ > # otherwise > print "Using test server %s" % self.getTestServer() > return FvTest.run(self) >diff --git a/tools/fv-guest/fv-domU-ks-x86_64.cfg b/tools/fv-guest/fv-domU-ks-x86_64.cfg >index 8670862..4bc1af0 100644 >--- a/tools/fv-guest/fv-domU-ks-x86_64.cfg >+++ b/tools/fv-guest/fv-domU-ks-x86_64.cfg >@@ -2,10 +2,9 @@ text > key --skip > keyboard us > lang en_US >-langsupport --default en_US en_US > network --device eth0 --noipv6 --bootproto dhcp > # please change the nfs to the correct value >-url --url http://download.lab.bos.redhat.com/released/RHEL-5-Server/U7/x86_64/os >+url --url http://download.devel.redhat.com/released/RHEL-6/6.5/Server/x86_64/os > rootpw redhat > skipx > firewall --disabled >@@ -17,9 +16,9 @@ bootloader --location=mbr > # Blank all disks and write disk labels, then install to disk /dev/sda ONLY. > # NOTE: this may need to be set to sda rather than hda > clearpart --all --initlabel >-part /boot --fstype ext3 --size=100 --ondisk=hda >-part swap --size=2000 --ondisk=hda >-part / --fstype ext3 --size=100 --grow --ondisk=hda >+part /boot --fstype ext3 --size=100 --ondisk=sda >+part swap --size=2000 --ondisk=sda >+part / --fstype ext3 --size=100 --grow --ondisk=sda > > firstboot --disable > halt >@@ -38,5 +37,6 @@ cdrecord > dvd+rw-tools > httpd > mkisofs >+nfs-utils > > %post >diff --git a/tools/fv-guest/fv-domU-rc.local b/tools/fv-guest/fv-domU-rc.local >index 3a40cf1..32e54b8 100755 >--- a/tools/fv-guest/fv-domU-rc.local >+++ b/tools/fv-guest/fv-domU-rc.local >@@ -11,7 +11,7 @@ touch /var/lock/subsys/local > ######################## > > # mount the hwcertData.img >-mount /dev/hdb1 /mnt >+mount /dev/sdb1 /mnt > > # what tests to run ? > /mnt/hwcert-guest-script >diff --git a/tools/fv-guest/fv-domU-readme.txt b/tools/fv-guest/fv-domU-readme.txt >index afcdace..27fea8d 100644 >--- a/tools/fv-guest/fv-domU-readme.txt >+++ b/tools/fv-guest/fv-domU-readme.txt >@@ -118,4 +118,86 @@ label linux > > cd /var/lib/xen/images > > tar jcvf v7i386-20120215.tar.bz2 v7i386.img > >+Revised 11-25-13 RHEL 6.5 KVM guest hosted on RHEL7 >+---------------------------------------------------------------------------- >+0) rpms needed: mkisofs virt-install xen >+ >+1) get RHEL DVD iso from download.devel.redhat.com: >+ >+ > wget http://download.devel.redhat.com/released/RHEL-6/6.5/Server/x86_64/iso/RHEL6.5-20131111.0-Server-x86_64-DVD1.iso >+ > wget http://download.devel.redhat.com/released/RHEL-6/6.5/Server/x86_64/os/images/boot.iso >+ >+ >+2) mount the boot iso, copy it >+ >+ > mkdir boot >+ > mount -o loop -t iso9660 boot.iso boot >+ > cp -r boot boot-copy >+ >+4) add the kickstart file to the boot image >+ > cp v7/tools/fv-guest/fv-domU-ks-<arch>.cfg boot-copy/isolinux/ks.cfg >+ >+ NOTE: the install disk may be either sda or hda >+ >+5) set isolinux.cfg to automatically install: >+ >+ > vi boot-copy/isolinux/isolinux.cfg >+ >+ >+default linux >+prompt 0 >+timeout 60 >+[...] >+label linux >+ kernel vmlinuz >+ append initrd=initrd.img ks=cdrom:/isolinux/ks.cfg console=ttyS0,115200 >+ >+ >+ - note the console=ttyS0,114500 - needed for text console! >+ >+6) build the revised boot.iso: >+ >+ > cd boot-copy/isolinux >+ > mkisofs -r -T -J -V "RedHatKSBoot" -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -v -o ~/new-boot.iso . >+ > mv ~/new-boot.iso /var/lib/libvirt/images/boot.iso >+ >+7) On a kvm system, use virt-install to create the image: >+ >+ systemctl start libvirtd >+ virt-install --hvm --name=hwcert-x86_64 --ram=512 --vcpus=1 --network=bridge:virbr0 --vnc --file /var/lib//libvirt/images/hwcert-x86_64.img --file-size=6 --cdrom /var/lib/libvirt/images/boot.iso >+ >+ >+8) add the v7-dependant packages: dt/lmbench/stress >+ >+ > virsh start hwcert-x86_64 >+ > virsh console hwcert-x86_64 >+ >+ On the guest console, use rpm or yum to install dt, lmbench, and stress packages. >+ >+9) edit rc.local >+ >+ copy the rc.local from v7 source tree: hwcert/tools/fv-guest/fv-domU-rc.local to /etc/rc.local on the guest >+ >+10 set the fstab to never auto fsck >+ >+ edit /etc/fstab and change the 6th column to 0 for / and /boot so that the image never auto runs fsck >+ >+ shutdown the guest (poweroff) >+ >+11) tar and stamp the image: >+ >+ > cd /var/lib/libvirt/images >+ > tar jcvf hwcert-x86_64-20120215.img.tar.bz2 hwcert-x86_64.img >+ >+ [so far, the image starts, but has no eth0 - networking doesn't seem to be there] >+ [ could it be --network setting??? >+ tried this: >+ virt-install --name=hwcert-x86_64 --ram 512 --disk path=/var/lib/libvirt/images/hwcert-x86_64.img --disk path=/var/lib/libvirt/images/hwcertData.img --network network:default --vnc --import --noreboot --noautoconsole" >+ >+This worked mac address on the virt-install line: >+virt-install --name=hwcert-x86_64 --ram 512 --disk path=/var/lib/libvirt/images/hwcert-x86_64.img --disk path=/var/lib/libvirt/images/hwcertData.img --network=bridge:virbr0 --vnc --import --noreboot --noautoconsole --mac=52:54:00:61:13:bc >+ >+just downloading the xml config works fine also. >+ >+ > >-- >1.8.3.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1034808
: 832152