From 409ae0bcf4e81508280d6f3344349a53f66b37ae Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Thu, 23 Feb 2017 11:22:27 +0100 Subject: [PATCH] inspection: add a way to refresh the inspection info Introduce a 'Refresh' button in the 'Information' page of a VM, and wire it up so a refresh of the inspection data for it is triggered. --- ui/details.ui | 15 +++++++++++++++ virtManager/details.py | 7 +++++++ virtManager/engine.py | 9 +++++++++ 3 files changed, 31 insertions(+) diff --git a/ui/details.ui b/ui/details.ui index c85e0e4bf..633010669 100644 --- a/ui/details.ui +++ b/ui/details.ui @@ -1669,6 +1669,21 @@ if you know what you are doing.</small> 1 + + + Refresh + True + True + True + end + + + + False + False + 2 + + 1 diff --git a/virtManager/details.py b/virtManager/details.py index ca097cc42..3b0b480e2 100644 --- a/virtManager/details.py +++ b/virtManager/details.py @@ -345,6 +345,7 @@ class vmmDetails(vmmGObjectUI): "details-closed": (GObject.SignalFlags.RUN_FIRST, None, []), "details-opened": (GObject.SignalFlags.RUN_FIRST, None, []), "customize-finished": (GObject.SignalFlags.RUN_FIRST, None, []), + "inspection-refresh": (GObject.SignalFlags.RUN_FIRST, None, [str, str]), } def __init__(self, vm, parent=None): @@ -484,6 +485,8 @@ class vmmDetails(vmmGObjectUI): "on_idmap_gid_count_changed": lambda *x: self.enable_apply(x, EDIT_IDMAP), "on_idmap_check_toggled": self.config_idmap_enable, + "on_details_inspection_refresh_clicked": self.inspection_refresh, + "on_cpu_vcpus_changed": self.config_vcpus_changed, "on_cpu_maxvcpus_changed": self.config_maxvcpus_changed, "on_cpu_model_changed": lambda *x: self.config_cpu_model_changed(x), @@ -1566,6 +1569,10 @@ class vmmDetails(vmmGObjectUI): return self.config.get_default_cpu_setting(for_cpu=True) return key + def inspection_refresh(self, src_ignore): + self.emit("inspection-refresh", + self.vm.conn.get_uri(), self.vm.get_connkey()) + ############################## # Details/Hardware listeners # diff --git a/virtManager/engine.py b/virtManager/engine.py index a9998a691..a5e4ce03f 100644 --- a/virtManager/engine.py +++ b/virtManager/engine.py @@ -810,6 +810,7 @@ class vmmEngine(vmmGObject): obj.connect("action-clone-domain", self._do_show_clone) obj.connect("details-opened", self.increment_window_counter) obj.connect("details-closed", self.decrement_window_counter) + obj.connect("inspection-refresh", self._do_refresh_inspection) self.conns[uri]["windowDetails"][connkey] = obj return self.conns[uri]["windowDetails"][connkey] @@ -931,6 +932,14 @@ class vmmEngine(vmmGObject): except Exception, e: src.err.show_err(_("Error setting clone parameters: %s") % str(e)) + def _do_refresh_inspection(self, src_ignore, uri, connkey): + if not self.inspection: + return + + conn = self._lookup_conn(uri) + vm = conn.get_vm(connkey) + self.inspection.vm_refresh(vm) + ########################################## # Window launchers from virt-manager cli # ##########################################