Bug 889082

Summary: [RFE] virt-v2v should check whether guest with same name exist on target first then transfer the disk
Product: Red Hat Enterprise Linux 7 Reporter: tingting zheng <tzheng>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: cwei, juzhou, mjenner, mzhan, ptoscano, rbalakri, rjones, tzheng, xiaodwan
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: libguestfs-1.28.1-1.35.el7 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
: 1257030 (view as bug list) Environment:
Last Closed: 2015-11-19 06:56:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1205796, 1250961, 1257030    

Description tingting zheng 2012-12-20 07:45:12 UTC
Description of problem:
[RFE]virt-p2v should check whether guest with same name exist on target first then transfer the disk

Version-Release number of selected component (if applicable):
virt-v2v-0.8.9-2.el6.x86_64
RHEL6.4-20121212.1-Server-i386-P2V.iso

How reproducible:
100%

Steps to Reproduce:
1.Use virt-p2v to convert a physical machine,on the virt-p2v client GUI,type the guest name which already exists on target host.

2.Click convert.The conversion will begin,after spending a lot of time to transfer the whole disk,error shows:virt-v2v: libvirt error code: 9, message: operation failed: domain 'demo-test' already exists with uuid 40bf1863-1740-539c-88df-032a62cef740

3.Use virt-v2v to convert a guest with the name which already exists on target,it checks the target and quits instead of transferring the disk.
# virt-v2v -ic qemu+ssh://10.66.6.128/system -os default -b br0 test
root.6.128's password: 
virt-v2v: Domain test already exists on the target.

Actual results:
As steps describe.

Expected results:
virt-p2v works as virt-v2v,check whether guest with same name exist on target first then transfer the disk.

Additional info:

Comment 1 Matthew Booth 2012-12-21 12:44:37 UTC
Yup. virt-v2v does this, virt-p2v should do it too.

Comment 2 RHEL Program Management 2013-10-14 04:29:27 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 5 Richard W.M. Jones 2015-05-05 14:45:05 UTC
Although the bug mentions virt-p2v, in fact it's the job of
virt-v2v to check on the target for the guest with the same
name.  (virt-p2v uses virt-v2v, so hopefully that will solve
the problem for virt-v2v too.)

I have adjusted the summary accordingly.

Comment 6 Richard W.M. Jones 2015-05-05 18:07:31 UTC
Patch posted:
https://www.redhat.com/archives/libguestfs/2015-May/msg00010.html

Comment 7 Richard W.M. Jones 2015-05-06 17:07:42 UTC
Upstream commits:

e7833a5eea350ca3579d1f9e6702e116b45572fc
badfc2e9b2a56fd5bac849a6edca4fec823abeea

Comment 9 Richard W.M. Jones 2015-05-12 21:23:22 UTC
This fix introduced a memory leak.  The memory leak is fixed by:
https://github.com/libguestfs/libguestfs/commit/85347e32e02a412b8b17100b7eb5d39d1e83b66d

Comment 11 tingting zheng 2015-06-18 06:14:40 UTC
Tested with:
virt-v2v-1.28.1-1.38.el7.x86_64
libguestfs-1.28.1-1.38.el7.x86_64

1.Make sure on my host,there is guest named "esx6.0-win2008-x86_64" exist.
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 36    win7-vcenter                   running
 -     esx6.0-win2008-i386            shut off
 -     esx6.0-win2008-x86_64          shut off
 -     p2v-network-test               shut off
 -     rhel6.7-x64                    shut off
 -     rhel7.1-x64                    shut off

2.Use virt-v2v to convert guest which already exist on the host.
# virt-v2v -ic vpx://root.72.112/data/10.66.72.49/?no_verify=1 -os default -b virbr0  --password-file /tmp/passwd2 esx6.0-win2008-x86_64
[   0.0] Opening the source -i libvirt -ic vpx://root.72.112/data/10.66.72.49/?no_verify=1 esx6.0-win2008-x86_64
[   1.0] Creating an overlay to protect the source from being modified
[   2.0] Opening the overlay
[  14.0] Initializing the target -o libvirt -os default
virt-v2v: error: a libvirt domain called 'esx6.0-win2008-x86_64' already 
exists on the target.

If using virt-v2v directly, use the '-on' option to select a different 
name. If using virt-p2v, select a different 'Name' in the 'Target 
properties'. Or delete the existing domain on the target using the 'virsh 
undefine' command.

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]

There is error about guest already exists on the target before conversion.

Tried about virt-p2v,the similar error showed and conversion didn't start.

Refer to the above comments,move the bug to VERIFIED.

Comment 13 errata-xmlrpc 2015-11-19 06:56:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2183.html