[virt-manager PATCH] virt-clone: fix force-copy of empty cdrom or floppy disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is nothing to copy so don't try to generate new path.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1564863

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---

Pushed

 tests/clitest.py | 1 +
 virt-clone       | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/clitest.py b/tests/clitest.py
index abfca031..9b32d3d0 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -1048,6 +1048,7 @@ c.add_invalid("--original-xml " + _CLONE_UNMANAGED + " --file virt-install --fil
 c.add_invalid("--original-xml " + _CLONE_UNMANAGED + " --file %(NEWCLONEIMG1)s --file %(NEWCLONEIMG2)s --force-copy=hdc")  # XML w/ disks, force copy but not enough disks passed
 c.add_invalid("--original-xml " + _CLONE_MANAGED + " --file /tmp/clonevol")  # XML w/ managed storage, specify unmanaged path (should fail)
 c.add_invalid("--original-xml " + _CLONE_NOEXIST + " --file %(EXISTIMG1)s")  # XML w/ non-existent storage, WITHOUT --preserve
+c.add_valid("--original-xml " + _CLONE_MANAGED + " --auto-clone --force-copy fda")  # force copy empty floppy drive
 
 
 
diff --git a/virt-clone b/virt-clone
index 6f86732a..926c4181 100755
--- a/virt-clone
+++ b/virt-clone
@@ -67,11 +67,10 @@ def get_clone_diskfile(new_diskfiles, design, preserve, auto_clone):
             new_diskfiles.append(None)
         newpath = new_diskfiles[newidx]
 
-        if newpath is None and auto_clone:
-            newpath = design.generate_clone_disk_path(origpath)
-
         if origpath is None:
             newpath = None
+        elif newpath is None and auto_clone:
+            newpath = design.generate_clone_disk_path(origpath)
 
         clonepaths.append(newpath)
         newidx += 1
-- 
2.20.1

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux