Bug 1728545
Summary: | Ambiguous qemu-img info output when using slash or backslash in nbd exportname | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux Advanced Virtualization | Reporter: | Han Han <hhan> | |
Component: | qemu-kvm | Assignee: | Eric Blake <eblake> | |
qemu-kvm sub component: | NBD | QA Contact: | zixchen | |
Status: | CLOSED ERRATA | Docs Contact: | ||
Severity: | medium | |||
Priority: | medium | CC: | coli, eblake, jinzhao, juzhang, mrezanin, rbalakri, virt-maint, xuwei | |
Version: | --- | Keywords: | Reopened | |
Target Milestone: | rc | Flags: | zixchen:
needinfo-
pm-rhel: mirror+ |
|
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | qemu-kvm-5.0.0-0.module+el8.3.0+6620+5d5e1420 | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1849893 (view as bug list) | Environment: | ||
Last Closed: | 2020-11-17 17:45:27 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: | 1849893 |
Description
Han Han
2019-07-10 07:01:31 UTC
I analyzed this bug. The root cause is that nbd driver has two parsers for the filename, the older one that uses 'nbd:' syntax, and newer one that uses the 'nbd://' URI syntax, following RFC3986 So: '\' (backslash) in the URI path, appears to be not valid URI This is what I see in the spec: path-abempty = *( "/" segment ) segment = *pchar pchar = unreserved / pct-encoded / sub-delims / ":" / "@" unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" pct-encoded = "%" HEXDIG HEXDIG sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" However as you see you can encode backslash using percent encoded syntax and it does work meaning that if I name an export '\', I can access it with 'nbd://localhost:10809/%5C' '/' (forward slash). The forward slash works fine as long as it is not leading forward slash. That is when I name export 'foo/bar' I can access it just fine using the URI syntax. However when the export starts with a slash, it doesn't work. basically the parser eats all the slashes after the nbd://. Looking at commit 1d7d2a9d2191c34bd1ad69b420db9b47faa3fb8c, which added that parsing, it explicitly mentions that as a feature "The URI syntax is consistent with the Gluster syntax. Export names are specified in the path, preceded by one or more (otherwise unused) slashes. " I guess that it is not worth it to support export names starting with a slash anyway, so I'll close that bug. If you think that there is real world case when this is needed, feel free to reopen. See also this upstream patch: https://lists.gnu.org/archive/html/qemu-devel/2020-02/msg03018.html The NBD URI spec says one leading slash in the URI is stripped, but that it is still possible to provide export names with a leading slash, as in: nbd://localhost:10809//name => export '/name' so I'll reopen this so we can decide whether to backport that patch. Fix PULLed upstream, qemu.git commit id '2485f22fe9211b2e80970f83199b320eee211319' Setting this to POST using next QEMU upstream fixed in version and moving into RHEL AV 8.3.0 for validation. Tested with qemu-kvm-5.0.0-0.module+el8.3.0+6620+5d5e1420.x86_64 RHEL AV 8.3.0, export names with a leading slash and backing slash not hit this issue. Version: kernel-4.18.0-215.el8.x86_64 qemu-kvm-5.0.0-0.module+el8.3.0+6620+5d5e1420.x86_64 I choose my local host as a nbd server. Steps for exporting names with a leading slash: 1. qemu-nbd /home/test/rhel83-nbd.qcow2 -x '/' -t 2. qemu-img info 'nbd:localhost:10809:exportname=/' 3. qemu-img info 'nbd://localhost:10809//' After Step2, image: nbd://localhost:10809// file format: raw virtual size: 20 GiB (21474836480 bytes) disk size: unavailable After Step3, image: nbd://localhost:10809// file format: raw virtual size: 20 GiB (21474836480 bytes) disk size: unavailable I validated this issue when exporting with a backslash as well: Steps for exporting names with a leading slash: 1. qemu-nbd /home/test/rhel83-nbd.qcow2 -x '\' -t 2. qemu-img info 'nbd:localhost:10809:exportname=\' 3. qemu-img info 'nbd://localhost:10809/\' 4. qemu-img info 'nbd://localhost:10809/%5C' After Step2, image: nbd://localhost:10809/\ file format: raw virtual size: 20 GiB (21474836480 bytes) disk size: unavailable After Step3, qemu-img: Could not open 'nbd://localhost:10809/\': No valid URL specified After Step4, image: nbd://localhost:10809/\ file format: raw virtual size: 20 GiB (21474836480 bytes) disk size: unavailable Additional info: In the slow train of RHEL 8.3.0 with qemu-kvm-4.2.0-28.module+el8.3.0+7105+0cc49779.x86_64, hit the issue with both leading slash '/'. Same test steps, but in the leading slash case after Step 3: qemu-img: Could not open 'nbd://localhost:10809//': Requested export not available server reported: export '' not present Should a new issue be cloned to slow train RHEL8.3.0? For RHEL 8.3.0 slow train, the new bug id: Bug 1849893 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 (virt:8.3 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/RHBA-2020:5137 |