virt-manager: vmmCreateVolume uses the correct connection

Set the connection used by vmmCreateVolume everytime the window is made
visible.  This fixes a case where volumes could be added to the wrong
pool if the same vmmCreateVolume window was already used on a different
connection.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2013-08-13 14:26:26 +02:00 committed by Cole Robinson
parent a8dbebd4ba
commit b3457b9d35
3 changed files with 4 additions and 3 deletions

View File

@ -98,7 +98,8 @@ class vmmCreateVolume(vmmGObjectUI):
def set_modal(self, modal):
self.topwin.set_modal(bool(modal))
def set_parent_pool(self, pool):
def set_parent_pool(self, conn, pool):
self.conn = conn
self.parent_pool = pool
self.vol_class = Storage.StoragePool.get_volume_for_pool(self.parent_pool.get_type())

View File

@ -799,7 +799,7 @@ class vmmHost(vmmGObjectUI):
self.addvol = vmmCreateVolume(self.conn, pool)
self.addvol.connect("vol-created", self.refresh_current_pool)
else:
self.addvol.set_parent_pool(pool)
self.addvol.set_parent_pool(self.conn, pool)
self.addvol.show(self.topwin)
except Exception, e:
self.err.show_err(_("Error launching volume wizard: %s") % str(e))

View File

@ -289,7 +289,7 @@ class vmmStorageBrowser(vmmGObjectUI):
self.addvol = vmmCreateVolume(self.conn, pool)
self.addvol.connect("vol-created", self.refresh_current_pool)
else:
self.addvol.set_parent_pool(pool)
self.addvol.set_parent_pool(self.conn, pool)
self.addvol.set_modal(True)
self.addvol.set_name_hint(self.vm_name)
self.addvol.show(self.topwin)