It avoids file names like //foo. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1210564 Signed-off-by: Giuseppe Scrivano <gscrivan@xxxxxxxxxx> --- tests/clone-xml/force-out.xml | 2 +- tests/clonetest.py | 4 ++-- virtinst/diskbackend.py | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/clone-xml/force-out.xml b/tests/clone-xml/force-out.xml index 4a041a2..63670f8 100644 --- a/tests/clone-xml/force-out.xml +++ b/tests/clone-xml/force-out.xml @@ -29,7 +29,7 @@ <readonly/> </disk> <disk type="file" device="disk"> - <source file="/tmp/clone2.img"/> + <source file="/clone2.img"/> <target dev="sdb" bus="scsi"/> </disk> <interface type="network"> diff --git a/tests/clonetest.py b/tests/clonetest.py index 5789d41..ddab4f2 100644 --- a/tests/clonetest.py +++ b/tests/clonetest.py @@ -86,7 +86,7 @@ class TestClone(unittest.TestCase): if disks is None: disks = ["/dev/disk-pool/disk-vol1", "/tmp/clone2.img", - "/tmp/clone3.img", "/tmp/clone4.img", + "/clone3", "/tmp/clone4.img", "/tmp/clone5.img", None] cloneobj.clone_paths = disks @@ -156,7 +156,7 @@ class TestClone(unittest.TestCase): base = "force" self._clone_helper(base, disks=["/dev/default-pool/1234.img", - None, "/tmp/clone2.img"], + None, "/clone2.img"], force_list=["hda", "fdb", "sdb"]) def testCloneStorageSkip(self): diff --git a/virtinst/diskbackend.py b/virtinst/diskbackend.py index 254c761..a7fe2de 100644 --- a/virtinst/diskbackend.py +++ b/virtinst/diskbackend.py @@ -236,7 +236,10 @@ class _StorageCreator(_StorageBase): if self.get_dev_type() == "network": self._path = self._vol_install.name else: - self._path = (xmlobj.target_path + "/" + + sep = "/" + if xmlobj.target_path == "" or xmlobj.target_path[-1] == '/': + sep = "" + self._path = (xmlobj.target_path + sep + self._vol_install.name) return self._path -- 2.4.2 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list