[virt-tools-list] [PATCH 2/3] Add inspection data to the domain object.

Richard W.M. Jones rjones at redhat.com
Wed Jun 29 16:20:49 UTC 2011


From: "Richard W.M. Jones" <rjones at redhat.com>

This adds the inspection data to the domain object, and passes the
data up from the inspection thread.

Also an inspection-changed signal has been added so that UI elements
can find out when inspection has finished for a particular VM and
update the UI.
---
 src/virtManager/domain.py     |   53 +++++++++++++++++++++++++++++++++++++++++
 src/virtManager/inspection.py |   13 ++++++++++
 2 files changed, 66 insertions(+), 0 deletions(-)

diff --git a/src/virtManager/domain.py b/src/virtManager/domain.py
index 1e68263..b40a1d8 100644
--- a/src/virtManager/domain.py
+++ b/src/virtManager/domain.py
@@ -162,6 +162,16 @@ class vmmDomain(vmmLibvirtObject):
         self._stats_disk_supported = True
         self._stats_disk_skip = []
 
+        self.inspection_type = None
+        self.inspection_distro = None
+        self.inspection_major_version = None
+        self.inspection_minor_version = None
+        self.inspection_hostname = None
+        self.inspection_product_name = None
+        self.inspection_product_variant = None
+        self.inspection_icon = None
+        self.inspection_applications = None
+
         if isinstance(self._backend, virtinst.Guest):
             return
 
@@ -1376,6 +1386,48 @@ class vmmDomain(vmmLibvirtObject):
         return self.config.get_pervm(self.connection.get_uri(), self.uuid,
                                      self.config.get_details_window_size)
 
+    # Information from libguestfs inspection.
+    def set_inspection_type(self, new):
+        self.inspection_type = str(new)
+    def set_inspection_distro(self, new):
+        self.inspection_distro = str(new)
+    def set_inspection_major_version(self, new):
+        self.inspection_major_version = int(new)
+    def set_inspection_minor_version(self, new):
+        self.inspection_minor_version = int(new)
+    def set_inspection_hostname(self, new):
+        self.inspection_hostname = str(new)
+    def set_inspection_product_name(self, new):
+        self.inspection_product_name = str(new)
+    def set_inspection_product_variant(self, new):
+        self.inspection_product_variant = str(new)
+    def set_inspection_icon(self, new):
+        self.inspection_icon = str(new)
+    def set_inspection_applications(self, new):
+        self.inspection_applications = str(new)
+
+    def inspection_data_updated(self):
+        self.idle_emit("inspection-changed")
+
+    def get_inspection_type(self):
+        return self.inspection_type
+    def get_inspection_distro(self):
+        return self.inspection_distro
+    def get_inspection_major_version(self):
+        return self.inspection_major_version
+    def get_inspection_minor_version(self):
+        return self.inspection_minor_version
+    def get_inspection_hostname(self):
+        return self.inspection_hostname
+    def get_inspection_product_name(self):
+        return self.inspection_product_name
+    def get_inspection_product_variant(self):
+        return self.inspection_product_variant
+    def get_inspection_icon(self):
+        return self.inspection_icon
+    def get_inspection_applications(self):
+        return self.inspection_applications
+
 
     ###################
     # Polling helpers #
@@ -1587,5 +1639,6 @@ class vmmDomainVirtinst(vmmDomain):
 vmmLibvirtObject.type_register(vmmDomain)
 vmmDomain.signal_new(vmmDomain, "status-changed", [int, int])
 vmmDomain.signal_new(vmmDomain, "resources-sampled", [])
+vmmDomain.signal_new(vmmDomain, "inspection-changed", [])
 
 vmmLibvirtObject.type_register(vmmDomainVirtinst)
diff --git a/src/virtManager/inspection.py b/src/virtManager/inspection.py
index 146e021..72406fe 100644
--- a/src/virtManager/inspection.py
+++ b/src/virtManager/inspection.py
@@ -171,6 +171,19 @@ class vmmInspection(Thread):
 
         self._vmseen[vmuuid] = True
 
+        vm.set_inspection_type(typ)
+        vm.set_inspection_distro(distro)
+        vm.set_inspection_major_version(major_version)
+        vm.set_inspection_minor_version(minor_version)
+        vm.set_inspection_hostname(hostname)
+        vm.set_inspection_product_name(product_name)
+
+        vm.set_inspection_product_variant(product_variant)
+        vm.set_inspection_icon(icon)
+        vm.set_inspection_applications(apps)
+
+        vm.inspection_data_updated()
+
         # Log what we found.
         logging.debug("%s: detected operating system: %s %s %d.%d (%s)",
                       self._name, typ, distro, major_version, minor_version,
-- 
1.7.5.2




More information about the virt-tools-list mailing list