virt-manager/014-908b8e8d-tests-virt-xml-Add-test-cases-for-start-option.patch
Charles Arnold 2677655bda - jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override
001-adf30349-cli-refactor-get_prop.patch
  002-60c7e778-xmlapi-add-set_prop.patch
  003-5bad22e8-tests-Use-get-set_prop.patch
  004-ee5f3eab-support-Add-SUPPORT_CONN_DEVICE_BOOT_ORDER.patch
  005-7768eb17-cli-Add-check-if-device-boot-order-is-supported.patch
  006-ecc0861c-tests-xmlparse-refactor-method-for-generating-out-file-path.patch
  007-c9d070da-guest-Add-reorder_boot_order-method.patch
  008-1b535940-tests-Add-test-case-for-reorder_boot_order-method.patch
  009-b83a0a61-cli-Use-reorder_boot_order-for-setting-the-boot-order.patch
  010-c896d19d-tests-cli-Add-boot.order-tests.patch
  011-29f9f2ac-virt-xml-Add-no-define-argument.patch
  012-c2bff509-tests-cli-Add-test-case-for-no-define-argument.patch
  013-90b1a3ab-virt-xml-Add-support-for-starting-the-domain.patch
  014-908b8e8d-tests-virt-xml-Add-test-cases-for-start-option.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=468
2019-05-23 15:40:50 +00:00

294 lines
11 KiB
Diff

References: jsc#SLE-6262, fate#327048: KVM: Boot Configuration Override (virt-manager)
Subject: tests: virt-xml: Add test cases for --start option
From: Marc Hartmayer mhartmay@linux.ibm.com Tue Feb 26 10:56:44 2019 +0100
Date: Wed Mar 6 13:15:38 2019 -0500:
Git: 908b8e8d7c3663ca791b068f2f03234e31281bbc
The test cases verify that:
+ --start works
+ --define --start works
+ --no-define --start works
+ --start works in combination with --add and --remove
+ combination of --start --update isn't valid
+ combination of --define --no-define --start isn't valid
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
diff --git a/tests/cli-test-xml/compare/virt-xml-add-disk-basic-start.xml b/tests/cli-test-xml/compare/virt-xml-add-disk-basic-start.xml
new file mode 100644
index 00000000..0071d9e7
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-xml-add-disk-basic-start.xml
@@ -0,0 +1,11 @@
+ <model type="cirrus" vram="16384" heads="1" primary="yes"/>
+ </video>
+ <memballoon model="virtio"/>
++ <disk type="file" device="disk">
++ <source file="/dev/default-pool/testvol1.img"/>
++ <target dev="vdf" bus="virtio"/>
++ </disk>
+ </devices>
+ </domain>
+
+Domain 'test-state-shutoff' started successfully.
\ No newline at end of file
diff --git a/tests/cli-test-xml/compare/virt-xml-add-disk-create-storage-start.xml b/tests/cli-test-xml/compare/virt-xml-add-disk-create-storage-start.xml
new file mode 100644
index 00000000..6a02dcc3
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-xml-add-disk-create-storage-start.xml
@@ -0,0 +1,11 @@
+ <model type="cirrus" vram="16384" heads="1" primary="yes"/>
+ </video>
+ <memballoon model="virtio"/>
++ <disk type="file" device="disk">
++ <source file="/dev/default-pool/new1.img"/>
++ <target dev="hdd" bus="ide"/>
++ </disk>
+ </devices>
+ </domain>
+
+Domain 'test-state-shutoff' started successfully.
\ No newline at end of file
diff --git a/tests/cli-test-xml/compare/virt-xml-add-host-device-start.xml b/tests/cli-test-xml/compare/virt-xml-add-host-device-start.xml
new file mode 100644
index 00000000..b3db5279
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-xml-add-host-device-start.xml
@@ -0,0 +1,14 @@
+ <model type="cirrus" vram="16384" heads="1" primary="yes"/>
+ </video>
+ <memballoon model="virtio"/>
++ <hostdev mode="subsystem" type="usb" managed="yes">
++ <source>
++ <vendor id="0x04b3"/>
++ <product id="0x4485"/>
++ </source>
++ </hostdev>
+ </devices>
+ </domain>
+
+Domain 'test-state-shutoff' defined successfully.
+Domain 'test-state-shutoff' started successfully.
\ No newline at end of file
diff --git a/tests/cli-test-xml/compare/virt-xml-remove-disk-path-start.xml b/tests/cli-test-xml/compare/virt-xml-remove-disk-path-start.xml
new file mode 100644
index 00000000..e04db8fb
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-xml-remove-disk-path-start.xml
@@ -0,0 +1,20 @@
+ <on_lockfailure>poweroff</on_lockfailure>
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
+- <disk type="block" device="disk">
+- <driver name="qemu"/>
+- <source dev="/dev/null"/>
+- <target dev="vda" bus="virtio"/>
+- <boot order="10"/>
+- </disk>
+- <disk type="block" device="disk">
+- <driver name="qemu"/>
+- <source dev="/dev/null"/>
+- <target dev="vdb" bus="virtio"/>
+- <boot order="3"/>
+- </disk>
+ <disk type="block" device="cdrom">
+ <target dev="hdc" bus="ide"/>
+ <readonly/>
+
+Domain 'test-state-shutoff' started successfully.
\ No newline at end of file
diff --git a/tests/cli-test-xml/compare/virt-xml-start-select-disk-bootorder.xml b/tests/cli-test-xml/compare/virt-xml-start-select-disk-bootorder.xml
new file mode 100644
index 00000000..280d9fc5
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-xml-start-select-disk-bootorder.xml
@@ -0,0 +1,33 @@
+ <driver name="qemu"/>
+ <source dev="/dev/null"/>
+ <target dev="vda" bus="virtio"/>
+- <boot order="10"/>
++ <boot order="1"/>
+ </disk>
+ <disk type="block" device="disk">
+ <driver name="qemu"/>
+ <source dev="/dev/null"/>
+ <target dev="vdb" bus="virtio"/>
+- <boot order="3"/>
++ <boot order="4"/>
+ </disk>
+ <disk type="block" device="cdrom">
+ <target dev="hdc" bus="ide"/>
+ <readonly/>
+- <boot order="1"/>
++ <boot order="2"/>
+ <address type="drive" controller="0" bus="1" target="0" unit="0"/>
+ </disk>
+ <controller type="ide" index="0"/>
+@@
+ <source network="default"/>
+ <target dev="testnet0"/>
+ <model type="virtio"/>
+- <boot order="2"/>
++ <boot order="3"/>
+ </interface>
+ <interface type="network">
+ <mac address="52:54:00:11:fa:28"/>
+
+Domain 'test-state-shutoff' defined successfully.
+Domain 'test-state-shutoff' started successfully.
\ No newline at end of file
diff --git a/tests/cli-test-xml/compare/virt-xml-start-select-disk-bootorder2.xml b/tests/cli-test-xml/compare/virt-xml-start-select-disk-bootorder2.xml
new file mode 100644
index 00000000..1144f4c5
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-xml-start-select-disk-bootorder2.xml
@@ -0,0 +1,32 @@
+ <driver name="qemu"/>
+ <source dev="/dev/null"/>
+ <target dev="vda" bus="virtio"/>
+- <boot order="10"/>
++ <boot order="1"/>
+ </disk>
+ <disk type="block" device="disk">
+ <driver name="qemu"/>
+ <source dev="/dev/null"/>
+ <target dev="vdb" bus="virtio"/>
+- <boot order="3"/>
++ <boot order="4"/>
+ </disk>
+ <disk type="block" device="cdrom">
+ <target dev="hdc" bus="ide"/>
+ <readonly/>
+- <boot order="1"/>
++ <boot order="2"/>
+ <address type="drive" controller="0" bus="1" target="0" unit="0"/>
+ </disk>
+ <controller type="ide" index="0"/>
+@@
+ <source network="default"/>
+ <target dev="testnet0"/>
+ <model type="virtio"/>
+- <boot order="2"/>
++ <boot order="3"/>
+ </interface>
+ <interface type="network">
+ <mac address="52:54:00:11:fa:28"/>
+
+Domain 'test-state-shutoff' started successfully.
\ No newline at end of file
diff --git a/tests/clitest.py b/tests/clitest.py
index b4f41b79..1c3cd5a5 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -893,6 +893,7 @@ c = vixml.add_category("misc", "")
c.add_valid("--help") # basic --help test
c.add_valid("--sound=? --tpm=?") # basic introspection test
c.add_valid("test-state-shutoff --edit --update --boot menu=on") # --update with inactive VM, should work but warn
+c.add_invalid("test-state-shutoff --edit --update --boot menu=on --start")
c.add_invalid("test --edit --hostdev driver_name=vfio") # Guest has no hostdev to edit
c.add_invalid("test --edit --cpu host-passthrough --boot hd,network") # Specified more than 1 option
c.add_invalid("test --edit") # specified no edit option
@@ -968,6 +969,12 @@ c.add_compare("--edit /tmp/foobar2 --disk shareable=off,readonly=on", "edit-sele
c.add_compare("--edit mac=00:11:7f:33:44:55 --network target=nic55", "edit-select-network-mac")
c.add_compare("--edit target=hda --disk boot_order=1", "edit-select-disk-bootorder")
+c = vixml.add_category("edit and start selection", "test-state-shutoff --print-diff --start")
+c.add_compare("--define --edit target=vda --disk boot_order=1", "start-select-disk-bootorder")
+c.add_invalid("--define --no-define --edit target=vda --disk boot_order=1")
+c.add_compare("--edit target=vda --disk boot_order=1", "start-select-disk-bootorder2")
+c.add_compare("--no-define --edit target=vda --disk boot_order=1", "start-select-disk-bootorder2")
+
c = vixml.add_category("edit selection 2", "test-collide --print-diff --define")
c.add_compare("--edit target=hda --disk boot_order=1", "edit-select-disk-bootorder2")
@@ -995,6 +1002,16 @@ c.add_compare("--remove-device --disk /dev/null", "remove-disk-path")
c.add_compare("--remove-device --video all", "remove-video-all", check_version="1.3.3") # check_version=video primary= attribute
c.add_compare("--remove-device --host-device 0x04b3:0x4485", "remove-hostdev-name", check_version="1.2.11") # check_version=video ram output change
+c = vixml.add_category("add/rm devices and start", "test-state-shutoff --print-diff --start")
+c.add_invalid("--add-device --pm suspend_to_disk=yes") # --add-device without a device
+c.add_invalid("--remove-device --clock utc") # --remove-device without a dev
+# one test in combination with --define
+c.add_compare("--define --add-device --host-device usb_device_4b3_4485_noserial", "add-host-device-start")
+# all other test cases without
+c.add_compare("--add-device --disk %(EXISTIMG1)s,bus=virtio,target=vdf", "add-disk-basic-start")
+c.add_compare("--add-device --disk %(NEWIMG1)s,size=.01", "add-disk-create-storage-start")
+c.add_compare("--remove-device --disk /dev/null", "remove-disk-path-start")
+
c = vixml.add_category("add/rm devices OS KVM", "--connect %(URI-KVM)s test --print-diff --define")
c.add_compare("--add-device --disk %(EXISTIMG1)s", "kvm-add-disk-os-from-xml") # Guest OS (none) from XML
c.add_compare("--add-device --disk %(EXISTIMG1)s --os-variant fedora28", "kvm-add-disk-os-from-cmdline") # Guest OS (fedora) provided on command line
diff --git a/tests/testsuite.xml b/tests/testsuite.xml
index fa0a077f..2e6f0fd6 100644
--- a/tests/testsuite.xml
+++ b/tests/testsuite.xml
@@ -289,6 +289,64 @@
<memory>1048576</memory>
<bootloader>/tmp/bootfoo</bootloader>
<test:runstate>5</test:runstate>
+ <metadata>
+ <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
+ <libosinfo:os id="http://fedoraproject.org/fedora/17"/>
+ </libosinfo:libosinfo>
+ </metadata>
+ <currentMemory>204800</currentMemory>
+ <memory>409600</memory>
+ <uuid>12345678-1234-1234-1234-123456789012</uuid>
+ <os>
+ <type arch="i686" machine="foobar">hvm</type>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <hyperv>
+ <vapic state="off"/>
+ <spinlocks state="on" retries="12287"/>
+ </hyperv>
+ <vmport state="off"/>
+ </features>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <on_lockfailure>poweroff</on_lockfailure>
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
+ <disk type="block" device="disk">
+ <driver name="qemu"/>
+ <source dev="/dev/null"/>
+ <target dev="vda" bus="virtio"/>
+ <boot order="10"/>
+ </disk>
+ <disk type="block" device="disk">
+ <driver name="qemu"/>
+ <source dev="/dev/null"/>
+ <target dev="vdb" bus="virtio"/>
+ <boot order="3"/>
+ </disk>
+ <disk type="block" device="cdrom">
+ <target dev="hdc" bus="ide"/>
+ <readonly/>
+ <boot order="1"/>
+ </disk>
+ <interface type="network">
+ <source network="default"/>
+ <mac address="22:22:33:44:55:66"/>
+ <model type="virtio"/>
+ <boot order="2"/>
+ </interface>
+ <interface type="network">
+ <source network="default"/>
+ <mac address="52:54:00:11:fa:28"/>
+ <model type="virtio"/>
+ </interface>
+ <graphics type="vnc" display=":3.4" xauth="/tmp/.Xauthority"/>
+ <console type="pty"/>
+ <memballoon model="virtio"/>
+ </devices>
</domain>