connection: Use shared default pool lookup logic

It wasn't abiding a different pool name pointing to our default
path
This commit is contained in:
Cole Robinson 2019-06-11 08:38:20 -04:00
parent 088657a2b8
commit 6e6a0b8a6a
2 changed files with 9 additions and 4 deletions

View File

@ -502,8 +502,11 @@ class vmmConnection(vmmGObject):
return self._get_flags_helper(vm, key, check_func)
def get_default_pool(self):
poolxml = virtinst.StoragePool.build_default_pool(
self.get_backend(), build=False)
if poolxml:
for p in self.list_pools():
if p.get_name() == "default":
if p.get_name() == poolxml.name:
return p
return None

View File

@ -196,7 +196,7 @@ class StoragePool(_StorageObject):
return ret
@staticmethod
def build_default_pool(conn):
def build_default_pool(conn, build=True):
"""
Attempt to lookup the 'default' pool, but if it doesn't exist,
create it
@ -204,6 +204,8 @@ class StoragePool(_StorageObject):
poolxml = _lookup_default_pool(conn)
if poolxml:
return poolxml
if not build:
return None
try:
name = "default"