Added cli option to specify on_lockfailure in events. Also, added various testcases and related output XMLs. Signed-off-by: Abhijeet Kasurde <akasurde@xxxxxxxxxx> --- man/virt-install.pod | 2 +- tests/cli-test-xml/compare/virt-install-cpuset-auto.xml | 2 ++ tests/cli-test-xml/compare/virt-install-default.xml | 1 + tests/cli-test-xml/compare/virt-install-fs-default.xml | 1 + tests/cli-test-xml/compare/virt-install-manual-init.xml | 1 + tests/cli-test-xml/compare/virt-install-simple-pxe.xml | 2 ++ tests/cli-test-xml/compare/virt-install-singleton-config-2.xml | 2 ++ tests/cli-test-xml/compare/virt-install-w2k3-cdrom.xml | 3 +++ tests/cli-test-xml/compare/virt-install-xen-default.xml | 1 + tests/cli-test-xml/compare/virt-install-xen-hvm.xml | 1 + tests/cli-test-xml/compare/virt-install-xen-pv.xml | 2 ++ tests/cli-test-xml/compare/virt-xml-edit-simple-events.xml | 6 ++++++ tests/clitest.py | 6 +++--- tests/xmlconfig-xml/install-f11-norheldefaults.xml | 1 + tests/xmlconfig-xml/install-f11-rheldefaults.xml | 1 + tests/xmlconfig-xml/install-hyperv-clock.xml | 1 + tests/xmlconfig-xml/install-hyperv-noclock.xml | 1 + tests/xmlconfig-xml/install-novmvga-rhel.xml | 1 + tests/xmlparse-xml/change-guest-in.xml | 1 + tests/xmlparse-xml/change-guest-out.xml | 1 + tests/xmlparse.py | 1 + virtinst/cli.py | 1 + virtinst/guest.py | 1 + 23 files changed, 36 insertions(+), 4 deletions(-) diff --git a/man/virt-install.pod b/man/virt-install.pod index d7628c8..979c880 100644 --- a/man/virt-install.pod +++ b/man/virt-install.pod @@ -125,7 +125,7 @@ Use --metadata=? to see a list of all available sub options. Complete details at =item B<--events> OPT=VAL,[...] -Specify events values for the guest. Possible options include on_poweroff, on_reboot, and on_crash. +Specify events values for the guest. Possible options include on_poweroff, on_reboot, on_crash and on_lockfailure. Use --events=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsEvents> diff --git a/tests/cli-test-xml/compare/virt-install-cpuset-auto.xml b/tests/cli-test-xml/compare/virt-install-cpuset-auto.xml index f555396..3d155cb 100644 --- a/tests/cli-test-xml/compare/virt-install-cpuset-auto.xml +++ b/tests/cli-test-xml/compare/virt-install-cpuset-auto.xml @@ -37,6 +37,7 @@ <input type="mouse" bus="ps2"/> <console type="pty"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> <domain type="test"> <name>foobar</name> @@ -77,4 +78,5 @@ <input type="mouse" bus="ps2"/> <console type="pty"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> diff --git a/tests/cli-test-xml/compare/virt-install-default.xml b/tests/cli-test-xml/compare/virt-install-default.xml index 0d29881..f2ca1aa 100644 --- a/tests/cli-test-xml/compare/virt-install-default.xml +++ b/tests/cli-test-xml/compare/virt-install-default.xml @@ -19,4 +19,5 @@ </interface> <console type="pty"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> diff --git a/tests/cli-test-xml/compare/virt-install-fs-default.xml b/tests/cli-test-xml/compare/virt-install-fs-default.xml index 1f7b645..f316f9d 100644 --- a/tests/cli-test-xml/compare/virt-install-fs-default.xml +++ b/tests/cli-test-xml/compare/virt-install-fs-default.xml @@ -26,4 +26,5 @@ </interface> <console type="pty"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> diff --git a/tests/cli-test-xml/compare/virt-install-manual-init.xml b/tests/cli-test-xml/compare/virt-install-manual-init.xml index 5ac2bb7..abfb0d1 100644 --- a/tests/cli-test-xml/compare/virt-install-manual-init.xml +++ b/tests/cli-test-xml/compare/virt-install-manual-init.xml @@ -19,4 +19,5 @@ </interface> <console type="pty"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> diff --git a/tests/cli-test-xml/compare/virt-install-simple-pxe.xml b/tests/cli-test-xml/compare/virt-install-simple-pxe.xml index c0a4b52..d5df27c 100644 --- a/tests/cli-test-xml/compare/virt-install-simple-pxe.xml +++ b/tests/cli-test-xml/compare/virt-install-simple-pxe.xml @@ -37,6 +37,7 @@ <input type="mouse" bus="ps2"/> <console type="pty"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> <domain type="test"> <name>foobar</name> @@ -77,4 +78,5 @@ <input type="mouse" bus="ps2"/> <console type="pty"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> diff --git a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml index 158a4db..bdc480e 100644 --- a/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml +++ b/tests/cli-test-xml/compare/virt-install-singleton-config-2.xml @@ -118,6 +118,7 @@ <seclabel type="static" model="selinux" relabel="yes"> <label>system_u:object_r:svirt_image_t:s0:c100,c200</label> </seclabel> + <on_lockfailure>poweroff</on_lockfailure> </domain> <domain type="kvm"> <name>foobar</name> @@ -239,4 +240,5 @@ <seclabel type="static" model="selinux" relabel="yes"> <label>system_u:object_r:svirt_image_t:s0:c100,c200</label> </seclabel> + <on_lockfailure>poweroff</on_lockfailure> </domain> diff --git a/tests/cli-test-xml/compare/virt-install-w2k3-cdrom.xml b/tests/cli-test-xml/compare/virt-install-w2k3-cdrom.xml index 3660aa3..655ecab 100644 --- a/tests/cli-test-xml/compare/virt-install-w2k3-cdrom.xml +++ b/tests/cli-test-xml/compare/virt-install-w2k3-cdrom.xml @@ -46,6 +46,7 @@ <input type="mouse" bus="ps2"/> <console type="pty"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> <domain type="test"> <name>foobar</name> @@ -94,6 +95,7 @@ <input type="mouse" bus="ps2"/> <console type="pty"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> <domain type="test"> <name>foobar</name> @@ -142,4 +144,5 @@ <input type="mouse" bus="ps2"/> <console type="pty"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> diff --git a/tests/cli-test-xml/compare/virt-install-xen-default.xml b/tests/cli-test-xml/compare/virt-install-xen-default.xml index a9054a6..6fc065a 100644 --- a/tests/cli-test-xml/compare/virt-install-xen-default.xml +++ b/tests/cli-test-xml/compare/virt-install-xen-default.xml @@ -22,4 +22,5 @@ <graphics type="vnc" port="-1" keymap="en-us"/> <console type="pty"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> diff --git a/tests/cli-test-xml/compare/virt-install-xen-hvm.xml b/tests/cli-test-xml/compare/virt-install-xen-hvm.xml index 41f03c0..dd7eef5 100644 --- a/tests/cli-test-xml/compare/virt-install-xen-hvm.xml +++ b/tests/cli-test-xml/compare/virt-install-xen-hvm.xml @@ -39,4 +39,5 @@ <graphics type="vnc" port="-1" keymap="en-us"/> <console type="pty"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> diff --git a/tests/cli-test-xml/compare/virt-install-xen-pv.xml b/tests/cli-test-xml/compare/virt-install-xen-pv.xml index e0b0f0a..e0be8d1 100644 --- a/tests/cli-test-xml/compare/virt-install-xen-pv.xml +++ b/tests/cli-test-xml/compare/virt-install-xen-pv.xml @@ -27,6 +27,7 @@ <graphics type="vnc" port="-1" keymap="en-us"/> <console type="pty"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> <domain type="xen"> <name>foobar</name> @@ -52,4 +53,5 @@ <graphics type="vnc" port="-1" keymap="en-us"/> <console type="pty"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> diff --git a/tests/cli-test-xml/compare/virt-xml-edit-simple-events.xml b/tests/cli-test-xml/compare/virt-xml-edit-simple-events.xml index 6e9b82d..dc8e571 100644 --- a/tests/cli-test-xml/compare/virt-xml-edit-simple-events.xml +++ b/tests/cli-test-xml/compare/virt-xml-edit-simple-events.xml @@ -6,6 +6,12 @@ <pm> <suspend-to-mem enabled="no"/> </pm> +@@ + </panic> + </devices> + <seclabel type="dynamic" model="selinux" relabel="yes"/> ++ <on_lockfailure>poweroff</on_lockfailure> + </domain> Domain 'test-for-virtxml' defined successfully. Changes will take effect after the next domain shutdown. \ No newline at end of file diff --git a/tests/clitest.py b/tests/clitest.py index 04c2b54..b8dba75 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -423,7 +423,7 @@ c.add_compare("""--pxe \ --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 \ +--events on_poweroff=destroy,on_reboot=restart,on_crash=preserve,on_lockfailure=poweroff \ \ --controller usb3 \ --controller virtio-scsi \ @@ -694,7 +694,7 @@ c.add_compare("--connect %(URI-KVM-ARMV7L)s --disk %(EXISTIMG1)s --import --os-v # aarch64 tests 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 --cpu none --events on_crash=preserve,on_reboot=destroy,on_poweroff=restart", "aarch64-cdrom") +c.add_compare("--arch aarch64 --cdrom %(EXISTIMG2)s --boot loader=CODE.fd,nvram_template=VARS.fd --disk %(EXISTIMG1)s --cpu none --events on_crash=preserve,on_reboot=destroy,on_poweroff=restart,on_lockfailure=poweroff", "aarch64-cdrom") c.add_compare("--connect %(URI-KVM-AARCH64)s --disk %(EXISTIMG1)s --import --os-variant fedora21", "aarch64-kvm-import") # ppc64 tests @@ -805,7 +805,7 @@ c = vixml.add_category("simple edit diff", "test-for-virtxml --edit --print-diff c.add_compare("""--metadata name=foo-my-new-name,uuid=12345678-12F4-1234-1234-123456789AFA,description="hey this is my new very,very=new desc\\\'",title="This is my,funky=new title" """, "edit-simple-metadata") -c.add_compare("--events on_poweroff=destroy,on_reboot=restart,on_crash=preserve", "edit-simple-events") +c.add_compare("--events on_poweroff=destroy,on_reboot=restart,on_crash=preserve,on_lockfailure=poweroff", "edit-simple-events") c.add_compare("--memory 500,maxmemory=1000,hugepages=off", "edit-simple-memory") c.add_compare("--vcpus 10,maxvcpus=20,cores=5,sockets=4,threads=1", "edit-simple-vcpus") c.add_compare("--cpu model=pentium2,+x2apic,forbid=pbe", "edit-simple-cpu") diff --git a/tests/xmlconfig-xml/install-f11-norheldefaults.xml b/tests/xmlconfig-xml/install-f11-norheldefaults.xml index 52b1e47..ae6e84c 100644 --- a/tests/xmlconfig-xml/install-f11-norheldefaults.xml +++ b/tests/xmlconfig-xml/install-f11-norheldefaults.xml @@ -51,4 +51,5 @@ <console type="pty"/> <sound model="ac97"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> diff --git a/tests/xmlconfig-xml/install-f11-rheldefaults.xml b/tests/xmlconfig-xml/install-f11-rheldefaults.xml index 3fa9edb..34fc59d 100644 --- a/tests/xmlconfig-xml/install-f11-rheldefaults.xml +++ b/tests/xmlconfig-xml/install-f11-rheldefaults.xml @@ -51,4 +51,5 @@ <console type="pty"/> <sound model="ac97"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> diff --git a/tests/xmlconfig-xml/install-hyperv-clock.xml b/tests/xmlconfig-xml/install-hyperv-clock.xml index 9a30ffc..0d4fcfc 100644 --- a/tests/xmlconfig-xml/install-hyperv-clock.xml +++ b/tests/xmlconfig-xml/install-hyperv-clock.xml @@ -63,4 +63,5 @@ <console type="pty"/> <sound model="ich6"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> diff --git a/tests/xmlconfig-xml/install-hyperv-noclock.xml b/tests/xmlconfig-xml/install-hyperv-noclock.xml index 25356d2..166fd8d 100644 --- a/tests/xmlconfig-xml/install-hyperv-noclock.xml +++ b/tests/xmlconfig-xml/install-hyperv-noclock.xml @@ -62,4 +62,5 @@ <console type="pty"/> <sound model="ich6"/> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> diff --git a/tests/xmlconfig-xml/install-novmvga-rhel.xml b/tests/xmlconfig-xml/install-novmvga-rhel.xml index 0251b71..021d57b 100644 --- a/tests/xmlconfig-xml/install-novmvga-rhel.xml +++ b/tests/xmlconfig-xml/install-novmvga-rhel.xml @@ -61,4 +61,5 @@ <model type="vga"/> </video> </devices> + <on_lockfailure>restart</on_lockfailure> </domain> diff --git a/tests/xmlparse-xml/change-guest-in.xml b/tests/xmlparse-xml/change-guest-in.xml index be820cf..15e4d59 100644 --- a/tests/xmlparse-xml/change-guest-in.xml +++ b/tests/xmlparse-xml/change-guest-in.xml @@ -34,6 +34,7 @@ <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> + <on_lockfailure>poweroff</on_lockfailure> <pm> <suspend-to-mem enabled='no'/> </pm> diff --git a/tests/xmlparse-xml/change-guest-out.xml b/tests/xmlparse-xml/change-guest-out.xml index 4bec5af..d1f8290 100644 --- a/tests/xmlparse-xml/change-guest-out.xml +++ b/tests/xmlparse-xml/change-guest-out.xml @@ -44,6 +44,7 @@ <on_poweroff>restart</on_poweroff> <on_reboot>destroy</on_reboot> <on_crash>destroy</on_crash> + <on_lockfailure>restart</on_lockfailure> <pm> <suspend-to-mem enabled="yes"/> <suspend-to-disk enabled="no"/> diff --git a/tests/xmlparse.py b/tests/xmlparse.py index 550ea0a..6f4b229 100644 --- a/tests/xmlparse.py +++ b/tests/xmlparse.py @@ -116,6 +116,7 @@ class XMLParseTest(unittest.TestCase): check("on_poweroff", "destroy", "restart") check("on_reboot", "restart", "destroy") check("on_crash", "restart", "destroy") + check("on_lockfailure", "poweroff", "restart") check = self._make_checker(guest.clock) check("offset", "utc", "localtime") diff --git a/virtinst/cli.py b/virtinst/cli.py index 521a4d4..b8e799c 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -1213,6 +1213,7 @@ class ParserEvents(VirtCLIParser): self.set_param("on_poweroff", "on_poweroff") self.set_param("on_reboot", "on_reboot") self.set_param("on_crash", "on_crash") + self.set_param("on_lockfailure", "on_lockfailure") ###################### diff --git a/virtinst/guest.py b/virtinst/guest.py index e259ad7..8f1be93 100644 --- a/virtinst/guest.py +++ b/virtinst/guest.py @@ -196,6 +196,7 @@ class Guest(XMLBuilder): default_cb=lambda s: "destroy") on_reboot = XMLProperty("./on_reboot", default_cb=lambda s: "restart") on_crash = XMLProperty("./on_crash", default_cb=lambda s: "restart") + on_lockfailure = XMLProperty("./on_lockfailure", default_cb=lambda s: "restart") seclabel = XMLChildProperty(Seclabel) os = XMLChildProperty(OSXML, is_single=True) -- 2.4.3 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list