[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCH 08/11] KvmHypervisor can now fetch domain details.



It can retrieve a list of domains, a specific domain and also verify
that a domain exists.
---
 src/virtlib/hypervisors/kvm.py |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/virtlib/hypervisors/kvm.py b/src/virtlib/hypervisors/kvm.py
index 8f990ee..a69e151 100644
--- a/src/virtlib/hypervisors/kvm.py
+++ b/src/virtlib/hypervisors/kvm.py
@@ -53,3 +53,18 @@ class KvmHypervisor(Hypervisor):
         '''
         return self.__conn
 
+    def do_get_domains(self, defined, created):
+        result = []
+
+        if defined:
+            result.extend(self.__conn.listDefinedDomains())
+
+        if created:
+            for id in self.__conn.listDomainsID():
+                result.append(self.__conn.lookupByID(id).name())
+
+        return result
+
+    def do_get_domain(self, name):
+        return self.__conn.lookupByName(name)
+
-- 
1.7.4.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]