cli: Fix pool=default when path belongs to another pool (bz 1692489)

Using 'virt-install --disk size=X' implicitly uses pool=default. If
a pool named 'default' exists we use that; if not, and a pool using
the default path exists under a different name, we attempt to use
that as well, and if that doesn't exist, we create pool=default

The second case is broken, so if there's no pool=default and eg.
pool=FOO points to /var/lib/libvirt/images, we still attempt to
look up pool=default which understandably fails

https://bugzilla.redhat.com/show_bug.cgi?id=1692489
This commit is contained in:
Cole Robinson 2019-03-26 10:44:58 -04:00
parent 3be238b03e
commit a0ca387aad

View File

@ -2340,7 +2340,9 @@ class ParserDisk(VirtCLIParser):
poolobj = None
if poolname:
if poolname == "default":
StoragePool.build_default_pool(self.guest.conn)
poolxml = StoragePool.build_default_pool(self.guest.conn)
if poolxml:
poolname = poolxml.name
poolobj = self.guest.conn.storagePoolLookupByName(poolname)
if volname: