From ca6d90b3d6d759e407855dfd4ba869c4f85542d3 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 29 Apr 2014 14:09:14 -0400 Subject: [PATCH] Fix using storage when the directory name contains whitespace (bz 1091384) (cherry picked from commit feadd98fed045ec40d5d5cf8250c7b05517eb9c9) --- virtinst/diskbackend.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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)