clone: do not use a '/' separator when using a disk file under /

It avoids file names like //foo.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1210564

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2015-06-05 16:55:39 +02:00
parent a22f75544e
commit f5a13510eb
3 changed files with 7 additions and 4 deletions

View File

@ -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">

View File

@ -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):

View File

@ -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