[virt-tools-list] [virt-manager PATCH v2 9/9] inspection: add a way to refresh the inspection info

Richard W.M. Jones rjones at redhat.com
Thu Feb 23 11:04:21 UTC 2017


On Thu, Feb 23, 2017 at 11:22:27AM +0100, Pino Toscano wrote:
> 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 c85e0e4..6330106 100644
> --- a/ui/details.ui
> +++ b/ui/details.ui
> @@ -1669,6 +1669,21 @@ if you know what you are doing.</small></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>
> diff --git a/virtManager/details.py b/virtManager/details.py
> index ca097cc..3b0b480 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 a9998a6..a5e4ce0 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 #
>      ##########################################

Seems reasonable, ACK from me.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the virt-tools-list mailing list