tests: clitest: Add windows unattended unittest

This commit is contained in:
Cole Robinson 2019-06-08 15:33:37 -04:00
parent d3b20b16d0
commit 4a04af38f1
4 changed files with 142 additions and 0 deletions

View File

@ -0,0 +1,133 @@
<domain type="kvm">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
<libosinfo:os id="http://microsoft.com/win/7"/>
</libosinfo:libosinfo>
</metadata>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch="x86_64" machine="q35">hvm</type>
<boot dev="cdrom"/>
</os>
<features>
<acpi/>
<apic/>
<hyperv>
<relaxed state="on"/>
<vapic state="on"/>
<spinlocks state="on" retries="8191"/>
</hyperv>
</features>
<cpu mode="host-model"/>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
<timer name="hypervclock" present="yes"/>
</clock>
<on_reboot>destroy</on_reboot>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="file" device="cdrom">
<driver name="qemu"/>
<source file="/tmp/fake-win7.iso"/>
<target dev="sda" bus="sata"/>
<readonly/>
</disk>
<disk type="file" device="cdrom">
<driver name="qemu"/>
<source file="/TESTSUITE_UNATTENDED_ISO"/>
<target dev="sdb" bus="sata"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="ich9-ehci1"/>
<controller type="usb" index="0" model="ich9-uhci1">
<master startport="0"/>
</controller>
<controller type="usb" index="0" model="ich9-uhci2">
<master startport="2"/>
</controller>
<controller type="usb" index="0" model="ich9-uhci3">
<master startport="4"/>
</controller>
<interface type="bridge">
<source bridge="testsuitebr0"/>
<mac address="00:11:22:33:44:55"/>
<model type="e1000e"/>
</interface>
<console type="pty"/>
</devices>
</domain>
<domain type="kvm">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
<libosinfo:os id="http://microsoft.com/win/7"/>
</libosinfo:libosinfo>
</metadata>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch="x86_64" machine="q35">hvm</type>
<boot dev="cdrom"/>
</os>
<features>
<acpi/>
<apic/>
<hyperv>
<relaxed state="on"/>
<vapic state="on"/>
<spinlocks state="on" retries="8191"/>
</hyperv>
</features>
<cpu mode="host-model"/>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
<timer name="hypervclock" present="yes"/>
</clock>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="file" device="cdrom">
<driver name="qemu"/>
<source file="/tmp/fake-win7.iso"/>
<target dev="sda" bus="sata"/>
<readonly/>
</disk>
<disk type="file" device="cdrom">
<target dev="sdb" bus="sata"/>
<readonly/>
</disk>
<controller type="usb" index="0" model="ich9-ehci1"/>
<controller type="usb" index="0" model="ich9-uhci1">
<master startport="0"/>
</controller>
<controller type="usb" index="0" model="ich9-uhci2">
<master startport="2"/>
</controller>
<controller type="usb" index="0" model="ich9-uhci3">
<master startport="4"/>
</controller>
<interface type="bridge">
<source bridge="testsuitebr0"/>
<mac address="00:11:22:33:44:55"/>
<model type="e1000e"/>
</interface>
<console type="pty"/>
</devices>
</domain>

BIN
tests/cli-test-xml/fake-win7.iso Executable file

Binary file not shown.

View File

@ -50,6 +50,7 @@ iso_links = [
"/tmp/fake-fedora17-tree.iso",
"/tmp/fake-centos65-label.iso",
"/tmp/fake-no-osinfo.iso",
"/tmp/fake-win7.iso",
]
exist_files = exist_images
@ -78,6 +79,7 @@ test_files = {
'ISOTREE': iso_links[0],
'ISOLABEL': iso_links[1],
'ISO-NO-OS': iso_links[2],
'ISO-WIN7': iso_links[3],
'TREEDIR': "%s/fakefedoratree" % XMLDIR,
'COLLIDE': "/dev/default-pool/collidevol1.img",
}
@ -786,6 +788,7 @@ c.add_compare("--location ftp://example.com", "fake-ftp") # fake ftp:// install
c.add_compare("--location https://foobar.com", "fake-http") # fake https:// install using urlfetcher.py mocking
c.add_compare("--connect %(URI-KVM)s --os-variant fedora26,install=location", "osinfo-url") # getting URL from osinfo
c.add_compare("--connect %(URI-KVM)s --os-variant fedora26 --unattended profile=desktop,admin-password=foobar", "osinfo-url-unattended") # unattended install for fedora, using initrd injection
c.add_compare("--connect %(URI-KVM)s --os-variant win7 --cdrom %(ISO-WIN7)s --unattended profile=desktop,admin-password=foobar", "osinfo-win7-unattended") # unattended install for win7
c.add_invalid("--pxe --virt-type bogus") # Bogus virt-type
c.add_invalid("--pxe --arch bogus") # Bogus arch
c.add_invalid("--livecd") # LiveCD with no media

View File

@ -129,6 +129,12 @@ class Installer(object):
self._unattended_install_cdrom_device = dev
guest.add_device(self._unattended_install_cdrom_device)
if self.conn.in_testsuite():
# pylint: disable=protected-access
# Hack to set just the XML path differently for the test suite.
# Setting this via regular 'path' will error that it doesn't exist
dev._source_file = "/TESTSUITE_UNATTENDED_ISO"
def _remove_unattended_install_cdrom_device(self, guest):
dummy = guest
if not self._unattended_install_cdrom_device: