storage: Kill get_default_dir

The last location is in virt-convert, which has weird local directory
creation semantics. Just have it use storage APIs like we do
everywhere else
This commit is contained in:
Cole Robinson 2019-06-11 08:26:04 -04:00
parent e27202d178
commit 088657a2b8
2 changed files with 2 additions and 27 deletions

View File

@ -287,7 +287,8 @@ class VirtConverter(object):
disk_format = None
if destdir is None:
destdir = StoragePool.get_default_dir(self.conn, build=not dry)
poolxml = StoragePool.build_default_pool(self.conn)
destdir = poolxml.target_path
guest = self.get_guest()
for disk in guest.devices.disk:

View File

@ -221,32 +221,6 @@ class StoragePool(_StorageObject):
_("Couldn't create default storage pool '%s': %s") %
(path, str(e)))
@staticmethod
def get_default_dir(conn, build=False):
"""
Return the default storage dir. If there's a 'default' pool,
report that. If there's no default pool, return the dir we would
use for the default.
"""
path = _preferred_default_pool_path(conn)
if (not conn.is_remote() and
not conn.support.conn_storage()):
if build and not os.path.exists(path):
os.makedirs(path)
return path
try:
for pool in conn.fetch_all_pools():
if pool.name == "default":
return pool.target_path
except Exception:
pass
if build:
return StoragePool.build_default_pool(conn).target_path
return _preferred_default_pool_path(conn)
@staticmethod
def lookup_pool_by_path(conn, path):
"""