tests: clitest: Lots of house cleaning

Drop redundant tests, organize things better, add more tests where we
can stick new cli device options and view the output, since that's the
most common extension.
This commit is contained in:
Cole Robinson 2014-12-10 09:33:02 -05:00
parent 12340a3858
commit f16dc4dd34
10 changed files with 739 additions and 906 deletions

View File

@ -1,143 +0,0 @@
<domain type="kvm">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64">hvm</type>
<boot dev="network"/>
<boot dev="hd"/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<cpu mode="custom" match="exact">
<model>core2duo</model>
</cpu>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/dev/default-pool/new1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
<disk type="block" device="disk">
<driver name="qemu" type="raw" cache="none" io="native"/>
<source dev="/iscsi-pool/diskvol1"/>
<target dev="vdb" bus="virtio"/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="raw"/>
<source file="/dev/default-pool/iso-vol"/>
<target dev="vdc" bus="virtio"/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="raw"/>
<source file="/dev/default-pool/iso-vol"/>
<target dev="vdd" bus="virtio"/>
</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="eth0"/>
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>
</interface>
<input type="tablet" bus="usb"/>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
</devices>
</domain>
<domain type="kvm">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="x86_64">hvm</type>
<boot dev="hd"/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<cpu mode="custom" match="exact">
<model>core2duo</model>
</cpu>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/dev/default-pool/new1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
<disk type="block" device="disk">
<driver name="qemu" type="raw" cache="none" io="native"/>
<source dev="/iscsi-pool/diskvol1"/>
<target dev="vdb" bus="virtio"/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="raw"/>
<source file="/dev/default-pool/iso-vol"/>
<target dev="vdc" bus="virtio"/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="raw"/>
<source file="/dev/default-pool/iso-vol"/>
<target dev="vdd" bus="virtio"/>
</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="eth0"/>
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>
</interface>
<input type="tablet" bus="usb"/>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
</devices>
</domain>

View File

@ -1,44 +0,0 @@
<domain type="kvm">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<cpu mode="custom" match="exact">
<model>pentium2</model>
</cpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<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="eth0"/>
<mac address="00:11:22:33:44:55"/>
</interface>
<input type="mouse" bus="xen"/>
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>
<video>
<model type="qxl"/>
</video>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
</devices>
</domain>

View File

@ -1,245 +1,42 @@
<domain type="test">
<domain type="kvm">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<blkiotune>
<weight>200</weight>
<device>
<path>/dev/sdc</path>
<weight>300</weight>
</device>
</blkiotune>
<vcpu>1</vcpu>
<numatune>
<memory mode="preferred" nodeset="1-3,5"/>
</numatune>
<vcpu>4</vcpu>
<os>
<type arch="i686">hvm</type>
<loader>/foo/bar</loader>
<type arch="x86_64">hvm</type>
</os>
<idmap>
<uid start="0" target="1000" count="10"/>
<gid start="0" target="1000" count="10"/>
</idmap>
<features>
<apic eoi="on"/>
<acpi/>
<apic/>
<pae/>
<privnet/>
<hyperv>
<spinlocks state="on" retries="1234"/>
</hyperv>
</features>
<clock offset="localtime">
<timer name="rtc" tickpolicy="merge"/>
<timer name="hpet" present="no"/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled="yes"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<disk type="file" device="disk">
<driver cache="writeback" io="threads"/>
<source file="/dev/default-pool/UPPER"/>
<target dev="hda" bus="ide"/>
<serial>WD-WMAP9A966149</serial>
<shareable/>
<boot order="2"/>
</disk>
<disk type="file" device="disk">
<driver discard="unmap" error_policy="enospace"/>
<source file="/dev/default-pool/new1.img"/>
<target dev="hdb" bus="ide"/>
<readonly/>
</disk>
<disk type="block" device="cdrom">
<target dev="sda" bus="sata"/>
<iotune>
<read_bytes_sec>1</read_bytes_sec>
<write_bytes_sec>5</write_bytes_sec>
<total_bytes_sec>10</total_bytes_sec>
<read_iops_sec>2</read_iops_sec>
<write_iops_sec>6</write_iops_sec>
<total_iops_sec>20</total_iops_sec>
</iotune>
<readonly/>
</disk>
<disk type="file" device="disk">
<source file="/var/lib/libvirt/images/foobar.qcow2"/>
<target dev="hdc" bus="ide"/>
</disk>
<disk type="volume" device="disk">
<source volume="some-rbd-vol" pool="rbd-ceph"/>
<target dev="hdd" bus="ide"/>
</disk>
<disk type="network" device="disk">
<source protocol="http" name="/path/to/my/file">
<host name="example.com" port="8000"/>
</source>
<target dev="sdb" bus="scsi"/>
</disk>
<disk type="network" device="disk">
<source protocol="nbd">
<host transport="unix" socket="/tmp/socket"/>
</source>
<target dev="sdc" bus="scsi"/>
</disk>
<disk type="network" device="disk">
<source protocol="gluster" name="test-volume/test-gluster.qcow2">
<host name="192.168.1.100"/>
</source>
<target dev="sdd" bus="scsi"/>
</disk>
<disk type="network" device="disk">
<source protocol="qemu">
<host transport="nbd" socket="/var/foo/bar/socket"/>
</source>
<target dev="sde" bus="scsi"/>
</disk>
<disk type="network" device="disk">
<source protocol="http" name="my/path">
<host name="1:2:3:4:1:2:3:4" port="5522"/>
</source>
<target dev="sdf" bus="scsi"/>
</disk>
<disk type="network" device="disk">
<source protocol="gluster" name="test-volume/test-gluster.raw">
<host name="192.168.1.100"/>
</source>
<target dev="sdg" bus="scsi"/>
</disk>
<controller type="usb" index="0" model="ich9-ehci1">
<address type="pci" domain="0" bus="0" slot="4" function="7"/>
</controller>
<controller type="usb" index="0" model="ich9-uhci1">
<master startport="0"/>
<address type="pci" domain="0" bus="0" slot="4" function="0" multifunction="on"/>
</controller>
<controller type="usb" index="0" model="ich9-uhci2">
<master startport="2"/>
<address type="pci" domain="0" bus="0" slot="4" function="1"/>
</controller>
<controller type="usb" index="0" model="ich9-uhci3">
<master startport="4"/>
<address type="pci" domain="0" bus="0" slot="4" function="2"/>
</controller>
<filesystem accessmode="squash">
<source dir="/source"/>
<target dir="/target"/>
</filesystem>
<interface type="user">
<source portgroup="foo"/>
<mac address="12:34:56:78:11:22"/>
</interface>
<interface type="bridge">
<source bridge="foobar"/>
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>
<driver name="qemu" queues="3"/>
</interface>
<interface type="direct">
<source dev="eth5" mode="vepa"/>
<mac address="00:11:22:33:44:55"/>
<target dev="mytap12"/>
<virtualport type="802.1Qbg">
<parameters managerid="12" typeid="1193046" typeidversion="1" instanceid="09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b"/>
</virtualport>
<boot order="1"/>
</interface>
<input type="mouse" bus="ps2"/>
<serial type="tcp">
<source mode="bind" host="127.0.0.1" service="2222"/>
<protocol type="telnet"/>
</serial>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0" bus="0" slot="25" function="0"/>
</source>
<rom bar="off"/>
<boot order="4"/>
</hostdev>
<smartcard mode="passthrough" type="spicevmc"/>
<redirdev bus="spicevmc" type="spicevmc">
<boot order="3"/>
</redirdev>
<tpm model="tpm-tis">
<backend type="passthrough">
<device path="/dev/tpm0"/>
</backend>
</tpm>
<panic>
<address type="isa" iobase="0x505"/>
</panic>
</devices>
<seclabel type="static" model="testSecurity" relabel="yes">
<label>system_u:object_r:svirt_image_t:s0:c100,c200</label>
</seclabel>
</domain>
<domain type="test">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<blkiotune>
<weight>200</weight>
<device>
<path>/dev/sdc</path>
<weight>300</weight>
</device>
</blkiotune>
<vcpu>1</vcpu>
<numatune>
<memory mode="preferred" nodeset="1-3,5"/>
</numatune>
<os>
<type arch="i686">hvm</type>
<loader>/foo/bar</loader>
</os>
<idmap>
<uid start="0" target="1000" count="10"/>
<gid start="0" target="1000" count="10"/>
</idmap>
<features>
<apic eoi="on"/>
<pae/>
<privnet/>
<hyperv>
<spinlocks state="on" retries="1234"/>
</hyperv>
</features>
<clock offset="localtime">
<timer name="rtc" tickpolicy="merge"/>
<cpu>
<topology sockets="4" cores="1" threads="1"/>
</cpu>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<pm>
<suspend-to-mem enabled="yes"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/bin/test-hv</emulator>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="file" device="disk">
<driver cache="writeback" io="threads"/>
<driver name="qemu" type="raw" cache="writeback" io="threads"/>
<source file="/dev/default-pool/UPPER"/>
<target dev="hda" bus="ide"/>
<target dev="vda" bus="virtio"/>
<serial>WD-WMAP9A966149</serial>
<shareable/>
<boot order="2"/>
</disk>
<disk type="file" device="disk">
<driver discard="unmap" error_policy="enospace"/>
<driver name="qemu" type="qcow2" discard="unmap" error_policy="enospace"/>
<source file="/dev/default-pool/new1.img"/>
<target dev="hdb" bus="ide"/>
<target dev="vdb" bus="virtio"/>
<readonly/>
</disk>
<disk type="block" device="cdrom">
@ -255,48 +52,76 @@
<readonly/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/var/lib/libvirt/images/foobar.qcow2"/>
<target dev="hdc" bus="ide"/>
<target dev="vdc" bus="virtio"/>
</disk>
<disk type="block" device="disk">
<driver name="qemu" type="raw" cache="none" io="native"/>
<source dev="/iscsi-pool/diskvol1"/>
<target dev="vdd" bus="virtio"/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="raw"/>
<source file="/dev/default-pool/iso-vol"/>
<target dev="vde" bus="virtio"/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="raw"/>
<source file="/dev/default-pool/iso-vol"/>
<target dev="vdf" bus="virtio"/>
</disk>
<disk type="volume" device="disk">
<driver name="qemu" type="unknown"/>
<source volume="some-rbd-vol" pool="rbd-ceph"/>
<target dev="hdd" bus="ide"/>
<target dev="vdg" bus="virtio"/>
</disk>
<disk type="network" device="disk">
<driver name="qemu"/>
<source protocol="http" name="/path/to/my/file">
<host name="example.com" port="8000"/>
</source>
<target dev="vdh" bus="virtio"/>
</disk>
<disk type="network" device="disk">
<driver name="qemu"/>
<source protocol="nbd">
<host transport="unix" socket="/tmp/socket"/>
</source>
<target dev="sdb" bus="scsi"/>
</disk>
<disk type="network" device="disk">
<source protocol="nbd">
<host transport="unix" socket="/tmp/socket"/>
</source>
<target dev="sdc" bus="scsi"/>
</disk>
<disk type="network" device="disk">
<driver name="qemu" type="qcow2"/>
<source protocol="gluster" name="test-volume/test-gluster.qcow2">
<host name="192.168.1.100"/>
</source>
<target dev="sdd" bus="scsi"/>
<target dev="vdi" bus="virtio"/>
</disk>
<disk type="network" device="disk">
<driver name="qemu"/>
<source protocol="qemu">
<host transport="nbd" socket="/var/foo/bar/socket"/>
</source>
<target dev="sde" bus="scsi"/>
<target dev="sdc" bus="usb" removable="on"/>
</disk>
<disk type="network" device="disk">
<driver name="qemu"/>
<source protocol="http" name="my/path">
<host name="1:2:3:4:1:2:3:4" port="5522"/>
</source>
<target dev="sdf" bus="scsi"/>
<target dev="vdj" bus="virtio"/>
</disk>
<disk type="network" device="disk">
<source protocol="gluster" name="test-volume/test-gluster.raw">
<driver name="qemu" type="raw"/>
<source protocol="gluster" name="test-volume/test-gluster.raw" startupPolicy="optional">
<host name="192.168.1.100"/>
</source>
<target dev="sdg" bus="scsi"/>
<target dev="vdk" bus="virtio"/>
</disk>
<disk type="dir" device="floppy">
<driver name="qemu"/>
<source dir="/home/crobinso/src/virt-manager"/>
<target dev="fda" bus="fdc"/>
</disk>
<controller type="usb" index="0" model="ich9-ehci1">
<address type="pci" domain="0" bus="0" slot="4" function="7"/>
@ -317,9 +142,14 @@
<source dir="/source"/>
<target dir="/target"/>
</filesystem>
<filesystem type="template">
<source name="template_name"/>
<target dir="/"/>
</filesystem>
<interface type="user">
<source portgroup="foo"/>
<mac address="12:34:56:78:11:22"/>
<model type="virtio"/>
</interface>
<interface type="bridge">
<source bridge="foobar"/>
@ -331,19 +161,48 @@
<source dev="eth5" mode="vepa"/>
<mac address="00:11:22:33:44:55"/>
<target dev="mytap12"/>
<model type="virtio"/>
<virtualport type="802.1Qbg">
<parameters managerid="12" typeid="1193046" typeidversion="1" instanceid="09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b"/>
</virtualport>
<boot order="1"/>
</interface>
<input type="mouse" bus="ps2"/>
<input type="tablet" bus="usb"/>
<graphics type="sdl" display=":3.4" xauth="/tmp/.Xauthority"/>
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes"/>
<graphics type="vnc" port="5950" keymap="ja" listen="1.2.3.4" passwd="foo"/>
<graphics type="spice" port="5950" tlsPort="5950" keymap="ja" listen="1.2.3.4"/>
<serial type="tcp">
<source mode="bind" host="127.0.0.1" service="2222"/>
<protocol type="telnet"/>
</serial>
<parallel type="udp">
<source mode="bind" host="127.0.0.1" service="1234"/>
<source mode="connect" host="0.0.0.0" service="1234"/>
</parallel>
<parallel type="unix">
<source mode="bind" path="/tmp/foo-socket"/>
</parallel>
<console type="pty">
<target type="virtio"/>
</console>
<channel type="pty">
<target type="guestfwd" address="127.0.0.1" port="10000"/>
</channel>
<channel type="pty">
<target type="virtio" name="org.linux-kvm.port1"/>
</channel>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>
<sound model="ich6"/>
<sound model="ac97"/>
<video>
<model type="cirrus"/>
</video>
<video>
<model type="qxl"/>
</video>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0" bus="0" slot="25" function="0"/>
@ -351,20 +210,63 @@
<rom bar="off"/>
<boot order="4"/>
</hostdev>
<hostdev mode="subsystem" type="usb" managed="yes">
<source>
<vendor id="0x0781"/>
<product id="0x5151"/>
</source>
</hostdev>
<hostdev mode="subsystem" type="usb" managed="yes">
<source>
<vendor id="0x04b3"/>
<product id="0x4485"/>
</source>
</hostdev>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0" bus="21" slot="0" function="1"/>
</source>
</hostdev>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="2" bus="21" slot="0" function="2"/>
</source>
</hostdev>
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0" bus="21" slot="0" function="3"/>
</source>
</hostdev>
<hostdev mode="subsystem" type="usb" managed="yes">
<source>
<vendor id="0x0781"/>
<product id="0x5151"/>
</source>
<driver name="vfio"/>
</hostdev>
<hostdev mode="subsystem" type="usb" managed="yes">
<source>
<vendor id="0x04b3"/>
<product id="0x4485"/>
</source>
</hostdev>
<smartcard mode="passthrough" type="spicevmc"/>
<redirdev bus="spicevmc" type="spicevmc">
<smartcard mode="passthrough" type="host"/>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="tcp">
<source host="localhost" service="4000"/>
</redirdev>
<redirdev bus="usb" type="tcp">
<source host="127.0.0.1" service="4002"/>
<boot order="3"/>
</redirdev>
<tpm model="tpm-tis">
<backend type="passthrough">
<device path="/dev/tpm0"/>
<rng model="virtio">
<backend model="egd" type="tcp">
<source mode="connect" host="127.0.0.1" service="8000"/>
</backend>
</tpm>
</rng>
<panic>
<address type="isa" iobase="0x505"/>
<address iobase="507" type="isa"/>
</panic>
</devices>
<seclabel type="static" model="testSecurity" relabel="yes">
<label>system_u:object_r:svirt_image_t:s0:c100,c200</label>
</seclabel>
</domain>

View File

@ -1,33 +0,0 @@
<domain type="qemu">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="sparc" machine="SS-20">hvm</type>
<boot dev="fd"/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-sparc</emulator>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
</interface>
<graphics type="sdl" display=":3.4" xauth="/tmp/.Xauthority"/>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
</devices>
</domain>

View File

@ -1,19 +1,28 @@
<domain type="kvm">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<description>foobar &amp; baz</description>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
<memoryBacking>
<hugepages/>
</memoryBacking>
<vcpu cpuset="1,3-5">4</vcpu>
<numatune>
<memory nodeset="1,2,3,5-7,^6"/>
</numatune>
<os>
<type arch="x86_64" machine="pc">hvm</type>
<boot dev="fd"/>
<type arch="x86_64">hvm</type>
<boot dev="network"/>
<boot dev="hd"/>
<bootmenu enable="yes"/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset="utc">
<cpu mode="host-model"/>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
@ -21,14 +30,11 @@
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<resource>
<partition>/virtualmachines/production</partition>
</resource>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/dev/default-pool/testvol1.img"/>
<target dev="sda" bus="scsi"/>
</disk>
<controller type="virtio-scsi" index="0"/>
<controller type="usb" index="0" model="ich9-ehci1"/>
<controller type="usb" index="0" model="ich9-uhci1">
<master startport="0"/>
@ -39,14 +45,8 @@
<controller type="usb" index="0" model="ich9-uhci3">
<master startport="4"/>
</controller>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>
</interface>
<input type="tablet" bus="usb"/>
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes"/>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
@ -54,11 +54,22 @@
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>
<sound model="ich6"/>
<video>
<model type="qxl"/>
<model type="vga"/>
</video>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<watchdog model="i6300esb" action="reset"/>
<memballoon model="none"/>
<tpm model="tpm-tis">
<backend type="passthrough">
<device path="/dev/tpm0"/>
</backend>
</tpm>
<rng model="virtio">
<backend model="random">/dev/random</backend>
</rng>
<panic>
<address type="isa" iobase="0x505"/>
</panic>
</devices>
<seclabel type="dynamic" model="selinux"/>
</domain>

View File

@ -0,0 +1,240 @@
<domain type="kvm">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<title>my-title</title>
<description>my-description</description>
<memory>1048576</memory>
<currentMemory>524288</currentMemory>
<blkiotune>
<weight>100</weight>
<device>
<path>/home/test/1.img</path>
<weight>200</weight>
</device>
</blkiotune>
<memtune>
<hard_limit>10</hard_limit>
<soft_limit>20</soft_limit>
<swap_hard_limit>30</swap_hard_limit>
<min_guarantee>40</min_guarantee>
</memtune>
<memoryBacking>
<nosharepages/>
<locked/>
<hugepages>
<page size="1" unit="G" nodeset="1,2-5"/>
</hugepages>
</memoryBacking>
<vcpu>4</vcpu>
<numatune>
<memory mode="strict" nodeset="1-3,4"/>
</numatune>
<os>
<type arch="x86_64">hvm</type>
<loader>/foo/bar</loader>
<boot dev="cdrom"/>
<boot dev="fd"/>
<boot dev="hd"/>
<boot dev="network"/>
<bootmenu enable="no"/>
</os>
<idmap>
<uid start="0" target="1000" count="10"/>
<gid start="0" target="1000" count="10"/>
</idmap>
<features>
<apic eoi="on"/>
<pae/>
<privnet/>
<hyperv>
<spinlocks state="on" retries="1234"/>
</hyperv>
</features>
<cpu mode="custom" match="strict">
<model>foobar</model>
<vendor>meee</vendor>
<topology sockets="2" cores="2" threads="2"/>
<feature policy="force" name="x2apic"/>
<feature policy="force" name="x2apicagain"/>
<feature policy="require" name="reqtest"/>
<feature policy="optional" name="opttest"/>
<feature policy="disable" name="distest2"/>
<feature policy="disable" name="distest"/>
<feature policy="forbid" name="foo"/>
<feature policy="forbid" name="bar"/>
</cpu>
<clock offset="utc">
<timer name="rtc" tickpolicy="merge"/>
<timer name="hpet" present="no"/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<resource>
<partition>/virtualmachines/production</partition>
</resource>
<pm>
<suspend-to-mem enabled="yes"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<controller type="usb" index="0" model="nec-xhci"/>
<controller type="virtio-scsi" index="0"/>
<filesystem>
<source dir="/foo/source"/>
<target dir="/bar/target"/>
</filesystem>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>
</interface>
<input type="tablet" bus="usb"/>
<graphics type="vnc" port="-1"/>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
<watchdog model="ib700" action="pause"/>
<memballoon model="virtio"/>
<tpm model="tpm-tis">
<backend type="passthrough">
<device path="/dev/tpm0"/>
</backend>
</tpm>
<rng model="virtio">
<backend model="egd" type="udp">
<source mode="bind" host="127.0.0.1" service="8000"/>
<source mode="connect" host="foo" service="708"/>
</backend>
</rng>
<panic>
<address iobase="0x506" type="isa"/>
</panic>
</devices>
<seclabel type="static" model="selinux" relabel="yes">
<label>system_u:object_r:svirt_image_t:s0:c100,c200</label>
</seclabel>
</domain>
<domain type="kvm">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<title>my-title</title>
<description>my-description</description>
<memory>1048576</memory>
<currentMemory>524288</currentMemory>
<blkiotune>
<weight>100</weight>
<device>
<path>/home/test/1.img</path>
<weight>200</weight>
</device>
</blkiotune>
<memtune>
<hard_limit>10</hard_limit>
<soft_limit>20</soft_limit>
<swap_hard_limit>30</swap_hard_limit>
<min_guarantee>40</min_guarantee>
</memtune>
<memoryBacking>
<nosharepages/>
<locked/>
<hugepages>
<page size="1" unit="G" nodeset="1,2-5"/>
</hugepages>
</memoryBacking>
<vcpu>4</vcpu>
<numatune>
<memory mode="strict" nodeset="1-3,4"/>
</numatune>
<os>
<type arch="x86_64">hvm</type>
<loader>/foo/bar</loader>
<boot dev="cdrom"/>
<boot dev="fd"/>
<boot dev="hd"/>
<boot dev="network"/>
<bootmenu enable="no"/>
</os>
<idmap>
<uid start="0" target="1000" count="10"/>
<gid start="0" target="1000" count="10"/>
</idmap>
<features>
<apic eoi="on"/>
<pae/>
<privnet/>
<hyperv>
<spinlocks state="on" retries="1234"/>
</hyperv>
</features>
<cpu mode="custom" match="strict">
<model>foobar</model>
<vendor>meee</vendor>
<topology sockets="2" cores="2" threads="2"/>
<feature policy="force" name="x2apic"/>
<feature policy="force" name="x2apicagain"/>
<feature policy="require" name="reqtest"/>
<feature policy="optional" name="opttest"/>
<feature policy="disable" name="distest2"/>
<feature policy="disable" name="distest"/>
<feature policy="forbid" name="foo"/>
<feature policy="forbid" name="bar"/>
</cpu>
<clock offset="utc">
<timer name="rtc" tickpolicy="merge"/>
<timer name="hpet" present="no"/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<resource>
<partition>/virtualmachines/production</partition>
</resource>
<pm>
<suspend-to-mem enabled="yes"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<controller type="usb" index="0" model="nec-xhci"/>
<controller type="virtio-scsi" index="0"/>
<filesystem>
<source dir="/foo/source"/>
<target dir="/bar/target"/>
</filesystem>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>
</interface>
<input type="tablet" bus="usb"/>
<graphics type="vnc" port="-1"/>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
<watchdog model="ib700" action="pause"/>
<memballoon model="virtio"/>
<tpm model="tpm-tis">
<backend type="passthrough">
<device path="/dev/tpm0"/>
</backend>
</tpm>
<rng model="virtio">
<backend model="egd" type="udp">
<source mode="bind" host="127.0.0.1" service="8000"/>
<source mode="connect" host="foo" service="708"/>
</backend>
</rng>
<panic>
<address iobase="0x506" type="isa"/>
</panic>
</devices>
<seclabel type="static" model="selinux" relabel="yes">
<label>system_u:object_r:svirt_image_t:s0:c100,c200</label>
</seclabel>
</domain>

View File

@ -1,22 +0,0 @@
<domain type="xen">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type="file" device="disk">
<source file="/dev/default-pool/testvol1.img"/>
<target dev="xvda" bus="xen"/>
</disk>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
</interface>
<graphics type="vnc" port="-1" keymap="en-us"/>
</devices>
</domain>

View File

@ -1,68 +0,0 @@
<domain type="xen">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="ia64">hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<kernel>/tmp/virtinst-vmlinuz.</kernel>
<initrd>/tmp/virtinst-initrd.img.</initrd>
<cmdline>method=tests/cli-test-xml/faketree</cmdline>
</os>
<features>
<acpi/>
<apic/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type="file" device="disk">
<source file="/dev/default-pool/testvol1.img"/>
<target dev="hda" bus="ide"/>
</disk>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
</interface>
<graphics type="vnc" port="-1" keymap="en-us"/>
<console type="pty"/>
</devices>
</domain>
<domain type="xen">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="ia64">hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<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="disk">
<source file="/dev/default-pool/testvol1.img"/>
<target dev="hda" bus="ide"/>
</disk>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
</interface>
<graphics type="vnc" port="-1" keymap="en-us"/>
<console type="pty"/>
</devices>
</domain>

View File

@ -1,49 +0,0 @@
<domain type="xen">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="ia64">linux</type>
<kernel>/tmp/virtinst-vmlinuz.</kernel>
<initrd>/tmp/virtinst-initrd.img.</initrd>
<cmdline>method=tests/cli-test-xml/faketree</cmdline>
</os>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<disk type="file" device="disk">
<source file="/dev/default-pool/testvol1.img"/>
<target dev="xvda" bus="xen"/>
</disk>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
</interface>
<graphics type="vnc" port="-1" keymap="en-us"/>
</devices>
</domain>
<domain type="xen">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<bootloader>/usr/bin/pygrub</bootloader>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<disk type="file" device="disk">
<source file="/dev/default-pool/testvol1.img"/>
<target dev="xvda" bus="xen"/>
</disk>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
</interface>
<graphics type="vnc" port="-1" keymap="en-us"/>
</devices>
</domain>

View File

@ -442,271 +442,188 @@ class App(object):
# in tests/clitest-xml/compare/
#
######################
# virt-install tests #
######################
vinst = App("virt-install")
c = vinst.add_category("cpuram", "--hvm --nographics --noautoconsole --nodisks --pxe")
c.add_valid("--vcpus 32") # Max VCPUS
c.add_valid("--vcpus 4 --cpuset=1,3-5") # Cpuset
c.add_valid("--vcpus 4 --cpuset=1,3-5,") # Cpuset with trailing comma
c.add_valid("--vcpus 4 --cpuset=auto") # Cpuset with trailing comma
c.add_valid("--ram 4000000") # Ram overcommit
c.add_valid("--vcpus 4,cores=2,threads=2,sockets=2") # Topology
c.add_valid("--vcpus 4,cores=1") # Topology auto-fill
c.add_valid("--vcpus sockets=2,threads=2") # Topology only
c.add_valid("--cpu somemodel") # Simple --cpu
c.add_valid("--cpu foobar,+x2apic,+x2apicagain,-distest,forbid=foo,forbid=bar,disable=distest2,optional=opttest,require=reqtest,match=strict,vendor=meee") # Crazy --cpu
c.add_valid("--cpu host --numatune 1,2,3,5-7,^6") # Simple --numatune
c.add_valid("--numatune 1-3,4,mode=strict") # More complex, parser should do the right thing here
c.add_valid("--blkiotune weight=100,device_path=/home/test/1.img,device_weight=200") # --blkiotune
c.add_valid("--memtune hard_limit=10,soft_limit=20,swap_hard_limit=30,min_guarantee=40") # --memtune
c.add_valid("--memorybacking size=1,unit='G',nodeset='1,2-5',nosharepages=yes,locked=yes") # --memorybacking hugepages/page/[@size, @unit, @nodeset] nosharepages,locked
c.add_valid("--idmap uid_start=0,uid_target=1000,uid_count=10,gid_start=0,gid_target=1000,gid_count=10") # --idmap
c.add_valid("--resource partition=/virtualmachines/production") # --resource
c.add_compare("--connect %(DEFAULTURI)s --cpuset auto --vcpus 2", "cpuset-auto") # --cpuset=auto actually works
c.add_invalid("--vcpus 32 --cpuset=969-1000") # Bogus cpuset
c.add_invalid("--vcpus 32 --cpuset=autofoo") # Bogus cpuset
c.add_invalid("--clock foo_tickpolicy=merge") # Unknown timer
#############################################
# virt-install verbose XML comparison tests #
#############################################
c = vinst.add_category("xml-comparsion", "--connect %(KVMURI)s --noautoconsole --os-variant fedora20")
# Singleton element test #1, for simpler strings
c.add_compare(""" \
--memory 1024 \
--vcpus 4 --cpuset=1,3-5 \
--cpu host \
--description \"foobar & baz\" \
--boot network,hd,menu=on \
--security type=dynamic \
--numatune 1,2,3,5-7,^6 \
--memorybacking hugepages=on \
--features apic=off \
--clock offset=localtime \
--resource /virtualmachines/production \
--events on_crash=restart \
\
--disk none \
--console none \
--network none \
--controller usb2 \
--graphics spice \
--video vga \
--sound none \
--redirdev none \
--memballoon none \
--smartcard none \
--watchdog default \
--panic default \
--tpm /dev/tpm0 \
--rng /dev/random \
""", "singleton-config-1")
# Singleton element test #2, for complex strings
c.add_compare("""--pxe \
--memory 512,maxmemory=1024 \
--vcpus 4,cores=2,threads=2,sockets=2 \
--cpu foobar,+x2apic,+x2apicagain,-distest,forbid=foo,forbid=bar,disable=distest2,optional=opttest,require=reqtest,match=strict,vendor=meee \
--metadata title=my-title,description=my-description,uuid=00000000-1111-2222-3333-444444444444 \
--boot cdrom,fd,hd,network,menu=off,loader=/foo/bar \
--idmap uid_start=0,uid_target=1000,uid_count=10,gid_start=0,gid_target=1000,gid_count=10 \
--security type=static,label='system_u:object_r:svirt_image_t:s0:c100,c200',relabel=yes \
--numatune 1-3,4,mode=strict \
--memtune hard_limit=10,soft_limit=20,swap_hard_limit=30,min_guarantee=40 \
--blkiotune weight=100,device_path=/home/test/1.img,device_weight=200 \
--memorybacking size=1,unit='G',nodeset='1,2-5',nosharepages=yes,locked=yes \
--features acpi=off,eoi=on,privnet=on,hyperv_spinlocks=on,hyperv_spinlocks_retries=1234 \
--clock offset=utc,hpet_present=no,rtc_tickpolicy=merge \
--pm suspend_to_mem=yes,suspend_to_disk=no \
--resource partition=/virtualmachines/production \
--events on_poweroff=destroy,on_reboot=restart,on_crash=preserve \
\
--controller usb3 \
--controller virtio-scsi \
--graphics vnc \
--filesystem /foo/source,/bar/target \
--memballoon virtio \
--watchdog ib700,action=pause \
--tpm passthrough,model=tpm-tis,path=/dev/tpm0 \
--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=udp,backend_mode=bind,backend_connect_host=foo,backend_connect_service=708 \
--panic iobase=0x506 \
""", "singleton-config-2")
c = vinst.add_category("smartcard", "--noautoconsole --nodisks --pxe")
c.add_valid("--smartcard host") # --smartcard host
c.add_valid("--smartcard none") # --smartcard none,
c.add_valid("--smartcard passthrough,type=spicevmc") # --smartcard mode with type
c.add_invalid("--smartcard passthrough,type=foo") # Invalid type
# Device testing #1
c = vinst.add_category("tpm", "--noautoconsole --nodisks --pxe")
c.add_valid("--tpm passthrough") # --tpm passthrough
c.add_valid("--tpm passthrough,model=tpm-tis") # --tpm backend type with model
c.add_valid("--tpm passthrough,model=tpm-tis,path=/dev/tpm0") # --tpm backend type with model and device path
c.add_invalid("--tpm passthrough,model=foo") # Invalid model
c = vinst.add_category("rng", "--noautoconsole --nodisks --pxe")
c.add_valid("--rng random,device=/dev/random") # random device backend
c.add_valid("--rng /dev/random") # random device backend, short form
c.add_invalid("--rng /FOO/BAR") # random device backend, short form, invalid device
c.add_valid("--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=tcp") # egd backend
c.add_valid("--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=tcp,backend_mode=bind") # egd backend, bind mode
c.add_invalid("--rng foo,backend_host=127.0.0.1,backend_service=8000,backend_mode=connect") # invalid type
c.add_invalid("--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=udp,backend_mode=bind") # invalid only bind for udp
c.add_valid("--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=tcp,backend_mode=bind") # egd backend, bind mode
c.add_valid("--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=udp,backend_mode=bind,backend_connect_host=foo,backend_connect_service=708") # egd backend, udp mode bind, bind backend mode
c = vinst.add_category("panic", "--noautoconsole --nodisks --pxe")
c.add_valid("--panic default") # panic device with default setting
c.add_valid("--panic iobase=0x506") # panic device with iobase=0x506
c.add_valid("--panic iobase=507") # panic device with iobase=0x507
c = vinst.add_category("xen", "--connect %(XENURI)s --noautoconsole")
c.add_compare("--disk %(EXISTIMG1)s --import", "xen-default") # Xen default
c.add_compare("--disk %(EXISTIMG1)s --location %(TREEDIR)s --paravirt", "xen-pv") # Xen PV
c.add_compare("--disk %(EXISTIMG1)s --cdrom %(EXISTIMG1)s --livecd --hvm", "xen-hvm") # Xen HVM
c.add_compare("--connect %(XENIA64URI)s --disk %(EXISTIMG1)s --import", "xen-ia64-default") # ia64 default
c.add_compare("--connect %(XENIA64URI)s --disk %(EXISTIMG1)s --location %(TREEDIR)s --paravirt", "xen-ia64-pv") # ia64 pv
c.add_compare("--connect %(XENIA64URI)s --disk %(EXISTIMG1)s --location %(TREEDIR)s --hvm", "xen-ia64-hvm") # ia64 hvm
c.add_valid("--disk none --cdrom %(EXISTIMG1)s --livecd --hvm") # HVM
c.add_valid("--disk none --boot hd --paravirt") # PV
c.add_valid("--disk none --boot hd --paravirt --arch i686") # 32 on 64 xen
c = vinst.add_category("kvm", "--connect %(KVMURI)s --noautoconsole")
c.add_compare("--os-variant fedora20 --file %(EXISTIMG1)s --location %(TREEDIR)s --extra-args console=ttyS0 --cpu host --channel none --console none --sound none --redirdev none", "kvm-f14-url") # F14 Directory tree URL install with extra-args
c.add_compare("--test-media-detection %(TREEDIR)s", "test-url-detection")
c.add_compare("--os-variant fedora20 --disk %(NEWIMG1)s,size=.01,format=vmdk --location %(TREEDIR)s --extra-args console=ttyS0 --quiet", "quiet-url") # Quiet URL install should make no noise
c.add_compare("--cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --wait 0 --sound --controller usb", "kvm-win2k3-cdrom") # HVM windows install with disk
c.add_compare("--os-variant fedora20 --nodisks --boot hd --paravirt --cpu pentium2", "kvm-xenner") # xenner
c.add_compare("--os-variant ubuntusaucy --nodisks --boot cdrom --virt-type qemu --cpu Penryn", "qemu-plain") # plain qemu
c.add_compare("--os-variant fedora20 --nodisks --boot network --nographics --arch i686", "qemu-32-on-64") # 32 on 64
c.add_compare("--os-variant fedora20 --boot fd --graphics spice --machine pc --cpu none --disk %(EXISTIMG1)s,bus=scsi --controller virtio-scsi", "kvm-machine") # kvm machine type 'pc'
c.add_compare("--os-variant fedora20 --nodisks --boot fd --graphics sdl --arch sparc --machine SS-20", "qemu-sparc") # exotic arch + machine type
c.add_compare("--arch armv7l --machine vexpress-a9 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,dtb=/f19-arm.dtb,extra_args=\"console=ttyAMA0 rw root=/dev/mmcblk0p3\" --disk %(EXISTIMG1)s --nographics", "arm-vexpress-plain", skip_check=support.SUPPORT_CONN_DISK_SD)
c.add_compare("--arch armv7l --machine vexpress-a15 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,dtb=/f19-arm.dtb,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s --nographics --os-variant fedora19", "arm-vexpress-f19", skip_check=support.SUPPORT_CONN_VIRTIO_MMIO)
c.add_compare("--arch armv7l --machine virt --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s --nographics --os-variant fedora20", "arm-virt-f20")
c.add_compare("--arch armv7l --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s --os-variant fedora20", "arm-defaultmach-f20")
c.add_compare("--arch aarch64 --machine virt --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s", "aarch64-machvirt")
c.add_compare("--arch aarch64 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s", "aarch64-machdefault")
c.add_compare("--arch aarch64 --cdrom %(EXISTIMG2)s --boot loader=CODE.fd,nvram_template=VARS.fd --disk %(EXISTIMG1)s", "aarch64-cdrom")
c.add_compare("--arch ppc64 --machine pseries --boot network --disk %(EXISTIMG1)s --os-variant fedora20 --network none", "ppc64-pseries-f20")
c.add_compare("--arch ppc64 --boot network --disk %(EXISTIMG1)s --os-variant fedora20 --network none", "ppc64-machdefault-f20")
c.add_compare("--disk none --location /tmp/fake.iso --nonetworks", "location-iso") # Using --location iso mounting
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel6.4", "kvm-rhel6") # RHEL6 defaults
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel7.0", "kvm-rhel7") # RHEL7 defaults
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant centos7.0", "kvm-centos7") # Centos 7 defaults
c.add_valid("--cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --wait 0 --sound") # HVM windows install with disk
c.add_valid("--os-variant fedora20 --file %(EXISTIMG1)s --location %(TREEDIR)s --extra-args console=ttyS0 --sound") # F14 Directory tree URL install with extra-args
c.add_invalid("--disk none --boot network --machine foobar") # Unknown machine type
c.add_invalid("--nodisks --boot network --arch mips --virt-type kvm") # Invalid domain type for arch
c.add_invalid("--nodisks --boot network --paravirt --arch mips") # Invalid arch/virt combo
c = vinst.add_category("misc", "--nographics --noautoconsole")
c.add_valid("--panic help --disk=?") # Make sure introspection doesn't blow up
c.add_compare("", "noargs-fail", auto_printarg=False) # No arguments
c.add_compare("--hvm --nodisks --pxe --print-step all", "simple-pxe") # Diskless PXE install
c.add_compare("--hvm --cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --wait 0 --vcpus cores=4 --controller usb,model=none", "w2k3-cdrom") # HVM windows install with disk
c.add_compare("""--hvm --pxe \
--controller usb,model=ich9-ehci1,address=0:0:4.7,index=0 \
--controller usb,model=ich9-uhci1,address=0:0:4.0,index=0,master=0 \
--controller usb,model=ich9-uhci2,address=0:0:4.1,index=0,master=2 \
--controller usb,model=ich9-uhci3,address=0:0:4.2,index=0,master=4 \
c.add_compare(""" \
--vcpus 4,cores=1 \
--cpu none \
\
--disk %(EXISTUPPER)s,cache=writeback,io=threads,perms=sh,serial=WD-WMAP9A966149,boot_order=2 \
--disk %(NEWIMG1)s,sparse=false,size=.001,perms=ro,error_policy=enospace,discard=unmap \
--disk device=cdrom,bus=sata,read_bytes_sec=1,read_iops_sec=2,total_bytes_sec=10,total_iops_sec=20,write_bytes_sec=5,write_iops_sec=6 \
--disk size=1 \
--disk source_pool=rbd-ceph,source_volume=some-rbd-vol \
--disk source_protocol=http,source_host_name=example.com,source_host_port=8000,source_name=/path/to/my/file,bus=scsi \
--disk source_protocol=nbd,source_host_transport=unix,source_host_socket=/tmp/socket,bus=scsi \
--disk gluster://192.168.1.100/test-volume/test-gluster.qcow2,bus=scsi \
--disk qemu+nbd:///var/foo/bar/socket,bus=scsi \
--disk path=http://[1:2:3:4:1:2:3:4]:5522/my/path?query=foo,bus=scsi \
--disk vol=gluster-pool/test-gluster.raw,bus=scsi \
--serial tcp,host=:2222,mode=bind,protocol=telnet \
--filesystem /source,/target,mode=squash \
--network user,mac=12:34:56:78:11:22,portgroup=foo \
--network bridge=foobar,model=virtio,driver_name=qemu,driver_queues=3 \
--network type=direct,source=eth5,source_mode=vepa,target=mytap12,virtualport_type=802.1Qbg,virtualport_managerid=12,virtualport_typeid=1193046,virtualport_typeidversion=1,virtualport_instanceid=09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b,boot_order=1 \
--channel spicevmc \
--redirdev spicevmc,boot_order=3
--smartcard passthrough,type=spicevmc \
--tpm /dev/tpm0 \
--panic default \
--security type=static,label='system_u:object_r:svirt_image_t:s0:c100,c200',relabel=yes \
--numatune \\"1-3,5\\",mode=preferred \
--blkiotune weight=200,device_path=/dev/sdc,device_weight=300 \
--idmap uid_start=0,uid_target=1000,uid_count=10,gid_start=0,gid_target=1000,gid_count=10 \
--boot loader=/foo/bar \
--hostdev net_00_1c_25_10_b1_e4,boot_order=4,rom_bar=off \
--features acpi=off,eoi=on,privnet=on,hyperv_spinlocks=on,hyperv_spinlocks_retries=1234 \
--clock offset=localtime,hpet_present=no,rtc_tickpolicy=merge \
--pm suspend_to_mem=yes,suspend_to_disk=no \
""", "many-devices") # Lots of devices
c.add_compare("""--hvm --pxe --noautoconsole --nographics \
--connect %(KVMURI)s --os-variant fedora20 \
--disk %(NEWIMG1)s,size=1 \
--disk /iscsi-pool/diskvol1 \
--disk /dev/default-pool/iso-vol \
--disk /dev/default-pool/iso-vol,format=qcow2 \
""", "disk-kvm-defaults")
c.add_valid("--hvm --disk path=%(EXISTIMG1)s,device=cdrom") # Specifying cdrom media via --disk
c.add_valid("--hvm --import --disk path=%(EXISTIMG1)s") # FV Import install
c.add_valid("--hvm --import --disk path=%(EXISTIMG1)s --prompt --force") # Working scenario w/ prompt shouldn't ask anything
c.add_valid("--paravirt --import --disk path=%(EXISTIMG1)s") # PV Import install
c.add_valid("--paravirt --disk path=%(EXISTIMG1)s --print-xml") # print single XML, implied import install
c.add_valid("--hvm --import --disk path=%(EXISTIMG1)s,device=floppy") # Import a floppy disk
c.add_valid("--hvm --nodisks --pxe --autostart") # --autostart flag
c.add_valid("--hvm --nodisks --pxe --description \"foobar & baz\"") # --description
c.add_valid("--hvm --cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --wait 0") # HVM windows install with disk
c.add_valid("--hvm --cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --wait 0 --print-step 3") # HVM windows install, print 3rd stage XML
c.add_valid("--hvm --nodisks --pxe --watchdog default") # --watchdog dev default
c.add_valid("--hvm --nodisks --pxe --watchdog ib700,action=pause") # --watchdog opts
c.add_valid("--hvm --nodisks --pxe --sound") # --sound with no option back compat
c.add_valid("--hvm --nodisks --pxe --soundhw default --sound ac97") # --soundhw option
c.add_valid("--hvm --nodisks --pxe --security type=dynamic") # --security dynamic
c.add_valid("--hvm --nodisks --pxe --security label=foobar.label,relabel=yes") # --security implicit static
c.add_valid("--hvm --nodisks --pxe --security label=foobar.label,a1,z2,b3,type=static,relabel=no") # --security static with commas 1
c.add_valid("--hvm --nodisks --pxe --security label=foobar.label,a1,z2,b3") # --security static with commas 2
c.add_valid("--hvm --pxe --filesystem /foo/source,/bar/target") # --filesystem simple
c.add_valid("--hvm --pxe --filesystem template_name,/,type=template") # --filesystem template
c.add_valid("--hvm --nodisks --nonetworks --cdrom %(EXISTIMG1)s") # no networks
c.add_valid("--hvm --nodisks --pxe --memballoon virtio") # --memballoon use virtio
c.add_valid("--hvm --nodisks --pxe --memballoon none") # --memballoon disabled
c.add_invalid("--hvm --nodisks --pxe foobar") # Positional arguments error
c.add_invalid("--nodisks --pxe --name test") # Colliding name
c.add_invalid("--hvm --nodisks --pxe --watchdog default,action=foobar") # Busted --watchdog
c.add_invalid("--hvm --nodisks --pxe --soundhw default --soundhw foobar") # Busted --soundhw
c.add_invalid("--hvm --nodisks --pxe --security type=foobar") # Busted --security
c.add_invalid("--paravirt --import --disk path=%(EXISTIMG1)s --print-step 2") # PV Import install, no second XML step
c.add_invalid("--hvm --nodisks --pxe --print-xml") # 2 stage install with --print-xml
c.add_invalid("--hvm --nodisks --pxe --memballoon foobar") # Busted --memballoon
--disk source_pool=rbd-ceph,source_volume=some-rbd-vol \
--disk source_protocol=http,source_host_name=example.com,source_host_port=8000,source_name=/path/to/my/file \
--disk source_protocol=nbd,source_host_transport=unix,source_host_socket=/tmp/socket,bus=scsi \
--disk gluster://192.168.1.100/test-volume/test-gluster.qcow2 \
--disk qemu+nbd:///var/foo/bar/socket,bus=usb,removable=on \
--disk path=http://[1:2:3:4:1:2:3:4]:5522/my/path?query=foo \
--disk vol=gluster-pool/test-gluster.raw,startup_policy=optional \
--disk %(DIR)s,device=floppy \
\
--network user,mac=12:34:56:78:11:22,portgroup=foo \
--network bridge=foobar,model=virtio,driver_name=qemu,driver_queues=3 \
--network type=direct,source=eth5,source_mode=vepa,target=mytap12,virtualport_type=802.1Qbg,virtualport_managerid=12,virtualport_typeid=1193046,virtualport_typeidversion=1,virtualport_instanceid=09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b,boot_order=1 \
\
--graphics sdl \
--graphics spice,keymap=none \
--graphics vnc,port=5950,listen=1.2.3.4,keymap=ja,password=foo \
--graphics spice,port=5950,tlsport=5950,listen=1.2.3.4,keymap=ja \
\
--controller usb,model=ich9-ehci1,address=0:0:4.7,index=0 \
--controller usb,model=ich9-uhci1,address=0:0:4.0,index=0,master=0 \
--controller usb,model=ich9-uhci2,address=0:0:4.1,index=0,master=2 \
--controller usb,model=ich9-uhci3,address=0:0:4.2,index=0,master=4 \
\
--serial tcp,host=:2222,mode=bind,protocol=telnet \
--parallel udp,host=0.0.0.0:1234,bind_host=127.0.0.1:1234 \
--parallel unix,path=/tmp/foo-socket \
--channel pty,target_type=guestfwd,target_address=127.0.0.1:10000 \
--channel pty,target_type=virtio,name=org.linux-kvm.port1 \
--console pty,target_type=virtio \
--channel spicevmc \
\
--hostdev net_00_1c_25_10_b1_e4,boot_order=4,rom_bar=off \
--host-device usb_device_781_5151_2004453082054CA1BEEE \
--host-device 001.003 \
--hostdev 15:0.1 \
--host-device 2:15:0.2 \
--hostdev 0:15:0.3 \
--host-device 0x0781:0x5151,driver_name=vfio \
--host-device 04b3:4485 \
\
--filesystem /source,/target,mode=squash \
--filesystem template_name,/,type=template \
\
--soundhw default \
--sound ac97 \
\
--video cirrus \
--video model=qxl \
\
--smartcard passthrough,type=spicevmc \
--smartcard type=host \
\
--redirdev usb,type=spicevmc \
--redirdev usb,type=tcp,server=localhost:4000 \
--redirdev usb,type=tcp,server=127.0.0.1:4002,boot_order=3 \
\
--rng egd,backend_host=127.0.0.1,backend_service=8000,backend_type=tcp \
\
--panic iobase=507 \
""", "many-devices")
c = vinst.add_category("char", "--hvm --nographics --noautoconsole --nodisks --pxe")
c.add_valid("--serial pty --parallel null") # Simple devs
c.add_valid("--serial file,path=/tmp/foo --parallel unix,path=/tmp/foo --parallel null") # Some with options
c.add_valid("--parallel udp,host=0.0.0.0:1234,bind_host=127.0.0.1:1234") # UDP
c.add_valid("--serial tcp,mode=bind,host=0.0.0.0:1234") # TCP
c.add_valid("--parallel unix,path=/tmp/foo-socket") # Unix
c.add_valid("--serial tcp,host=:1234,protocol=telnet") # TCP w/ telnet
c.add_valid("--channel pty,target_type=guestfwd,target_address=127.0.0.1:10000") # --channel guestfwd
c.add_valid("--channel pty,target_type=virtio,name=org.linux-kvm.port1") # --channel virtio
c.add_valid("--channel pty,target_type=virtio") # --channel virtio without name=
c.add_valid("--console pty,target_type=virtio") # --console virtio
c.add_valid("--console pty,target_type=xen") # --console xen
c.add_invalid("--serial unix") # Unix with no path
c.add_invalid("--serial null,path=/tmp/foo") # Path where it doesn't belong
c.add_invalid("--channel pty,target_type=guestfwd") # --channel guestfwd without target_address
####################################################
# CPU/RAM/numa and other singleton VM config tests #
####################################################
c = vinst.add_category("cpuram", "--hvm --nographics --noautoconsole --nodisks --pxe")
c.add_valid("--vcpus 4 --cpuset=1,3-5,") # Cpuset with trailing comma
c.add_valid("--vcpus 4 --cpuset=auto") # cpuset=auto but caps doesn't support it
c.add_valid("--ram 4000000") # Ram overcommit
c.add_valid("--vcpus sockets=2,threads=2") # Topology only
c.add_valid("--cpu somemodel") # Simple --cpu
c.add_valid("--security label=foobar.label,relabel=yes") # --security implicit static
c.add_valid("--security label=foobar.label,a1,z2,b3,type=static,relabel=no") # static with commas 1
c.add_valid("--security label=foobar.label,a1,z2,b3") # --security static with commas 2
c.add_compare("--connect %(DEFAULTURI)s --cpuset auto --vcpus 2", "cpuset-auto") # --cpuset=auto actually works
c.add_invalid("--vcpus 32 --cpuset=969-1000") # Bogus cpuset
c.add_invalid("--vcpus 32 --cpuset=autofoo") # Bogus cpuset
c.add_invalid("--clock foo_tickpolicy=merge") # Unknown timer
c.add_invalid("--security foobar") # Busted --security
c = vinst.add_category("controller", "--noautoconsole --nodisks --pxe")
c.add_valid("--controller usb,model=ich9-ehci1,address=0:0:4.7")
c.add_valid("--controller usb,model=ich9-ehci1,address=0:0:4.7,index=0")
c.add_valid("--controller usb,model=ich9-ehci1,address=0:0:4.7,index=1")
c.add_valid("--controller usb2 --controller usb3")
c = vinst.add_category("lxc", "--connect %(LXCURI)s --noautoconsole --name foolxc --memory 64")
c.add_compare("", "default")
c.add_compare("--filesystem /source,/", "fs-default")
c.add_compare("--init /usr/bin/httpd", "manual-init")
c = vinst.add_category("graphics", "--noautoconsole --nodisks --pxe")
c.add_valid("--sdl") # SDL
c.add_valid("--graphics sdl") # --graphics SDL
c.add_valid("--graphics none") # --graphics none,
c.add_valid("--vnc --keymap ja --vncport 5950 --vnclisten 1.2.3.4") # VNC w/ lots of options
c.add_valid("--graphics vnc,port=5950,listen=1.2.3.4,keymap=ja,password=foo") # VNC w/ lots of options, new way
c.add_valid("--graphics spice,port=5950,tlsport=5950,listen=1.2.3.4,keymap=ja") # SPICE w/ lots of options
c.add_valid("--vnc --video vga") # --video option
c.add_valid("--graphics spice --video qxl") # --video option
c.add_valid("--vnc --keymap local") # --keymap local,
c.add_valid("--vnc --keymap none") # --keymap none
c.add_invalid("--vnc --keymap ZZZ") # Invalid keymap
c.add_invalid("--vnc --vncport -50") # Invalid port
c.add_invalid("--graphics spice,tlsport=5") # Invalid port
c.add_invalid("--graphics vnc --vnclisten 1.2.3.4") # mixing old and new
c = vinst.add_category("remote", "--connect %(REMOTEURI)s --nographics --noautoconsole")
c.add_valid("--nodisks --pxe") # Simple pxe nodisks
c.add_valid("--pxe --disk vol=%(POOL)s/%(VOL)s") # Using existing managed storage 2
c.add_valid("--pxe --disk pool=%(POOL)s,size=.04") # Creating storage on managed pool
c.add_valid("--pxe --disk size=.04") # Creating storage on implied pool=default
c.add_valid("--pxe --disk /foo/bar/baz,size=.01") # Creating any random path on the remote host
c.add_valid("--pxe --disk /dev/zde") # /dev file that we just pass through to the remote VM
c.add_invalid("--pxe --disk /foo/bar/baz") # File that doesn't exist after auto storage setup
c.add_invalid("--nodisks --location /tmp") # Use of --location
c.add_invalid("--file /foo/bar/baz --pxe") # Trying to use unmanaged storage without size argument
c = vinst.add_category("network", "--pxe --nographics --noautoconsole --nodisks")
c.add_valid("--mac 22:22:33:44:55:AF") # Just a macaddr
c.add_valid("--bridge mybr0 --mac 22:22:33:44:55:AF") # Old bridge w/ mac
c.add_valid("--network bridge:mybr0,model=e1000") # --network bridge:
c.add_valid("--network network:default --mac RANDOM") # VirtualNetwork with a random macaddr
c.add_valid("--network network=default,mac=22:00:11:00:11:00") # Using '=' as the net type delimiter
c.add_valid("--network=network:default,model=e1000 --network=user,model=virtio,mac=22:22:33:44:55:AF") # several networks
c.add_invalid("--network=FOO") # Nonexistent network
c.add_invalid("--network=network:default --mac 1234") # Invalid mac
c.add_invalid("--network user --bridge foo0") # Mixing bridge and network
c.add_invalid("--mac 22:22:33:12:34:AB") # Colliding macaddr
########################
# Storage provisioning #
########################
c = vinst.add_category("storage", "--pxe --nographics --noautoconsole --hvm")
c.add_valid("--file %(EXISTIMG1)s --nonsparse --file-size 4") # Existing file, other opts
c.add_valid("--file %(EXISTIMG1)s") # Existing file, no opts
c.add_valid("--file %(EXISTIMG1)s --file virt-clone --file virt-clone") # Multiple existing files
c.add_valid("--file %(NEWIMG1)s --file-size .00001 --nonsparse") # Nonexistent file
c.add_valid("--disk path=%(EXISTIMG1)s,perms=ro,size=.0001,cache=writethrough,io=threads") # Existing disk, lots of opts
c.add_valid("--disk path=%(EXISTIMG1)s,perms=rw") # Existing disk, rw perms
c.add_valid("--disk path=%(EXISTIMG1)s,device=floppy") # Existing floppy
c.add_valid("--disk path=%(EXISTIMG1)s") # Existing disk, no extra options
c.add_valid("--disk pool=%(POOL)s,size=.0001 --disk pool=%(POOL)s,size=.0001") # Create 2 volumes in a pool
c.add_valid("--disk vol=%(POOL)s/%(VOL)s") # Existing volume
c.add_valid("--disk path=%(EXISTIMG1)s --disk path=%(EXISTIMG1)s --disk path=%(EXISTIMG1)s --disk path=%(EXISTIMG1)s,device=cdrom") # 3 IDE and CD
c.add_valid(" --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi") # > 16 scsi disks
c.add_valid("--disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi") # > 16 scsi disks
c.add_valid("--disk path=%(NEWIMG1)s,format=raw,size=.0000001") # Unmanaged file using format 'raw'
c.add_valid("--disk path=%(MANAGEDNEW1)s,format=raw,size=.0000001") # Managed file using format raw
c.add_valid("--disk path=%(MANAGEDNEW1)s,format=qcow2,size=.0000001") # Managed file using format qcow2
@ -715,13 +632,9 @@ c.add_valid("--disk %(NEWIMG1)s,format=raw,size=.0000001") # Not specifying pat
c.add_valid("--disk %(COLLIDE)s --force") # Colliding storage with --force
c.add_valid("--disk %(SHARE)s,perms=sh") # Colliding shareable storage
c.add_valid("--disk path=%(EXISTIMG1)s,device=cdrom --disk path=%(EXISTIMG1)s,device=cdrom") # Two IDE cds
c.add_valid("--disk %(DIR)s,device=floppy") # Dir with a floppy dev
c.add_valid("--disk %(EXISTIMG1)s,driver_name=qemu,driver_type=qcow2") # Driver name and type options
c.add_valid("--disk /dev/zero") # Referencing a local unmanaged /dev node
c.add_valid("--disk pool=default,size=.00001") # Building 'default' pool
c.add_valid("--disk path=%(EXISTIMG1)s,bus=usb") # Existing USB disk
c.add_valid("--disk path=%(EXISTIMG1)s,bus=usb,removable=on") # Existing USB disk as removable
c.add_valid("--disk path=%(EXISTIMG1)s,bus=usb,removable=off") # Existing USB disk as non-removable
c.add_valid("--disk %(AUTOMANAGEIMG)s,size=.1") # autocreate the pool
c.add_invalid("--disk %(NEWIMG1)s,sparse=true,size=100000000000 --force") # Don't warn about fully allocated file exceeding disk space
c.add_invalid("--file %(NEWIMG1)s --file-size 100000 --nonsparse") # Nonexisting file, size too big
@ -741,56 +654,176 @@ c.add_invalid("--disk %(COLLIDE)s --prompt") # Colliding storage with --prompt
c.add_invalid("--disk /dev/default-pool/backingl3.img") # Colliding storage via backing store
c.add_invalid("--disk %(DIR)s,device=cdrom") # Dir without floppy
c.add_invalid("--disk %(EXISTIMG1)s,driver_name=foobar,driver_type=foobaz") # Unknown driver name and type options (as of 1.0.0)
c.add_valid("--disk path=%(EXISTIMG1)s,startup_policy=optional") # Existing disk, startupPolicy
c.add_invalid("--disk path=%(EXISTIMG1)s,startup_policy=Foo") # Existing disk, invalid startupPolicy
c.add_invalid("--disk source_pool=rbd-ceph,source_volume=vol1") # Collision with existing VM, via source pool/volume
c = vinst.add_category("redirdev", "--noautoconsole --nographics --nodisks --pxe")
c.add_valid("--redirdev usb,type=spicevmc")
c.add_valid("--redirdev usb,type=tcp,server=localhost:4000")
c.add_valid("--redirdev usb,type=tcp,server=127.0.0.1:4002") # Different host server
################################################
# Invalid devices that hit virtinst code paths #
################################################
c = vinst.add_category("hostdev", "--noautoconsole --nographics --nodisks --pxe")
c.add_valid("--host-device usb_device_781_5151_2004453082054CA1BEEE") # Host dev by libvirt name
c.add_valid("--host-device 001.003 --hostdev 15:0.1 --host-device 2:15:0.2 --hostdev 0:15:0.3 --host-device 0x0781:0x5151,driver_name=vfio --host-device 04b3:4485") # Many hostdev parsing types
c = vinst.add_category("invalid-devices", "--noautoconsole --nodisks --pxe")
c.add_invalid("--host-device 1d6b:2") # multiple USB devices with identical vendorId and productId
c.add_invalid("--host-device pci_8086_2850_scsi_host_scsi_host") # Unsupported hostdev type
c.add_invalid("--host-device foobarhostdev") # Unknown hostdev
c.add_invalid("--host-device 300:400") # Parseable hostdev, but unknown digits
c.add_invalid("--graphics vnc,keymap=ZZZ") # Invalid keymap
c.add_invalid("--graphics vnc,port=-50") # Invalid port
c.add_invalid("--graphics spice,tlsport=5") # Invalid port
c.add_invalid("--serial unix") # Unix with no path
c.add_invalid("--serial null,path=/tmp/foo") # Path where it doesn't belong
c.add_invalid("--channel pty,target_type=guestfwd") # --channel guestfwd without target_address
c = vinst.add_category("install", "--nographics --noautoconsole --nodisks")
########################
# Install option tests #
########################
c = vinst.add_category("nodisk-install", "--nographics --noautoconsole --nodisks")
c.add_valid("--hvm --cdrom %(EXISTIMG1)s") # Simple cdrom install
c.add_valid("--hvm --wait 0 --os-variant winxp --cdrom %(EXISTIMG1)s") # Windows (2 stage) install
c.add_valid("--hvm --pxe --virt-type test") # Explicit virt-type
c.add_valid("--wait 0 --os-variant winxp --cdrom %(EXISTIMG1)s") # Windows (2 stage) install
c.add_valid("--pxe --virt-type test") # Explicit virt-type
c.add_valid("--arch i686 --pxe") # Explicity fullvirt + arch
c.add_valid("--arch i486 --pxe") # Convert i*86 -> i686
c.add_valid("--hvm --location %(TREEDIR)s") # Directory tree URL install
c.add_valid("--hvm --location %(TREEDIR)s --initrd-inject virt-install --extra-args ks=file:/virt-install") # initrd-inject
c.add_valid("--location %(TREEDIR)s") # Directory tree URL install
c.add_valid("--location %(TREEDIR)s --initrd-inject virt-install --extra-args ks=file:/virt-install") # initrd-inject
c.add_valid("--hvm --location %(TREEDIR)s --extra-args console=ttyS0") # Directory tree URL install with extra-args
c.add_valid("--hvm --cdrom %(TREEDIR)s") # Directory tree CDROM install
c.add_valid("--paravirt --location %(TREEDIR)s") # Paravirt location
c.add_valid("--paravirt --location %(TREEDIR)s --os-variant none") # Paravirt location with --os-variant none
c.add_valid("--hvm --location %(TREEDIR)s --os-variant fedora12") # URL install with manual os-variant
c.add_valid("--hvm --pxe --boot menu=on") # Boot menu
c.add_valid("--hvm --boot kernel=/tmp/foo1.img,initrd=/tmp/foo2.img,dtb=/tmp/foo2.dtb,extra_args='ro quiet console=/dev/ttyS0,456'") # Kernel params
c.add_valid("--hvm --pxe --boot cdrom,fd,hd,network,menu=off") # Boot order
c.add_valid("--hvm --boot network,hd,menu=on") # Boot w/o other install option
c.add_invalid("--hvm --pxe --virt-type bogus") # Bogus virt-type
c.add_invalid("--hvm --pxe --arch bogus") # Bogus arch
c.add_valid("--location %(TREEDIR)s --os-variant fedora12") # URL install with manual os-variant
c.add_valid("--cdrom %(EXISTIMG2)s --os-variant win2k3 --wait 0") # HVM windows install with disk
c.add_valid("--cdrom %(EXISTIMG2)s --os-variant win2k3 --wait 0 --print-step 3") # HVM windows install, print 3rd stage XML
c.add_valid("--pxe --autostart") # --autostart flag
c.add_compare("--pxe --print-step all", "simple-pxe") # Diskless PXE install
c.add_invalid("--pxe --virt-type bogus") # Bogus virt-type
c.add_invalid("--pxe --arch bogus") # Bogus arch
c.add_invalid("--paravirt --pxe") # PXE w/ paravirt
c.add_invalid("--import") # Import with no disks
c.add_invalid("--livecd") # LiveCD with no media
c.add_invalid("--hvm --pxe --os-variant farrrrrrrge") # Bogus --os-variant
c.add_invalid("--hvm --pxe --boot menu=foobar")
c.add_invalid("--hvm --cdrom %(EXISTIMG1)s --extra-args console=ttyS0") # cdrom fail w/ extra-args
c.add_invalid("--pxe --print-xml") # 2 stage install with --print-xml
c.add_invalid("--pxe --os-variant farrrrrrrge") # Bogus --os-variant
c.add_invalid("--pxe --boot menu=foobar")
c.add_invalid("--cdrom %(EXISTIMG1)s --extra-args console=ttyS0") # cdrom fail w/ extra-args
c.add_invalid("--hvm --boot kernel=%(TREEDIR)s/pxeboot/vmlinuz,initrd=%(TREEDIR)s/pxeboot/initrd.img,kernel_args='foo bar' --initrd-inject virt-install") # initrd-inject with manual kernel/initrd
c = vinst.add_category("single-disk-install", "--nographics --noautoconsole --disk %(EXISTIMG1)s")
c.add_valid("--hvm --import") # FV Import install
c.add_valid("--hvm --import --prompt --force") # Working scenario w/ prompt shouldn't ask anything
c.add_valid("--paravirt --import") # PV Import install
c.add_valid("--paravirt --print-xml") # print single XML, implied import install
c.add_compare("--cdrom %(EXISTIMG2)s --os-variant win2k3 --wait 0 --vcpus cores=4 --controller usb,model=none", "w2k3-cdrom") # HVM windows install with disk
c.add_invalid("--paravirt --import --print-step 2") # PV Import install, no second XML step
c = vinst.add_category("misc-install", "--nographics --noautoconsole")
c.add_valid("--disk path=%(EXISTIMG1)s,device=cdrom") # Implied cdrom install
c.add_compare("", "noargs-fail", auto_printarg=False) # No arguments
c.add_valid("--panic help --disk=?") # Make sure introspection doesn't blow up
c.add_invalid("--hvm --nodisks --pxe foobar") # Positional arguments error
c.add_invalid("--nodisks --pxe --name test") # Colliding name
#############################
# Remote URI specific tests #
#############################
c = vinst.add_category("remote", "--connect %(REMOTEURI)s --nographics --noautoconsole")
c.add_valid("--nodisks --pxe") # Simple pxe nodisks
c.add_valid("--pxe --disk /foo/bar/baz,size=.01") # Creating any random path on the remote host
c.add_valid("--pxe --disk /dev/zde") # /dev file that we just pass through to the remote VM
c.add_invalid("--pxe --disk /foo/bar/baz") # File that doesn't exist after auto storage setup
c.add_invalid("--nodisks --location /tmp") # Use of --location
c.add_invalid("--file /foo/bar/baz --pxe") # Trying to use unmanaged storage without size argument
###########################
# QEMU/KVM specific tests #
###########################
c = vinst.add_category("kvm", "--connect %(KVMURI)s --noautoconsole")
c.add_compare("--os-variant fedora20 --file %(EXISTIMG1)s --location %(TREEDIR)s --extra-args console=ttyS0 --cpu host --channel none --console none --sound none --redirdev none", "kvm-f14-url") # Fedora Directory tree URL install with extra-args
c.add_compare("--test-media-detection %(TREEDIR)s", "test-url-detection") # --test-media-detection
c.add_compare("--os-variant fedora20 --disk %(NEWIMG1)s,size=.01,format=vmdk --location %(TREEDIR)s --extra-args console=ttyS0 --quiet", "quiet-url") # Quiet URL install should make no noise
c.add_compare("--cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --wait 0 --sound --controller usb", "kvm-win2k3-cdrom") # HVM windows install with disk
c.add_compare("--os-variant ubuntusaucy --nodisks --boot cdrom --virt-type qemu --cpu Penryn", "qemu-plain") # plain qemu
c.add_compare("--os-variant fedora20 --nodisks --boot network --nographics --arch i686", "qemu-32-on-64") # 32 on 64
c.add_compare("--arch armv7l --machine vexpress-a9 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,dtb=/f19-arm.dtb,extra_args=\"console=ttyAMA0 rw root=/dev/mmcblk0p3\" --disk %(EXISTIMG1)s --nographics", "arm-vexpress-plain", skip_check=support.SUPPORT_CONN_DISK_SD)
c.add_compare("--arch armv7l --machine vexpress-a15 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,dtb=/f19-arm.dtb,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s --nographics --os-variant fedora19", "arm-vexpress-f19", skip_check=support.SUPPORT_CONN_VIRTIO_MMIO)
c.add_compare("--arch armv7l --machine virt --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s --nographics --os-variant fedora20", "arm-virt-f20")
c.add_compare("--arch armv7l --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s --os-variant fedora20", "arm-defaultmach-f20")
c.add_compare("--arch aarch64 --machine virt --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s", "aarch64-machvirt")
c.add_compare("--arch aarch64 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,kernel_args=\"console=ttyAMA0,1234 rw root=/dev/vda3\",extra_args=foo --disk %(EXISTIMG1)s", "aarch64-machdefault")
c.add_compare("--arch aarch64 --cdrom %(EXISTIMG2)s --boot loader=CODE.fd,nvram_template=VARS.fd --disk %(EXISTIMG1)s", "aarch64-cdrom")
c.add_compare("--arch ppc64 --machine pseries --boot network --disk %(EXISTIMG1)s --os-variant fedora20 --network none", "ppc64-pseries-f20")
c.add_compare("--arch ppc64 --boot network --disk %(EXISTIMG1)s --os-variant fedora20 --network none", "ppc64-machdefault-f20")
c.add_compare("--disk none --location /tmp/fake.iso --nonetworks", "location-iso") # Using --location iso mounting
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel6.4", "kvm-rhel6") # RHEL6 defaults
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel7.0", "kvm-rhel7") # RHEL7 defaults
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant centos7.0", "kvm-centos7") # Centos 7 defaults
c.add_invalid("--disk none --boot network --machine foobar") # Unknown machine type
c.add_invalid("--nodisks --boot network --arch mips --virt-type kvm") # Invalid domain type for arch
c.add_invalid("--nodisks --boot network --paravirt --arch mips") # Invalid arch/virt combo
######################
# LXC specific tests #
######################
c = vinst.add_category("lxc", "--connect %(LXCURI)s --noautoconsole --name foolxc --memory 64")
c.add_compare("", "default")
c.add_compare("--filesystem /source,/", "fs-default")
c.add_compare("--init /usr/bin/httpd", "manual-init")
######################
# Xen specific tests #
######################
c = vinst.add_category("xen", "--connect %(XENURI)s --noautoconsole")
c.add_compare("--disk %(EXISTIMG1)s --import", "xen-default") # Xen default
c.add_compare("--disk %(EXISTIMG1)s --location %(TREEDIR)s --paravirt", "xen-pv") # Xen PV
c.add_compare("--disk %(EXISTIMG1)s --cdrom %(EXISTIMG1)s --livecd --hvm", "xen-hvm") # Xen HVM
#####################################
# Device option back compat testing #
#####################################
c = vinst.add_category("device-back-compat", "--nodisks --pxe --noautoconsole")
c.add_valid("--sdl") # SDL
c.add_valid("--vnc --keymap ja --vncport 5950 --vnclisten 1.2.3.4") # VNC w/ lots of options
c.add_valid("--sound") # --sound with no option back compat
c.add_valid("--mac 22:22:33:44:55:AF") # Just a macaddr
c.add_valid("--bridge mybr0 --mac 22:22:33:44:55:AF") # Old bridge w/ mac
c.add_valid("--network bridge:mybr0,model=e1000") # --network bridge:
c.add_valid("--network network:default --mac RANDOM") # VirtualNetwork with a random macaddr
c.add_valid("--nonetworks") # no networks
c.add_valid("--vnc --keymap=local") # --keymap local
c.add_invalid("--graphics vnc --vnclisten 1.2.3.4") # mixing old and new
c.add_invalid("--network=FOO") # Nonexistent network
c.add_invalid("--mac 1234") # Invalid mac
c.add_invalid("--network user --bridge foo0") # Mixing bridge and network
c.add_invalid("--mac 22:22:33:12:34:AB") # Colliding macaddr
c = vinst.add_category("storage-back-compat", "--pxe --noautoconsole")
c.add_valid("--file %(EXISTIMG1)s --nonsparse --file-size 4") # Existing file, other opts
c.add_valid("--file %(EXISTIMG1)s") # Existing file, no opts
c.add_valid("--file %(EXISTIMG1)s --file virt-clone --file virt-clone") # Multiple existing files
c.add_valid("--file %(NEWIMG1)s --file-size .00001 --nonsparse") # Nonexistent file
##################
# virt-xml tests #
##################
vixml = App("virt-xml")
c = vixml.add_category("misc", "")
c.add_valid("--help") # basic --help test
@ -882,16 +915,9 @@ c.add_compare("--remove-device --host-device 0x04b3:0x4485", "remove-hostdev-nam
vconv = App("virt-convert")
c = vconv.add_category("misc", "--connect %(KVMURI)s --dry")
c.add_invalid("%(VMX_IMG1)s --input-format foo") # invalid input format
c.add_invalid("%(EXISTIMG1)s") # invalid input file
c.add_compare("%(VMX_IMG1)s --disk-format qcow2 --print-xml", "vmx-compare")
c.add_compare("%(OVF_IMG1)s --disk-format none --destination /tmp --print-xml", "ovf-compare")
####################
# virt-clone tests #
####################
vclon = App("virt-clone")
c = vclon.add_category("remote", "--connect %(REMOTEURI)s")
@ -908,7 +934,7 @@ c.add_valid("--original-xml %(CLONE_DISK_XML)s --auto-clone") # Auto flag w/ st
c.add_valid("--original-xml %(CLONE_STORAGE_XML)s --auto-clone") # Auto flag w/ managed storage,
c.add_valid("-o test-for-clone --auto-clone --clone-running") # Auto flag, actual VM, skip state check
c.add_valid("-o test-clone-simple -n newvm --preserve-data --file /dev/default-pool/default-vol --clone-running --force") # Preserve data shouldn't complain about existing volume
c.add_invalid("--auto-clone# Auto flag, actual VM, without state skip ") # Just the auto flag
c.add_invalid("--auto-clone") # Just the auto flag
c.add_invalid("-o test-for-clone --auto-clone")
@ -936,6 +962,19 @@ c.add_invalid("--original-xml %(CLONE_NOEXIST_XML)s --file %(EXISTIMG1)s") # XM
######################
# virt-convert tests #
######################
vconv = App("virt-convert")
c = vconv.add_category("misc", "--connect %(KVMURI)s --dry")
c.add_invalid("%(VMX_IMG1)s --input-format foo") # invalid input format
c.add_invalid("%(EXISTIMG1)s") # invalid input file
c.add_compare("%(VMX_IMG1)s --disk-format qcow2 --print-xml", "vmx-compare")
c.add_compare("%(OVF_IMG1)s --disk-format none --destination /tmp --print-xml", "ovf-compare")
##########################
# Automated prompt tests #