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.
This commit is contained in:
Pino Toscano 2017-02-23 11:22:27 +01:00 committed by Cole Robinson
parent 436d4c544c
commit 409ae0bcf4
3 changed files with 31 additions and 0 deletions

View File

@ -1669,6 +1669,21 @@ if you know what you are doing.&lt;/small&gt;</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="details-inspection-refresh">
<property name="label" translatable="yes">Refresh</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
<signal name="clicked" handler="on_details_inspection_refresh_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>

View File

@ -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 #

View File

@ -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 #
##########################################