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

[virt-tools-list] [PATCH 3/5] virt-manager: prevent events while the storage pool model is accessed

It fixes this error:

Traceback (most recent call last):
  File "virt-manager/virtManager/storagebrowse.py", line 271, in pool_selected
    pool = self.current_pool()
  File "virt-manager/virtManager/storagebrowse.py", line 238, in current_pool
    return self.conn.get_pool(row[0])
  File "virt-manager/virtManager/connection.py", line 645, in get_pool
    return self.pools[uuid]
KeyError: 'bd9fd5ec-a35c-d84a-b9b2-2aca98f733c3'

Signed-off-by: Giuseppe Scrivano <gscrivan redhat com>
 virtManager/host.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/virtManager/host.py b/virtManager/host.py
index afa7644..e83865a 100644
--- a/virtManager/host.py
+++ b/virtManager/host.py
@@ -1306,6 +1306,8 @@ def refresh_pool_in_list(pool_list, conn, uuid):
 def populate_storage_pools(pool_list, conn):
     model = pool_list.get_model()
+    # Prevent events while the model is modified
+    pool_list.set_model(None)
     for uuid in conn.list_pool_uuids():
         per = get_pool_size_percent(conn, uuid)
@@ -1318,6 +1320,7 @@ def populate_storage_pools(pool_list, conn):
         model.append([uuid, label, pool.is_active(), per])
     _iter = model.get_iter_first()
+    pool_list.set_model(model)
     if _iter:

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