[virt-tools-list] [PATCH virt-manager]: storage: fix default storage pool lookup

Charles Arnold carnold at suse.com
Wed Aug 12 22:00:14 UTC 2015


virt-convert fails when the storage pool is already present but
is not called 'default'.

If the 'default' pool has been removed but another pool uses the
default location of /var/lib/libvirt/images virt-convert will fail
to find the pool and attempt to create another one with the same
path. This causes the conversion to fail.

Signed-off-by: Charles Arnold <carnold at suse.com>

diff --git a/virtinst/storage.py b/virtinst/storage.py
index 285acb8..ea5eab8 100644
--- a/virtinst/storage.py
+++ b/virtinst/storage.py
@@ -209,10 +209,13 @@ class StoragePool(_StorageObject):
         try:
             pool = conn.storagePoolLookupByName(name)
         except libvirt.libvirtError:
+            # Try default pool path when "default" name fails
+            pool = StoragePool.lookup_pool_by_path(conn, path)
             pass
 
         if pool:
-            return
+            # This is a libvirt pool object so create a StoragePool from it
+            return StoragePool(conn, parsexml=pool.XMLDesc(0))
 
         try:
             logging.debug("Attempting to build default pool with target '%s'",






More information about the virt-tools-list mailing list