[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] --show-* options are broken



On 07/10/2013 04:58 PM, Cole Robinson wrote:
> On 07/10/2013 04:50 PM, Leonardo Augusto Guimarães Garcia wrote:
>> Hi Cole,
>>
>> Just FYI, commit 76887c9a3280da32d44d4276135a78d21dd12fe8 broke the --show-*
>> functionality.
>>
>> Traceback (most recent call last):
>>   File "/home/laggarcia/src/git/virt-manager/virtManager/engine.py", line 624,
>> in _show_vm_helper
>>     details = self._get_details_dialog(uri, uuid)
>>   File "/home/laggarcia/src/git/virt-manager/virtManager/engine.py", line 602,
>> in _get_details_dialog
>>     obj = vmmDetails(con.get_vm(uuid))
>>   File "/home/laggarcia/src/git/virt-manager/virtManager/connection.py", line
>> 625, in get_vm
>>     return self.vms[uuid]
>> KeyError: '927c2b5f-ae3a-4f5e-aaeb-4d7fb3846dce'
>>
>> Basically connections vms are not populated yet when trying to open the dialog.
>>
>> I am investigating the issue.
>>
>> Best regards,
>>
> 
> Ah, sorry about that. Likely that we don't synchronously tick() any more when
> connecting to libvirt. We can probably hook to the connection on "vm-added"
> and then perform based on that, I'll poke at it.
> 

Well, the attached patch fixes things. But there are some other issues I'm
just noticing here that stem from not showing the manager window on --show.
Like if something happens that causes us to never show the details window,
like wrong UUID or connection failure, then virt-manager doesn't exit. I don't
have time to look at these right now unfortunately.

- Cole

diff --git a/virt-manager b/virt-manager
index eae986e..e8ef5b3 100755
--- a/virt-manager
+++ b/virt-manager
@@ -162,13 +162,12 @@ def launch_specific_window(engine, show, uri, uuid):
         engine.show_host_summary(uri)
 
 
-def _conn_state_changed(conn, engine, show, uri, uuid):
-    if conn.state == conn.STATE_DISCONNECTED:
-        return True
-    if conn.state != conn.STATE_ACTIVE:
-        return
-
-    launch_specific_window(engine, show, uri, uuid)
+def _conn_ready(conn, engine, show, uri, uuid):
+    if uuid not in conn.vms:
+        engine.err.show_err("%s does not have VM with UUID %s" %
+                            (uri, uuid))
+    else:
+        launch_specific_window(engine, show, uri, uuid)
     return True
 
 
@@ -287,8 +286,8 @@ def main():
 
     if options.show:
         def cb(conn):
-            return _conn_state_changed(conn, engine, options.show,
-                                       options.uri, options.uuid)
+            return _conn_ready(conn, engine, options.show,
+                               options.uri, options.uuid)
         engine.uri_cb = cb
         engine.show_manager_window = False
 
diff --git a/virtManager/engine.py b/virtManager/engine.py
index 4ed62b1..41f4aca 100644
--- a/virtManager/engine.py
+++ b/virtManager/engine.py
@@ -137,7 +137,7 @@ class vmmEngine(vmmGObject):
         if self.uri_at_startup:
             conn = self.add_conn_to_ui(self.uri_at_startup)
             if conn and self.uri_cb:
-                conn.connect_opt_out("state-changed", self.uri_cb)
+                conn.connect_opt_out("resources-sampled", self.uri_cb)
 
             self.connect_to_uri(self.uri_at_startup)
 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]