On 02/01/2013 04:16 PM, liyang wrote:

Signed-off-by: Li Yang <[email protected]>
---
 virttest/virsh.py |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/virttest/virsh.py b/virttest/virsh.py
index b0650f4..8825976 100644
--- a/virttest/virsh.py
+++ b/virttest/virsh.py
@@ -651,6 +651,35 @@ def screenshot(name, filename, **dargs):
     return filename


+def update_device(domainarg=None, filearg=None,
+                  domain_opt=None, file_opt=None,
+                  flagstr="", **dargs):
+    """
+    Update device from an XML <file>.
+
+    @param: domainarg: Domain name (first pos. parameter)
+    @param: filearg: File name (second. pos. parameter)
+    @param: domain: Option to --domain parameter
+    @param: file_opt: Option to --file parameter
+    @param: flagstr: string of "--force, --persistent, etc."
+    @param dargs: standardized virsh function API keywords
+    @return: CmdResult instance
+    """
+    cmd = "update-device"
+    if domainarg is not None: # Allow testing of ""
+        cmd += " %s" % domainarg
+    if filearg is not None: # Allow testing of 0 and ""
+        cmd += " %s" % filearg
+    if domain_opt is not None: # Allow testing of --domain ""
+        cmd += " --domain %s" % domain_opt
+    if file_opt is not None: # Allow testing of --file ""
+        cmd += " --file %s" % file_opt
+    if len(flagstr) > 0:
+        cmd += " %s" % flagstr
+    print cmd
+    return command(cmd, **dargs)
+
+
 def dumpxml(name, to_file="", **dargs):
     """
     Return the domain information as an XML dump.
--
1.7.1


Okay, I have pushed this patch to next.

--
Best Regards
Yu Mingfei

_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to