[virt-tools-list] [PATCH] virt-clone: further fix guest booting when cloning a qcow2 image

Cole Robinson crobinso at redhat.com
Thu Mar 29 13:44:03 UTC 2012


On 03/27/2012 08:10 PM, Wanlong Gao wrote:
> On 03/28/2012 06:53 AM, Cole Robinson wrote:
> 
>> On 03/24/2012 01:13 PM, Wanlong Gao wrote:
>>> 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 at cn.fujitsu.com>
>>> ---
>>>  virtinst/CloneManager.py |    5 +++--
>>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/virtinst/CloneManager.py b/virtinst/CloneManager.py
>>> index ff3c074..dee3c59 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()
>>> @@ -553,7 +553,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)
>>
>> Hmm, can you give an example invocation where the current code fails? I'm
>> having trouble understanding the problem.
>>
>> Then hopefully we can turn that into a unit test that demonstrates the fix.
> 
> 
> Sure,
> 
> After cloning a guest with "qcow2" image, the cloned guest
> can't boot with the no boot able image error, the issue is
> that "virt-clone" didn't sync the disk's driver type, below
> is the description of this issue,
> 
> [root at gaowanlong ~]# virsh dumpxml 6u1-clone
> ...
>     <disk type='file' device='disk'>
>       <driver name='qemu' type='qcow2'/>
> ...
> 
> [root at gaowanlong ~]# virt-clone -o 6u1-clone -n 6u1-clone-clone -f /work/image/6u1-clone-clone.img --print-xml
> ...
>     <disk type="file" device="disk">
>       <driver name="qemu" type="raw"/>      <-------------not sync the driver type
> ...
> 
> Then I sent a patch to sync the "disk driver type", after patch applied,
> [root at gaowanlong ~]# virt-clone -o 6u1-clone -n 6u1-clone-clone -f /work/image/6u1-clone-clone.img --print-xml
> ...
>     <disk type="file" device="disk">
>       <driver name="qemu" type="qcow2"/>     <-----------here sync the qcow2
> ...
> 

Hmm, I still can't quite see what the problem is. We already have a unit test
that is doing close to the same thing AFAICT, and it works correctly.

Can you provide the full virt-clone command to reproduce with --debug output
attached?

Thanks,
Cole




More information about the virt-tools-list mailing list