[python-virtinst/f17] Add F17 to OS list (bz 825758) virt-clone: Fix cloning guest with qcow2 image (bz 795400)

Cole Robinson crobinso at fedoraproject.org
Wed Jun 6 20:49:19 UTC 2012


commit fe7e233156edd6288c1f4755c21054bc1b36b39a
Author: Cole Robinson <crobinso at redhat.com>
Date:   Wed Jun 6 16:49:16 2012 -0400

    Add F17 to OS list (bz 825758)
    virt-clone: Fix cloning guest with qcow2 image (bz 795400)

 python-virtinst.spec             |   14 ++++-
 virtinst-add-f17.patch           |   36 +++++++++++
 virtinst-clone-copy-format.patch |  126 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 174 insertions(+), 2 deletions(-)
---
diff --git a/python-virtinst.spec b/python-virtinst.spec
index af07197..a844f12 100644
--- a/python-virtinst.spec
+++ b/python-virtinst.spec
@@ -1,7 +1,7 @@
 # -*- rpm-spec -*-
 
 %define _version 0.600.1
-%define _release 1
+%define _release 2
 
 %define with_rhel6_defaults 0
 %define with_selinux 1
@@ -30,8 +30,12 @@
 Summary: Python modules and utilities for installing virtual machines
 Name: python-%{appname}
 Version: %{_version}
-Release: %{_release}%{_extra_release}.1
+Release: %{_release}%{_extra_release}
 Source0: http://virt-manager.org/download/sources/%{appname}/%{appname}-%{version}.tar.gz
+# Add F17 to OS list (bz 825758)
+Patch1: %{appname}-add-f17.patch
+# virt-clone: Fix cloning guest with qcow2 image (bz 795400)
+Patch2: %{appname}-clone-copy-format.patch
 
 License: GPLv2+
 Group: Development/Libraries
@@ -58,6 +62,8 @@ and install new VMs) and virt-clone (clone an existing virtual machine).
 
 %prep
 %setup -q -n %{appname}-%{version}
+%patch1 -p1
+%patch2 -p1
 
 %build
 %if %{with_rhel6_defaults}
@@ -95,6 +101,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_bindir}/virt-convert
 
 %changelog
+* Wed Jun 06 2012 Cole Robinson <crobinso at redhat.com> - 0.600.1-2
+- Add F17 to OS list (bz 825758)
+- virt-clone: Fix cloning guest with qcow2 image (bz 795400)
+
 * Wed Feb 01 2012 Cole Robinson <crobinso at redhat.com> - 0.600.1-1
 - Rebased to version 0.600.1
 - virt-install: --redir option for usb redirection (Marc-André Lureau)
diff --git a/virtinst-add-f17.patch b/virtinst-add-f17.patch
new file mode 100644
index 0000000..f412aea
--- /dev/null
+++ b/virtinst-add-f17.patch
@@ -0,0 +1,36 @@
+diff -rup virtinst-0.600.1/virtinst/osdict.py foo/virtinst/osdict.py
+--- virtinst-0.600.1/virtinst/osdict.py	2012-01-31 12:24:06.000000000 -0500
++++ foo/virtinst/osdict.py	2012-06-06 16:18:53.305894022 -0400
+@@ -336,7 +336,6 @@ OS_TYPES = {
+     "fedora14": {
+         "label": "Fedora 14",
+         "distro": "fedora",
+-        "supported": True,
+         "devices" : {
+             DISK : VIRTIO_DISK,
+             NET  : VIRTIO_NET,
+@@ -363,6 +362,16 @@ OS_TYPES = {
+             INPUT: USB_TABLET,
+         }
+     },
++    "fedora17": {
++        "label": "Fedora 17",
++        "distro": "fedora",
++        "supported": True,
++        "devices" : {
++            DISK : VIRTIO_DISK,
++            NET  : VIRTIO_NET,
++            INPUT: USB_TABLET,
++        }
++    },
+ 
+     "opensuse11": {
+         "label": "openSuse 11",
+@@ -405,7 +414,6 @@ OS_TYPES = {
+     "mandriva2010": {
+         "label": "Mandriva Linux 2010 and later",
+         "distro": "mandriva",
+-        "supported": True,
+         "devices" : {
+             DISK : VIRTIO_DISK,
+             NET  : VIRTIO_NET,
diff --git a/virtinst-clone-copy-format.patch b/virtinst-clone-copy-format.patch
new file mode 100644
index 0000000..f7dcbcc
--- /dev/null
+++ b/virtinst-clone-copy-format.patch
@@ -0,0 +1,126 @@
+commit f0195e95d57deda83daed5231582ca86bde519ae
+Author: Cole Robinson <crobinso at 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 at 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)


More information about the scm-commits mailing list