[virt-tools-list] [PATCH] Added support to on_lockfailure

Abhijeet Kasurde akasurde at redhat.com
Wed Oct 7 10:50:13 UTC 2015


Added cli option to specify on_lockfailure in events.
Also, added various testcases and related output XMLs.

Signed-off-by: Abhijeet Kasurde <akasurde at redhat.com>
---
 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 +
 5 files changed, 5 insertions(+)

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 fe6fc4f..9d95666 100644
--- a/tests/xmlparse-xml/change-guest-out.xml
+++ b/tests/xmlparse-xml/change-guest-out.xml
@@ -45,6 +45,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 7d117e3..b19f88c 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 4a634e3..8ba9ced 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..6f2b30a 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")
 
     seclabel = XMLChildProperty(Seclabel)
     os = XMLChildProperty(OSXML, is_single=True)
-- 
2.4.3




More information about the virt-tools-list mailing list