[virt-tools-list] [virt-manager PATCH v2 4/9] inspection: handle duplicated conn-added signals

Richard W.M. Jones rjones at redhat.com
Thu Feb 23 10:54:44 UTC 2017


On Thu, Feb 23, 2017 at 11:22:22AM +0100, Pino Toscano wrote:
> We might get 'conn-added' signals for the same connections more than
> once, so make sure to skip a new connection notification when the
> connection is already known.
> ---
>  virtManager/inspection.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/virtManager/inspection.py b/virtManager/inspection.py
> index f0aa578..41163af 100644
> --- a/virtManager/inspection.py
> +++ b/virtManager/inspection.py
> @@ -100,8 +100,8 @@ class vmmInspection(vmmGObject):
>      def _process_queue_item(self, obj):
>          if obj[0] == "conn_added":
>              conn = obj[1]
> -            if conn and not (conn.is_remote()):
> -                uri = conn.get_uri()
> +            uri = conn.get_uri()
> +            if conn and not (conn.is_remote()) and not (uri in self._conns):
>                  self._conns[uri] = conn
>                  conn.connect("vm-added", self.vm_added)
>                  # No need to push the VMs of the newly added

Simple fix to avoid unnecessary multiple calls to conn.connect, 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
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the virt-tools-list mailing list