RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2181235 - The error isn't clear when there is no vcenter or ESXi host username but input password via -ip option in v2v command line
Summary: The error isn't clear when there is no vcenter or ESXi host username but inpu...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.3
Hardware: x86_64
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: mxie@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-03-23 11:45 UTC by mxie@redhat.com
Modified: 2023-11-07 09:39 UTC (History)
15 users (show)

Fixed In Version: libvirt-9.3.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-07 08:31:17 UTC
Type: Bug
Target Upstream Version: 9.3.0
Embargoed:


Attachments (Terms of Use)
repro.c (1.34 KB, text/plain)
2023-03-24 18:37 UTC, Michal Privoznik
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-152901 0 None None None 2023-03-23 11:45:43 UTC
Red Hat Product Errata RHSA-2023:6409 0 None None None 2023-11-07 08:31:49 UTC

Description mxie@redhat.com 2023-03-23 11:45:15 UTC
Description of problem:
The error isn't clear when there is no vcenter username but input password via -ip option in v2v command line
 
Version-Release number of selected component (if applicable):
virt-v2v-2.2.0-5.el9.x86_64
libvirt-client-9.1.0-1.el9.x86_64
qemu-img-7.2.0-14.el9_2.x86_64


How reproducible:
100%

Steps to Reproduce:
1.Convert a guest from VMware by v2v but do not add vcenter username and input password via -ip option in command line
# virt-v2v -ic vpx://10.73.212.149/data/10.73.212.36/?no_verify=1  -it vddk -io vddk-libdir=/home/vddk8.0.0 -io vddk-thumbprint=D1:03:96:7E:11:3D:7C:4C:B6:50:28:1B:63:74:B5:40:5F:9D:9F:94 -ip /home/passwd  esx8.0-rhel9.2-x86_64 -v -x
virt-v2v: virt-v2v 2.2.0rhel=9,release=5.el9 (x86_64)
libvirt version: 9.1.0
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: get_backend
libguestfs: trace: get_backend = "libvirt"
could not set owner of /tmp/v2v.Ea3aV8: libvirt: VIR_ERR_OPERATION_UNSUPPORTED: VIR_FROM_REMOTE: Operation not supported: Cannot use direct socket mode if no URI is set
check_host_free_space: large_tmpdir=/var/tmp free_space=1166946172928
[   0.0] Setting up the source: -i libvirt -ic vpx://10.73.212.149/data/10.73.212.36/?no_verify=1 -it vddk esx8.0-rhel9.2-x86_64
virt-v2v: error: exception: libvirt: VIR_ERR_INTERNAL_ERROR: VIR_FROM_NONE: 
An error occurred, but the cause is unknown
rm -rf -- '/tmp/v2v.Ea3aV8'
libguestfs: trace: close
libguestfs: closing guestfs handle 0x558184ed0010 (state 0)


Actual results:
As above description

Expected results:
Improve the error info 

Additional info:

Comment 1 Klaus Heinrich Kiwi 2023-03-24 12:30:20 UTC
I'm gonna go with low severity / priority here (and add to our backlog) since this seems to be a non-functional user-side issue. Yes, the message could be improved, but I assume that the manual also have some instructions on how to use -ip.

Comment 7 Michal Privoznik 2023-03-24 18:37:08 UTC
Created attachment 1953429 [details]
repro.c

Comment 9 Michal Privoznik 2023-03-27 11:26:56 UTC
Patch proposed upstream:

https://listman.redhat.com/archives/libvir-list/2023-March/239026.html

and thanks Laszlo for your extensive analysis! This patch will make libvirt produce a proper error message when the auth callback did not set any username.

Meanwhile, when libvirt calls the callback, the callback is given a pointer to _virConnectCredential struct:

https://gitlab.com/libvirt/libvirt/-/blob/master/include/libvirt/libvirt-host.h#L628

The struct contains `.defresult` member. Would it make sense for v2v to just copy whatever libvirt put there when there's not cmd line argument to specify the username? Maybe I'm mixing two independent things together though (bug 2181234).

Comment 10 mxie@redhat.com 2023-03-28 04:18:40 UTC
Pleases also fix this scenario:

# virt-v2v -ic esx://10.73.212.36/?no_verify=1  -it vddk -io vddk-libdir=/home/vddk8.0.0 -io vddk-thumbprint=11:97:52:B3:B6:5D:C4:DD:05:D9:D0:43:31:0E:98:CB:73:6E:D6:45  -ip /home/esxpwd  esx8.0-rhel8.8-x86_64
[   0.2] Setting up the source: -i libvirt -ic esx://10.73.212.36/?no_verify=1 -it vddk esx8.0-rhel8.8-x86_64
virt-v2v: error: exception: libvirt: VIR_ERR_INTERNAL_ERROR: VIR_FROM_NONE: 
An error occurred, but the cause is unknown

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

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

Comment 11 Michal Privoznik 2023-03-28 06:51:33 UTC
Yeah, I think that scenario is also fixed because essentially vpx:// and esx:// URIs are handled by the same function esxConnectToVCenter(), which then calls the functions I'm fixing (virAuthGetUsernamePath() and virAuthAskCredential()). Let me see if I can make a scratch build for you, if you're interested in testing my patch.

Comment 13 Laszlo Ersek 2023-03-28 08:27:11 UTC
(In reply to Michal Privoznik from comment #9)
> Patch proposed upstream:
> 
> https://listman.redhat.com/archives/libvir-list/2023-March/239026.html
> 
> and thanks Laszlo for your extensive analysis! This patch will make libvirt
> produce a proper error message when the auth callback did not set any
> username.
> 
> Meanwhile, when libvirt calls the callback, the callback is given a pointer
> to _virConnectCredential struct:
> 
> https://gitlab.com/libvirt/libvirt/-/blob/master/include/libvirt/libvirt-
> host.h#L628
> 
> The struct contains `.defresult` member. Would it make sense for v2v to just
> copy whatever libvirt put there when there's not cmd line argument to
> specify the username?

I don't know -- what would the .defresult member do?

From the virt-v2v cmdline POV, I think what we want here is for the user to re-run virt-v2v, but with the cmdline fixed. So if the libvirt error message that virt-v2v forwards to the user is clear enough for that (and I think "Username request failed" is clear), then I think we're good. Thanks!

Comment 15 Michal Privoznik 2023-04-03 06:41:15 UTC
Merged upstream as:

commit 58b7cafc28dc86c4afae485b139927630c58bdc4
Author:     Michal Prívozník <mprivozn>
AuthorDate: Mon Mar 27 10:51:44 2023 +0200
Commit:     Michal Prívozník <mprivozn>
CommitDate: Mon Apr 3 08:34:53 2023 +0200

    virauth: Report error on empty auth result
    
    When opening a connection, it may be necessary to provide user
    credentials, or some additional info (e.g. whether to trust an
    ssh key). We have a special API for that: virConnectOpenAuth()
    where and additional callback can be passed. This callback is
    then called with _virConnectCredential struct filled partially
    and it's callback's responsibility to get desired data (e.g. by
    prompting user) and store it into .result member of the struct.
    
    But we document the callback behaviour as:
    
      When authentication requires one or more interactions, this callback
      is invoked. For each interaction supplied, data must be gathered
      from the user and filled in to the 'result' and 'resultlen' fields.
      If an interaction cannot be filled, fill in NULL and 0.
    
      Returns 0 if all interactions were filled, or -1 upon error
    
    But there are some buggy callbacks out there, which set:
    
      .result = NULL;
      .resultlen = 0;
    
    and return 0. Report an error when such buggy callback is met.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2181235
    Signed-off-by: Michal Privoznik <mprivozn>
    Reviewed-by: Martin Kletzander <mkletzan>

v9.2.0-108-g58b7cafc28

Comment 16 mxie@redhat.com 2023-05-08 01:59:10 UTC
Test the bug with libvirt-client-9.3.0-1.el9.x86_64

Steps:
1.Convert a guest from VMware by v2v but do not add vcenter username and input password via -ip option in command line
# virt-v2v -ic esx://10.73.212.36/?no_verify=1  -it vddk -io vddk-libdir=/home/vddk8.0.0 -io vddk-thumbprint=11:97:52:B3:B6:5D:C4:DD:05:D9:D0:43:31:0E:98:CB:73:6E:D6:45  -ip /home/esxpwd  esx8.0-rhel8.8-x86_64
[   0.1] Setting up the source: -i libvirt -ic esx://10.73.212.36/?no_verify=1 -it vddk esx8.0-rhel8.8-x86_64
virt-v2v: error: exception: libvirt: VIR_ERR_AUTH_FAILED: VIR_FROM_AUTH: 
authentication failed: Username request failed

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

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

#  virt-v2v -ic vpx://10.73.212.149/data/10.73.212.36/?no_verify=1  -it vddk -io vddk-libdir=/home/vddk8.0.0 -io vddk-thumbprint=D1:03:96:7E:11:3D:7C:4C:B6:50:28:1B:63:74:B5:40:5F:9D:9F:94 -ip /home/passwd  esx8.0-rhel9.2-x86_64
[   0.0] Setting up the source: -i libvirt -ic vpx://10.73.212.149/data/10.73.212.36/?no_verify=1 -it vddk esx8.0-rhel9.2-x86_64
virt-v2v: error: exception: libvirt: VIR_ERR_AUTH_FAILED: VIR_FROM_AUTH: 
authentication failed: Username request failed

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

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


Result:
   The bug has been fixed

Comment 19 mxie@redhat.com 2023-05-17 09:05:06 UTC
Verify the bug with libvirt-client-9.3.0-2.el9.x86_64

Steps:
1.Convert a guest from VMware by v2v but do not add vcenter username and input password via -ip option in command line
# virt-v2v -ic esx://10.73.212.36/?no_verify=1  -it vddk -io vddk-libdir=/home/vddk8.0.0 -io vddk-thumbprint=11:97:52:B3:B6:5D:C4:DD:05:D9:D0:43:31:0E:98:CB:73:6E:D6:45  -ip /home/esxpwd  esx8.0-rhel8.8-x86_64
[   0.1] Setting up the source: -i libvirt -ic esx://10.73.212.36/?no_verify=1 -it vddk esx8.0-rhel8.8-x86_64
virt-v2v: error: exception: libvirt: VIR_ERR_AUTH_FAILED: VIR_FROM_AUTH: 
authentication failed: Username request failed

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

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

#  virt-v2v -ic vpx://10.73.212.149/data/10.73.212.36/?no_verify=1  -it vddk -io vddk-libdir=/home/vddk8.0.0 -io vddk-thumbprint=D1:03:96:7E:11:3D:7C:4C:B6:50:28:1B:63:74:B5:40:5F:9D:9F:94 -ip /home/passwd  esx8.0-rhel9.2-x86_64
[   0.0] Setting up the source: -i libvirt -ic vpx://10.73.212.149/data/10.73.212.36/?no_verify=1 -it vddk esx8.0-rhel9.2-x86_64
virt-v2v: error: exception: libvirt: VIR_ERR_AUTH_FAILED: VIR_FROM_AUTH: 
authentication failed: Username request failed

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

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


Result:
   No problem found, move the bug to verified status

Comment 21 errata-xmlrpc 2023-11-07 08:31:17 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 (Moderate: libvirt security, bug fix, and enhancement update), 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://access.redhat.com/errata/RHSA-2023:6409


Note You need to log in before you can comment on or make changes to this bug.