commit f0195e95d57deda83daed5231582ca86bde519ae
Author: Cole Robinson <crobinso@redhat.com>
Date: Thu Mar 1 17:31:40 2012 -0500
virt-clone: fix guest booting when cloning a qcow2 image
We weren't syncing the driver type value in the XML
diff --git a/tests/cli-test-xml/compare/clone-auto1.xml b/tests/cli-test-xml/compare/clone-auto1.xml
index 328856c..133e8ce 100644
--- a/tests/cli-test-xml/compare/clone-auto1.xml
+++ b/tests/cli-test-xml/compare/clone-auto1.xml
@@ -23,6 +23,7 @@
<source dev="/disk-pool/diskvol1-clone"/>
<target dev="sda" bus="scsi"/>
<address type="drive" controller="0" bus="0" unit="0"/>
+ <driver name="qemu" type="raw"/>
</disk>
<disk type="block" device="cdrom">
<target dev="sdb" bus="scsi"/>
@@ -35,6 +36,12 @@
<readonly/>
<address type="drive" controller="0" bus="0" unit="2"/>
</disk>
+ <disk type="file" device="disk">
+ <driver name="qemu" type="qcow2"/>
+ <target dev="sdd" bus="scsi"/>
+ <address type="drive" controller="0" bus="0" unit="3"/>
+ <source file="/default-pool/default-vol-clone"/>
+ </disk>
<disk type="block" device="disk">
<source dev="/default-pool/sharevol.img"/>
<target dev="sdx" bus="scsi"/>
diff --git a/tests/clitest.py b/tests/clitest.py
index 90a423d..abeabbe 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -926,7 +926,7 @@ args_dict = {
],
"compare" : [
- ("-o test-for-clone --auto-clone --clone-running", "clone-auto1"),
+ ("--connect %(KVMURI)s -o test-for-clone --auto-clone --clone-running", "clone-auto1"),
("-o test-clone-simple --name newvm --auto-clone --clone-running",
"clone-auto2"),
],
diff --git a/tests/testdriver.xml b/tests/testdriver.xml
index 8f877b5..59cdf9e 100644
--- a/tests/testdriver.xml
+++ b/tests/testdriver.xml
@@ -94,6 +94,11 @@
<target dev='sdc' bus='scsi'/>
<readonly/>
</disk>
+ <disk type='file' device='disk'>
+ <source file='/default-pool/default-vol'/>
+ <target dev='sdd' bus='scsi'/>
+ <driver name="qemu" type="qcow2"/>
+ </disk>
<disk type='block' device='disk'>
<source dev='/default-pool/sharevol.img'/>
<target dev='sdx' bus='scsi'/>
diff --git a/virtinst/CloneManager.py b/virtinst/CloneManager.py
index f4af695..aa5e3f5 100644
--- a/virtinst/CloneManager.py
+++ b/virtinst/CloneManager.py
@@ -473,11 +473,6 @@ class CloneDesign(object):
_("Clone onto existing storage volume is not "
"supported: '%s'") % clone_disk.path)
- # Change the XML
- xmldisk.path = None
- xmldisk.type = clone_disk.type
- xmldisk.path = clone_disk.path
-
# Sync 'size' between the two
if orig_disk.size:
clone_disk.size = orig_disk.size
@@ -500,6 +495,12 @@ class CloneDesign(object):
elif not self.preserve_dest_disks:
clone_disk.clone_path = orig_disk.path
+ # Change the XML
+ xmldisk.path = None
+ xmldisk.type = clone_disk.type
+ xmldisk.path = clone_disk.path
+ xmldisk.driver_type = clone_disk.driver_type
+
# Save altered clone xml
self._clone_xml = self._guest.get_xml_config()
commit c9ae2ac4668213c03614842d92327737a25cf9ec
Author: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Date: Thu Mar 29 10:58:15 2012 -0400
virt-clone: further fix guest booting when cloning a qcow2 image
commit f0195e95d5 didn't fix the problem completely,
we should get the orig_disk's driver_type when setup
cloning.
Signed-off-by: Wanlong Gao <gaowanlong cn fujitsu com>
diff --git a/virtinst/CloneManager.py b/virtinst/CloneManager.py
index 88e4209..24bbb50 100644
--- a/virtinst/CloneManager.py
+++ b/virtinst/CloneManager.py
@@ -499,7 +499,7 @@ class CloneDesign(object):
xmldisk.path = None
xmldisk.type = clone_disk.type
xmldisk.path = clone_disk.path
- xmldisk.driver_type = clone_disk.driver_type
+ xmldisk.driver_type = orig_disk.driver_type
# Save altered clone xml
self._clone_xml = self._guest.get_xml_config()
@@ -551,7 +551,8 @@ class CloneDesign(object):
device = VirtualDisk.DEVICE_CDROM
d = VirtualDisk(disk.path, conn=self._hyper_conn,
- device=device, validate=validate)
+ device=device, driverType=disk.driver_type,
+ validate=validate)
d.target = disk.target
except Exception, e:
logging.debug("", exc_info=True)