Bug 2181235
| Summary: | The error isn't clear when there is no vcenter or ESXi host username but input password via -ip option in v2v command line | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | mxie <mxie> | ||||
| Component: | libvirt | Assignee: | Michal Privoznik <mprivozn> | ||||
| libvirt sub component: | General | QA Contact: | mxie <mxie> | ||||
| Status: | CLOSED ERRATA | Docs Contact: | |||||
| Severity: | low | ||||||
| Priority: | low | CC: | chhu, hongzliu, jdenemar, jsuchane, juzhou, kkiwi, lersek, lmen, mprivozn, rjones, tyan, tzheng, virt-maint, vwu, xiaodwan | ||||
| Version: | 9.3 | Keywords: | Triaged, Upstream | ||||
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
||||
| Target Release: | --- | ||||||
| Hardware: | x86_64 | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | libvirt-9.3.0-1.el9 | Doc Type: | If docs needed, set a value | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2023-11-07 08:31:17 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: | 9.3.0 | ||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
|
Description
mxie@redhat.com
2023-03-23 11:45:15 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. Created attachment 1953429 [details]
repro.c
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). 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 [...] 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. (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! 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
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 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 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 |