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>
This commit is contained in:
Giuseppe Scrivano 2013-08-13 14:26:27 +02:00 committed by Cole Robinson
parent b3457b9d35
commit f4918b3b32
1 changed files with 3 additions and 0 deletions

View File

@ -1305,6 +1305,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)
model.clear()
for uuid in conn.list_pool_uuids():
per = get_pool_size_percent(conn, uuid)
@ -1317,6 +1319,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:
pool_list.get_selection().select_iter(_iter)
pool_list.get_selection().emit("changed")