This patch adds 3 member functions for libvirt_vm:
    1) get_id()
    2) get_uuid()
    3) get_xml()

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

diff --git a/client/virt/libvirt_vm.py b/client/virt/libvirt_vm.py
index 85021d9..c7a99b5 100644
--- a/client/virt/libvirt_vm.py
+++ b/client/virt/libvirt_vm.py
@@ -106,6 +106,11 @@ def virsh_domstate(name, uri = ""):
     """
     return virsh_cmd("domstate %s" % name, uri)
 
+def virsh_domid(name, uri = ""):
+    """
+    Return VM's ID.
+    """
+    return virsh_cmd("domid %s" % (name), uri)
 
 def virsh_uuid(name, uri = ""):
     """
@@ -445,6 +450,23 @@ class VM(virt_vm.BaseVM):
         """
         return virsh_domstate(self.name, self.connect_uri)
 
+    def get_uuid(self):
+        """
+        Return VM's UUID.
+        """
+        return virsh_uuid(self.name, self.connect_uri)
+
+    def get_id(self):
+        """
+        Return VM's ID.
+        """
+        return virsh_domid(self.name, self.connect_uri)
+
+    def get_xml(self):
+        """
+        Return VM's xml file.
+        """
+        return virsh_dumpxml(self.name, self.connect_uri)
 
     def clone(self, name=None, params=None, root_dir=None, address_cache=None,
               copy_state=False):
-- 
1.7.3.1


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

Reply via email to