diskbackend: Simplify path a case of path joining

We are reimplementing os.path.join. Make sure the standard cli
test suite hits this case too

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-09-03 16:46:03 -04:00
parent f46e1a395c
commit f157aa1839
3 changed files with 8 additions and 5 deletions

View File

@ -227,6 +227,11 @@
<source dir="/dev/default-pool/testvol1.img"/>
<target dev="vdr" bus="virtio"/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/fooroot.img"/>
<target dev="vds" bus="virtio"/>
</disk>
<controller type="usb" index="0" model="ich9-ehci1">
<address type="pci" domain="0" bus="0" slot="4" function="7"/>
</controller>

View File

@ -612,6 +612,7 @@ source.reservations.managed=no,source.reservations.source.type=unix,source.reser
--disk size=.0001,format=raw
--disk size=.0001,pool=disk-pool
--disk path=%(EXISTIMG1)s,type=dir
--disk path=/fooroot.img,size=.0001
--network user,mac=12:34:56:78:11:22,portgroup=foo,link_state=down,rom_bar=on,rom_file=/tmp/foo
--network bridge=foobar,model=virtio,driver_name=qemu,driver_queues=3,filterref=foobar,rom.bar=off,rom.file=/some/rom,source.portgroup=foo

View File

@ -436,11 +436,8 @@ class _StorageCreator(_StorageBase):
if self.get_dev_type() == "network":
self._path = self._vol_install.name
else:
sep = "/"
if xmlobj.target_path == "" or xmlobj.target_path[-1] == '/':
sep = ""
self._path = (xmlobj.target_path + sep +
self._vol_install.name)
self._path = os.path.join(
xmlobj.target_path, self._vol_install.name)
return self._path
def get_vol_install(self):