virtinst: Test rhel defaults, and make sure it doesn't break test suite

This commit is contained in:
Cole Robinson 2013-07-13 19:38:38 -04:00
parent b152e83fef
commit e04dfdd4ff
5 changed files with 61 additions and 2 deletions

View File

@ -20,6 +20,8 @@ import os
os.environ["VIRTINST_TEST_TRACKPROPS"] = "1"
import virtinst
virtinst.enable_rhel_defaults = False
from tests import utils
# pylint: disable=W0212

View File

@ -0,0 +1,48 @@
<domain type="kvm">
<name>TestGuest</name>
<uuid>12345678-1234-1234-1234-123456789012</uuid>
<memory>409600</memory>
<currentMemory>204800</currentMemory>
<vcpu>5</vcpu>
<os>
<type arch="i686">hvm</type>
<boot dev="hd"/>
</os>
<features>
<acpi/><apic/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type="file" device="floppy">
<driver name="qemu" type="qcow2" cache="none"/>
<source file="/default-pool/testvol1.img"/>
<target dev="fda" bus="fdc"/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="raw" cache="none"/>
<source file="/tmp/test.img"/>
<target dev="vda" bus="virtio"/>
</disk>
<disk type="block" device="disk">
<driver name="qemu" type="raw" cache="none" io="native"/>
<source dev="/dev/loop0"/>
<target dev="vdb" bus="virtio"/>
</disk>
<disk type="block" device="cdrom">
<target dev="hdc" bus="ide"/>
<readonly/>
</disk>
<interface type="network">
<source network="default"/>
<mac address="22:22:33:44:55:66"/>
<model type="virtio"/>
</interface>
<input type="tablet" bus="usb"/>
<graphics type="sdl" display=":3.4" xauth="/tmp/.Xauthority"/>
<console type="pty"/>
</devices>
</domain>

View File

@ -347,6 +347,15 @@ class TestXMLConfig(unittest.TestCase):
g.os_variant = "fedora11"
self._compare(g, "install-f11", do_install)
try:
virtinst.enable_rhel_defaults = True
self._compare(g, "install-f11-rheldefaults", do_install)
finally:
virtinst.enable_rhel_defaults = False
# Verify main guest wasn't polluted
self._compare(g, "install-f11", do_install)
def testInstallFVImport(self):
i = utils.make_import_installer()
g = utils.get_basic_fullyvirt_guest(installer=i)

View File

@ -799,7 +799,7 @@ class VirtualDisk(VirtualDevice):
cache = self.driver_cache
iomode = self.driver_io
if virtinst.enable_rhel6_defaults:
if virtinst.enable_rhel_defaults:
# Enable cache=none for non-CDROM devs
if (self.conn.is_qemu() and
not cache and

View File

@ -15,7 +15,7 @@
# MA 02110-1301 USA.
from virtcli import cliconfig, cliutils
enable_rhel6_defaults = not cliconfig.rhel_enable_unsupported_opts
enable_rhel_defaults = not cliconfig.rhel_enable_unsupported_opts
cliutils.setup_i18n()