Bug 1969232
| Summary: | Should fail to validate XML if adding externally launched virtiofsd device without target dir | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux Advanced Virtualization | Reporter: | yafu <yafu> |
| Component: | libvirt | Assignee: | Ján Tomko <jtomko> |
| Status: | CLOSED ERRATA | QA Contact: | Lili Zhu <lizhu> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 8.5 | CC: | jdenemar, jtomko, lmen, virt-maint, xuzhang |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | 8.5 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-7.5.0-1.el8 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-11-16 07:53:43 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: | 7.5.0 |
| Embargoed: | |||
Pushed upstream as:
commit e8863b91fb98f077d4c44a11bd7ea84c5e6b29ef
Author: Ján Tomko <jtomko>
CommitDate: 2021-06-17 10:51:24 +0200
conf: require target for external virtiofsd
When adding support for externally launched virtiofsd,
I was too liberal and did not require a target.
But the target is required, because it's passed to the
QEMU device, not to virtiofsd.
https://bugzilla.redhat.com/show_bug.cgi?id=1969232
Fixes: 12967c3e1333a6e106110f449ccb1e96279b9527
Fixes: 56dcdec1ac8104f94371c210585bab91eb36395d
Signed-off-by: Ján Tomko <jtomko>
Reviewed-by: Peter Krempa <pkrempa>
git describe: v7.4.0-193-ge8863b91fb
Tested this bug with:
libvirt-7.5.0-1.module+el8.5.0+11664+59f87560.x86_64
1.Edit guest with external virtiofs device without target dir and save xml:
#virsh edit vm1
...
<filesystem type='mount'>
<driver type='virtiofs' queue='1024'/>
<source socket='/var/run/vm001-vhost-fs.sock'/>
<address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
</filesystem>
...
error: missing target information for device /var/run/vm001-vhost-fs.sock
Failed. Try again? [y,n,i,f,?]:
1. prepare a xml file fs.xml with the above xml snippet, attach it to the guest
# virsh attach-device RHEL-8.5 fs.xml --config
error: Failed to attach device from fs.xml
error: missing target information for device /var/run/vm001-vhost-fs.sock
1. try to validate the guest xml with:
...
<filesystem type='mount'>
<driver type='virtiofs' queue='1024'/>
<source socket='/var/run/vm001-vhost-fs.sock'/>
<address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
</filesystem>
...
# virt-xml-validate RHEL-8.5.xml
RHEL-8.5.xml validates
2. delete the line with source element
...
<filesystem type='mount'>
<driver type='virtiofs' queue='1024'/>
<address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
</filesystem>
...
# virt-xml-validate RHEL-8.5.xml
Relax-NG validity error : Extra element devices in interleave
RHEL-8.5.xml:57: element devices: Relax-NG validity error : Element domain failed to validate content
RHEL-8.5.xml fails to validate
Validate guest xml without source element failed as expected, but without target dir will not.
Please help to check. Thanks.
I forgot to remove the <optional> tag from the RNG schema. Patch sent upstream: https://listman.redhat.com/archives/libvir-list/2021-July/msg00802.html The validation done after 'virsh edit' as shown in comment 5 should be sufficient. It also gives a more user-friendly error message. ( the patch from the previous comment was pushed upstream as v7.5.0-271-g5f1a7b2491 ) Retest this bug with:
libvirt-daemon-7.6.0-1.module+el8.5.0+12097+2c77910b.x86_64
1.Edit guest with external virtiofs device without target dir and save xml:
#virsh edit vm1
...
<filesystem type='mount'>
<driver type='virtiofs' queue='1024'/>
<source socket='/var/run/vm001-vhost-fs.sock'/>
<address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
</filesystem>
...
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content
Failed. Try again? [y,n,i,f,?]:
2. prepare a xml file fs.xml with the above xml snippet, attach it to the guest
# virsh attach-device rhel xml --config
error: Failed to attach device from xml
error: missing target information for device /var/run/vm001-vhost-fs.sock
3. try to validate the guest xml with:
...
<filesystem type='mount'>
<driver type='virtiofs' queue='1024'/>
<source socket='/var/run/vm001-vhost-fs.sock'/>
<address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
</filesystem>
...
# virt-xml-validate rhel.xml
Relax-NG validity error : Extra element devices in interleave
rhel.xml:32: element devices: Relax-NG validity error : Element domain failed to validate content
rhel.xml fails to validate
As the testing result matches with expected result, mark the bug as verified.
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:av 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-2021:4684 |
Description of problem: Should fail to validate XML if adding external virtiofs device without target dir Version-Release number of selected component (if applicable): libvirt-daemon-7.4.0-1.module+el8.5.0+11218+83343022.x86_64 How reproducible: 100% Steps to Reproduce: 1.Edit guest with external virtiofs device without target dir and save xml: #virsh edit vm1 ... <filesystem type='mount'> <driver type='virtiofs' queue='1024'/> <source socket='/var/run/vm001-vhost-fs.sock'/> <address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/> </filesystem> ... 2.Prepare externally launched virtiofsd: #/usr/libexec/virtiofsd --socket-path=/var/run/vm001-vhost-fs.sock -o source=/var/lib/fs/vm001 #chown qemu:qemu /var/run/vm001-vhost-fs.sock #setenfore 0 3.Start guest: # virsh start vm1 error: Failed to start domain 'vm1' error: internal error: qemu unexpectedly closed the monitor: 2021-06-08T03:08:38.108264Z qemu-kvm: -device vhost-user-fs-pci,chardev=chr-vu-fs0,queue-size=1024,tag=,bus=pci.10,addr=0x0: tag property cannot be empty 4. Actual results: Guest can not start successfully without target dir for virtiofsd device. Expected results: Should fail to validate XML if adding externally launched virtiofsd device without target dir. Additional info: