virt-manager/535feaca-fix-storage-when-directory-name-contains-whitespace.patch

30 lines
1.1 KiB
Diff
Raw Normal View History

Subject: Fix using storage when the directory name contains whitespace (bz 1091384)
From: Cole Robinson crobinso@redhat.com Tue Apr 29 14:09:14 2014 -0400
Date: Tue Apr 29 14:09:14 2014 -0400:
Git: feadd98fed045ec40d5d5cf8250c7b05517eb9c9
diff --git a/virtinst/diskbackend.py b/virtinst/diskbackend.py
index 370996c..3d5aed8 100644
--- a/virtinst/diskbackend.py
+++ b/virtinst/diskbackend.py
@@ -137,13 +137,14 @@ def manage_path(conn, path):
return vol, pool, path_is_pool
dirname = os.path.dirname(path)
- poolname = StoragePool.find_free_name(
- conn, os.path.basename(dirname) or "pool")
+ poolname = os.path.basename(dirname).replace(" ", "_")
+ if not poolname:
+ poolname = "dirpool"
+ poolname = StoragePool.find_free_name(conn, poolname)
logging.debug("Attempting to build pool=%s target=%s", poolname, dirname)
poolxml = StoragePool(conn)
- poolxml.name = poolxml.find_free_name(
- conn, os.path.basename(dirname) or "dirpool")
+ poolxml.name = poolname
poolxml.type = poolxml.TYPE_DIR
poolxml.target_path = dirname
pool = poolxml.install(build=False, create=True, autostart=True)