Bug 1136739

Summary: virt-v2v warning info should be printed to fill the whole line
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: codong, juzhou, mbooth, mzhan, ptoscano, rjones
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: libguestfs-1.27.38-1.1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 13:44:07 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 tingting zheng 2014-09-03 08:11:17 UTC
Description
virt-v2v warning info should be printed to fill the whole line

Version:
libguestfs-tools-c-1.27.32-1.1.el7.x86_64
libguestfs-1.27.32-1.1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Run virt-v2v to connect a wrong URI to see the warning info.
# virt-v2v -ic sdll://sdfl test
[   0.0] Opening the source -i libvirt -ic sdll://sdfl test
virt-v2v: warning: no support for remote libvirt connections to '-ic 
sdll://sdfl'.  The conversion may fail when it tries to read the source 
disks.
libvirt: XML-RPC error : Cannot read CA certificate '/etc/pki/CA/cacert.pem': No such file or directory
virt-v2v: internal error: invalid argument: cannot open libvirt connection 'sdll://sdfl'

2.Just run virt-v2v command:
# virt-v2v
virt-v2v: error: expecting a libvirt guest name on the command line

virt-v2v: If reporting bugs, run virt-v2v with debugging enabled (-v 
-x) and include the complete output.

Actual results:
Step 1:the warning info doesn't fill the whole line,which affects the readability and is not consistent with other warning info.
[   0.0] Opening the source -i libvirt -ic sdll://sdfl test
virt-v2v: warning: no support for remote libvirt connections to '-ic 
sdll://sdfl'.  The conversion may fail when it tries to read the source 
disks.

while the below info fills the whole line:
libvirt: XML-RPC error : Cannot read CA certificate '/etc/pki/CA/cacert.pem': No such file or directory
virt-v2v: internal error: invalid argument: cannot open libvirt connection 'sdll://sdfl'


Expected results:
The warning info should be printed to fill the whole line and be consistent.

Additional info:

Comment 2 Richard W.M. Jones 2014-09-03 10:39:16 UTC
There are several issues here:

(1) virt-v2v correctly wraps warning messages at 72 characters.

(2) virt-v2v wraps most error messages too.

(3) However there are some places where we don't call the error()
    function, but instead call eprintf directly.  This is a bug.

(4) The "libvirt: XML-RPC error" message is printed by libvirt
    directly.  We have no control over it.

Comment 3 Richard W.M. Jones 2014-09-03 12:32:43 UTC
Upstream fixes:

https://github.com/libguestfs/libguestfs/commit/bb362f687840cd9fcf68bea08fd34fe8e4ddc64c
https://github.com/libguestfs/libguestfs/commit/711c32b0d9d31dc554b78f471be4b529eab4dbba
https://github.com/libguestfs/libguestfs/commit/941ebaa5e44cbf41e0dd94f811329d59f18c2868

The errors now look like this:

$ virt-v2v -ic abc://def 
virt-v2v: error: expecting a libvirt guest name on the command line

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

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


$ virt-v2v -ic abc://def test
[   0.0] Opening the source -i libvirt -ic abc://def test
virt-v2v: warning: no support for remote libvirt connections to '-ic 
abc://def'.  The conversion may fail when it tries to read the source 
disks.
libvirt: XML-RPC error : Cannot read CA certificate '/etc/pki/CA/cacert.pem': No such file or directory
virt-v2v: error: internal error: invalid argument: cannot open libvirt 
connection 'abc://def'

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

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


Note I cannot do anything about the libvirt error message, it's
not controlled by virt-v2v at all.

Comment 5 zhoujunqin 2014-09-10 03:01:57 UTC
I can reproduce this issue as bug description.
And try to verify with new version:
virt-v2v-1.27.41-1.1.el7.x86_64
libguestfs-tools-c-1.27.41-1.1.el7.x86_64
libguestfs-1.27.41-1.1.el7.x86_64

Steps:
Run virt-v2v to connect a wrong URI to see the error message.
1.
# virt-v2v -ic sdll://sdfl
virt-v2v: error: expecting a libvirt guest name on the command line

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

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

2.
# virt-v2v -ic sdll://sdfl test
[   0.0] Opening the source -i libvirt -ic sdll://sdfl test
libvirt: XML-RPC error : Cannot read CA certificate '/etc/pki/CA/cacert.pem': No such file or directory
virt-v2v: error: internal error: invalid argument: cannot open libvirt 
connection 'sdll://sdfl'

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

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

And Richard W.M. Jones, i also have a question, why the error format showed by virt-v2v cannot fill the whole line, just likes libvirt error format, thanks.

Comment 6 Richard W.M. Jones 2014-09-10 10:26:42 UTC
(In reply to zhoujunqin from comment #5)
> And Richard W.M. Jones, i also have a question, why the error format showed
> by virt-v2v cannot fill the whole line, just likes libvirt error format,
> thanks.

virt-v2v wraps the error message to make it easier to read.
Otherwise on an 80 column display you would see words split
across lines.

Comment 9 zhoujunqin 2014-09-11 09:49:14 UTC
According to above comments, move it from ON_QA to VERIFIED.

Comment 11 errata-xmlrpc 2015-03-05 13:44:07 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