From f157aa18396d05ce705db3b238d61820b9b60516 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Thu, 3 Sep 2020 16:46:03 -0400 Subject: [PATCH] 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 --- tests/data/cli/compare/virt-install-many-devices.xml | 5 +++++ tests/test_cli.py | 1 + virtinst/diskbackend.py | 7 ++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/data/cli/compare/virt-install-many-devices.xml b/tests/data/cli/compare/virt-install-many-devices.xml index 185d142b5..e49a073bd 100644 --- a/tests/data/cli/compare/virt-install-many-devices.xml +++ b/tests/data/cli/compare/virt-install-many-devices.xml @@ -227,6 +227,11 @@ + + + + +
diff --git a/tests/test_cli.py b/tests/test_cli.py index ef9b7b741..b0db96cc8 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -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 diff --git a/virtinst/diskbackend.py b/virtinst/diskbackend.py index 514523e64..e384e4674 100644 --- a/virtinst/diskbackend.py +++ b/virtinst/diskbackend.py @@ -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):