[virt-tools-list] [PATCH 5/5] virt-manager: automatically select newly created volume

Giuseppe Scrivano gscrivan at redhat.com
Tue Aug 13 12:26:29 UTC 2013


When a new volume is created for a storage, automatically select it;
most likely it is what the user will choose to use.

Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
 virtManager/storagebrowse.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/virtManager/storagebrowse.py b/virtManager/storagebrowse.py
index f15499e..f640583 100644
--- a/virtManager/storagebrowse.py
+++ b/virtManager/storagebrowse.py
@@ -272,13 +272,21 @@ class vmmStorageBrowser(vmmGObjectUI):
         canchoose = bool(vol and vol[5])
         self.widget("choose-volume").set_sensitive(canchoose)
 
-    def refresh_current_pool(self, ignore):
+    def refresh_current_pool(self, createvol):
         cp = self.current_pool()
         if cp is None:
             return
         cp.refresh()
+
         self.refresh_storage_pool(None, cp.get_uuid())
 
+        vol_list = self.widget("vol-list")
+        def select_volume(model, path, it, volume_name):
+            if model.get(it, 0)[0] == volume_name:
+                util.set_list_selection(vol_list, path)
+
+        vol_list.get_model().foreach(select_volume, createvol.vol.name)
+
     def new_volume(self, src_ignore):
         pool = self.current_pool()
         if pool is None:
-- 
1.8.3.1




More information about the virt-tools-list mailing list