From fb671b4d92eb39588c21c7e1f983ff61bbfea8c8 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Thu, 11 Sep 2014 19:12:43 -0400 Subject: [PATCH] connection: Leave in 'connecting' state until all bits are polled --- virtManager/connection.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/virtManager/connection.py b/virtManager/connection.py index 952aa2471..22236072e 100644 --- a/virtManager/connection.py +++ b/virtManager/connection.py @@ -1007,9 +1007,8 @@ class vmmConnection(vmmGObject): is_active = self._do_open() if is_active: self._populate_initial_state() - - self.idle_add(self._change_state, - is_active and self._STATE_ACTIVE or self._STATE_DISCONNECTED) + else: + self.idle_add(self._change_state, self._STATE_DISCONNECTED) if is_active: self.schedule_priority_tick(stats_update=True, @@ -1119,8 +1118,18 @@ class vmmConnection(vmmGObject): main update function: polls for new objects, updates stats, ... @force: Perform the requested polling even if async events are in use """ - if not self.is_active() or self._closing: + finish_connecting = False + + if self._closing: return + if self.is_disconnected(): + return + if self.is_connecting(): + # If in 'connecting' state, and force requested, this means + # we are performing the initial poll. + if not force: + return + finish_connecting = True if not pollvm: stats_update = False @@ -1220,6 +1229,9 @@ class vmmConnection(vmmGObject): for name in newNodedevs: self.emit("nodedev-added", name) + if finish_connecting: + self._change_state(self._STATE_ACTIVE) + self.idle_add(tick_send_signals) ticklist = []