This patch adds a virsh_define() function to libvirt_vm.

Signed-off-by: yumingfei <[email protected]>
---
 client/virt/libvirt_vm.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index 4b391c1..e38fcb8 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -305,6 +305,18 @@ def virsh_destroy(name, uri = ""):
         logging.error("Destroy VM %s failed:\n%s", name, detail)
         return False

+def virsh_define(xml_path, uri = ""):
+    """
+    Return True on successful domain define.
+
+    @param xml_path: XML file path
+    """
+    try:
+        virsh_cmd("define --file %s" % xml_path, uri)
+        return True
+    except error.CmdError:
+        logging.error("Define %s failed.", xml_path)
+        return False

 def virsh_undefine(name, uri = ""):
     """
-- 
1.7.1 



_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to