storage: fix default storage pool lookup

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@suse.com>

(crobinso: Remove now-redundant 'pass')
This commit is contained in:
Charles Arnold 2015-08-12 16:00:14 -06:00 committed by Cole Robinson
parent df92749286
commit eb92178e0c
1 changed files with 4 additions and 2 deletions

View File

@ -209,10 +209,12 @@ class StoragePool(_StorageObject):
try:
pool = conn.storagePoolLookupByName(name)
except libvirt.libvirtError:
pass
# Try default pool path when "default" name fails
pool = StoragePool.lookup_pool_by_path(conn, path)
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'",