Bug 1158526

Summary: Use password file instead of process interaction
Product: Red Hat Enterprise Linux 7 Reporter: Shahar Havivi <shavivi>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: codong, dyuan, juzhou, mbooth, michal.skrivanek, mzhan, ptoscano, rjones, shavivi, tzheng
Target Milestone: rc   
Target Release: 7.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: libguestfs-1.28.1-1.7.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 13:46:59 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:

Description Shahar Havivi 2014-10-29 14:50:57 UTC
The need to enter password in interactive way raise the possibility for deadlock in inter-process communication.

By using a password file we can limit the interaction to one way, ie parsing the virt-v2v output only.

Comment 1 Richard W.M. Jones 2014-10-30 13:42:26 UTC
Patches posted:
https://www.redhat.com/archives/libguestfs/2014-October/msg00243.html

A bit complex & risky for 7.1 however ...

Comment 3 zhoujunqin 2014-11-07 07:27:01 UTC
Hi rjones,
i try to test this option "--password-file" with latest build:
libguestfs-1.28.1-1.8.el7.x86_64
virt-v2v-1.28.1-1.8.el7.x86_64

steps:
1. Prepare a file including esx server password:
# cat /tmp/passwd 
aaa---------------->>(for example)
# ll /tmp/passwd 
-rw-------. 1 root root 18 Nov  7 14:34 /tmp/passwd

2. Use virt-v2v convert a guest from esx server:

#  virt-v2v -ic vpx://root.111.25/tzheng-demo/10.66.106.63/?no_verify=1 test-rhel7.0-released-gui --password-file /tmp/passwd  -v -x 
virt-v2v: libguestfs 1.28.1 (x86_64)
[   0.0] Opening the source -i libvirt -ic vpx://root.111.25/tzheng-demo/10.66.106.63/?no_verify=1 test-rhel7.0-released-gui
input_libvirt_vcenter_https: source: scheme vpx server 10.66.111.25
libvirt: ESX Driver error : internal error: HTTP response code 500 for call to 'Login'. Fault: ServerFaultCode - Cannot complete login due to an incorrect user name or password.
virt-v2v: error: internal error: invalid argument: cannot open libvirt 
connection 'vpx://root.111.25/tzheng-demo/10.66.106.63/?no_verify=1'

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

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

My result failed.

You know we have to input password twice, and i also tried with following way but failed.
# cat /tmp/passwd
aaa
aaa

so please help check whether the format for password file is right or not, thanks.

Comment 4 Richard W.M. Jones 2014-11-07 08:38:29 UTC
You need to make sure the password does not end with '\n'.

To prepare the password file do:

  echo -n password > /tmp/password

The password only needs to appear in the file once.

Comment 5 zhoujunqin 2014-11-07 09:06:28 UTC
Hi rjones,
thanks for you reply, i tried again:
1.
# echo -n aaa >/tmp/passwd2
2.
#  virt-v2v -ic vpx://root.111.25/tzheng-demo/10.66.106.63/?no_verify=1 test-vmtools-bug1151610 -on test-vmtools-bug1151610-2 --password-file /tmp/passwd2
[   0.0] Opening the source -i libvirt -ic vpx://root.111.25/tzheng-demo/10.66.106.63/?no_verify=1 test-vmtools-bug1151610
[   1.0] Creating an overlay to protect the source from being modified
[   2.0] Opening the overlay
[  10.0] Initializing the target -o libvirt -os default
[  10.0] Inspecting the overlay
[  78.0] Checking for sufficient free disk space in the guest
[  78.0] Estimating space required on target for each disk
[  78.0] Converting Red Hat Enterprise Linux Server release 6.5 (Santiago) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 462.0] Mapping filesystem data to avoid copying unused and blank areas
[ 462.0] Closing the overlay
[ 462.0] Copying disk 1/1 to /var/lib/libvirt/images/test-vmtools-bug1151610-2-sda (raw)
    (100.00/100%)
[ 617.0] Creating output metadata
Pool default refreshed

Domain test-vmtools-bug1151610-2 defined from /tmp/v2vlibvirt3290a0.xml

[ 618.0] Finishing off

Result: Conversion successfully and boot up with no error.
so move this bug from ON_QA to VERIFIED.

Comment 7 errata-xmlrpc 2015-03-05 13:46:59 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-0303.html