From 6e6a0b8a6a7705b60d3c0db13bb397361f08796b Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 11 Jun 2019 08:38:20 -0400 Subject: [PATCH] connection: Use shared default pool lookup logic It wasn't abiding a different pool name pointing to our default path --- virtManager/connection.py | 9 ++++++--- virtinst/storage.py | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/virtManager/connection.py b/virtManager/connection.py index 50e992c39..ec6dd2e4f 100644 --- a/virtManager/connection.py +++ b/virtManager/connection.py @@ -502,9 +502,12 @@ class vmmConnection(vmmGObject): return self._get_flags_helper(vm, key, check_func) def get_default_pool(self): - for p in self.list_pools(): - if p.get_name() == "default": - return p + poolxml = virtinst.StoragePool.build_default_pool( + self.get_backend(), build=False) + if poolxml: + for p in self.list_pools(): + if p.get_name() == poolxml.name: + return p return None def get_vol_by_path(self, path): diff --git a/virtinst/storage.py b/virtinst/storage.py index b778369ba..ba00d1533 100644 --- a/virtinst/storage.py +++ b/virtinst/storage.py @@ -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"