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

[virt-tools-list] [PATCH 2/5] 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>
---
 virtManager/createvol.py     | 3 ++-
 virtManager/host.py          | 2 +-
 virtManager/storagebrowse.py | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/virtManager/createvol.py b/virtManager/createvol.py
index a403575..d46cbb0 100644
--- a/virtManager/createvol.py
+++ b/virtManager/createvol.py
@@ -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())
 
diff --git a/virtManager/host.py b/virtManager/host.py
index c636949..afa7644 100644
--- a/virtManager/host.py
+++ b/virtManager/host.py
@@ -800,7 +800,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))
diff --git a/virtManager/storagebrowse.py b/virtManager/storagebrowse.py
index 7374637..f15499e 100644
--- a/virtManager/storagebrowse.py
+++ b/virtManager/storagebrowse.py
@@ -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)
-- 
1.8.3.1


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