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:
parent
e27202d178
commit
088657a2b8
|
@ -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:
|
||||
|
|
|
@ -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):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue