Launchpad has imported 4 comments from the remote bug at
https://bugzilla.redhat.com/show_bug.cgi?id=803087.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2012-03-13T22:17:44+00:00 Tuomas wrote:

Created attachment 569802
Patches CloneDesign to generate the XML required for the <driver type='...'/> 
element

Description of problem:

Cloning of a VM doesn't duplicate the driver type of the disk images to
be cloned.

Version-Release number of selected component (if applicable):

DistroRelease: Ubuntu 12.04
Package: virtinst 0.600.1-1ubuntu2
ProcVersionSignature: Ubuntu 3.2.0-18.29-generic 3.2.9
Uname: Linux 3.2.0-18-generic x86_64
Architecture: amd64
SourcePackage: virtinst

How reproducible:
Always

Steps to Reproduce:
1. Create a new QEMU/KVM VM called "foo" with a disk in qcow2 format like this

    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/foo.img'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' 
function='0x0'/>
    </disk>

2. Clone the disk by running
       sudo virt-clone -o foo --auto-clone
   or using virt-manager GUI

Actual results:
The resulting VM foo-clone has the following disk configuration

    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/foo-clone.img'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' 
function='0x0'/>
    </disk>

The type of the disk is raw, not qcow2 as in the original VM.

Expected results:

The configuration of the clone should define the disk as the same type
as in the original VM, i.e. qcow2 in this case.

Additional info:
The file is properly cloned in the qcow2 format, though, so the issue only 
affects generation of the clone configuration.

About the patches:

virtinst-0.600.1-generate-cloned-disk-driver-type-xml.diff patches
CloneDesign to generate the XML required for the <driver type='...'/>
element. Only this patch is needed to fix the described malfunction with
virt-manager. After applying this, cloned VMs created with virt-manager
will have their configuration correctly cloned.

virtinst-0.600.1-hack-virt-clone-to-support-cloning-of-disk-driver-
type.diff is a really ugly hack for virt-clone which makes it work
around this problem. Also the previous patch is required so that correct
XML is actually generated. This patch overrides the CloneDesign API by
directly modifying the list of cloned drives in its CloneDesign object.
The problem is that these drives are created in
CloneDesign::set_cloned_devices using a fresh instance of VirtualDisk.
No info about the original disk is available here, only the filename of
the cloned image. Obviously, this isn't enough to supply the driver type
to the constructor of VirtualDisk (driverType argument), so this info is
effectively lost for the cloned disk. This code should be refactored so
that the driver type from the original disk is somehow automatically
preserved so the caller (e.g. virt-clone or virt-manager) doesn't have
to do anything special. But since I'm not familiar with the code, I
don't know where and how to start such refactoring.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/virtinst/+bug/953922/comments/2

------------------------------------------------------------------------
On 2012-03-13T22:18:25+00:00 Tuomas wrote:

Created attachment 569803
Hack for virt-clone to work around this problem

Reply at:
https://bugs.launchpad.net/ubuntu/+source/virtinst/+bug/953922/comments/3

------------------------------------------------------------------------
On 2012-03-13T22:31:16+00:00 Tuomas wrote:

My initial bug report for Ubuntu regarding this issue
https://bugs.launchpad.net/ubuntu/+source/virt-manager/+bug/953922

Reply at:
https://bugs.launchpad.net/ubuntu/+source/virtinst/+bug/953922/comments/5

------------------------------------------------------------------------
On 2012-04-02T20:59:32+00:00 Cole wrote:

Thanks for the report. This has actually been fixed independently
upstream:

http://git.fedorahosted.org/git?p=python-virtinst.git;a=commit;h=f0195e95d57deda83daed5231582ca86bde519ae
http://git.fedorahosted.org/git?p=python-virtinst.git;a=commit;h=c9ae2ac4668213c03614842d92327737a25cf9ec

Unfortunately those probably won't backport cleanly, in which case I
think your hack is sufficient for a distro backport. Closing as UPSTREAM

Reply at:
https://bugs.launchpad.net/ubuntu/+source/virtinst/+bug/953922/comments/6


** Changed in: virtinst
       Status: Unknown => Won't Fix

** Changed in: virtinst
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/953922

Title:
  When cloning a VM with qcow2 disk, the cloned VM will have its disk
  defined as raw format in its config

To manage notifications about this bug go to:
https://bugs.launchpad.net/virtinst/+bug/953922/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to