[virt-manager PATCH 3/3] createpool: show only available pool types

Pino Toscano ptoscano at redhat.com
Tue Nov 24 14:21:12 UTC 2020


Query for the available pool types, and show either only those that
libvirt supports, or all the ones we can handle (with libvirt older than
5.2.0).

Signed-off-by: Pino Toscano <ptoscano at redhat.com>
---
 virtManager/createpool.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/virtManager/createpool.py b/virtManager/createpool.py
index 66457b51..9461bf15 100644
--- a/virtManager/createpool.py
+++ b/virtManager/createpool.py
@@ -10,6 +10,7 @@ from gi.repository import Gtk
 
 from virtinst import log
 from virtinst import StoragePool
+from virtinst import StoragePoolCapabilities
 
 from .lib import uiutil
 from .asyncjob import vmmAsyncJob
@@ -77,7 +78,11 @@ class vmmCreatePool(vmmGObjectUI):
         type_list.set_model(model)
         uiutil.init_combo_text_column(type_list, 1)
 
-        for typ in vmmStoragePool.list_types():
+        poolcaps = StoragePoolCapabilities.build_from_params(self.conn)
+        types = [typ for typ in vmmStoragePool.list_types()
+                 if poolcaps.supports_type(typ)]
+
+        for typ in types:
             desc = vmmStoragePool.pretty_type(typ)
             model.append([typ, "%s: %s" % (typ, desc)])
 
-- 
2.28.0




More information about the virt-tools-list mailing list