Bug 1452441
| Summary: | Libvirt doesn't bind to specified port when attach rng device of udp type without host attribute | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Fangge Jin <fjin> |
| Component: | libvirt | Assignee: | Ján Tomko <jtomko> |
| Status: | CLOSED ERRATA | QA Contact: | Yanqiu Zhang <yanqzhan> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.4 | CC: | dyuan, jtomko, rbalakri, xuzhang, yanqzhan, zpeng |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-3.7.0-1.el7 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-04-10 10:44:33 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: | |||
A similar problem that may have been fixed in the same upstream patch: 1. # cat rng.xml <rng model='virtio'> <backend model='egd' type='udp'> <source mode='bind' host='127.0.0.1' /> <source mode='connect' host='127.0.0.1' service='1234'/> </backend> </rng> Hot plug rng device: # virsh attach-device V egd-udp-bind.xml error: Failed to attach device from egd-udp-bind.xml error: internal error: argument key 'port' must not have null value 2. virsh edit a guest with same rng device: # virsh edit rhel7.4 <rng model='virtio'> <backend model='egd' type='udp'> <source mode='bind' host='127.0.0.1' /> <source mode='connect' host='127.0.0.1' service='1234'/> </backend> </rng> Start guest: # virsh start rhel7.4 UDP binds to 127.0.0.1:34705 $ netstat -tunap|grep 1234 udp 0 0 127.0.0.1:34705 127.0.0.1:1234 ESTABLISHED - commit 2277edb964731b7b2f80c371148f01848a03eacf
Author: Ján Tomko <jtomko>
CommitDate: 2017-07-11 15:18:31 +0200
qemu: handle missing bind host/service on chardev hotplug
On domain startup, bind host or bind service can be omitted
and we will format a working command line.
Extend this to hotplug as well and specify the service to QEMU
even if the host is missing.
https://bugzilla.redhat.com/show_bug.cgi?id=1452441
git describe: v3.5.0-64-g2277edb96
Scenario 1: Hotplug - missing host attribute:
Reproduce with libvirt-3.2.0-14.el7_4.2.x86_64.
Steps:
# cat egd-udp-bind.xml
<rng model='virtio'>
<backend model='egd' type='udp'>
<source mode='bind' service='2234'/>
<source mode='connect' host='127.0.0.1' service='1234'/>
</backend>
</rng>
# virsh attach-device V egd-udp-bind.xml
Device attached successfully
# virsh dumpxml V|grep '/rng' -B7
<rng model='virtio'>
<backend model='egd' type='udp'>
<source mode='bind' service='2234'/>
<source mode='connect' host='127.0.0.1' service='1234'/>
</backend>
<alias name='rng0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</rng>
# netstat -tunap|grep 1234
udp 0 0 127.0.0.1:60524 127.0.0.1:1234 ESTABLISHED 24080/qemu-kvm <==Binds to 60524, not the specified 2234.
Verify with libvirt-3.8.0-1.el7.x86_64.
Steps:
# cat egd-udp-bind.xml
<rng model='virtio'>
<backend model='egd' type='udp'>
<source mode='bind' service='2234'/>
<source mode='connect' host='127.0.0.1' service='1234'/>
</backend>
</rng>
# virsh attach-device V egd-udp-bind.xml
Device attached successfully
# virsh dumpxml V|grep '/rng' -B7
<rng model='virtio'>
<backend model='egd' type='udp'>
<source mode='bind' service='2234'/>
<source mode='connect' host='127.0.0.1' service='1234'/>
</backend>
<alias name='rng0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</rng>
# netstat -tunap|grep 1234
udp 0 0 127.0.0.1:2234 127.0.0.1:1234 ESTABLISHED 19616/qemu-kvm <==Successfully binds to the specified 2234.
Scenario 1: Hotplug - missing service attribute:
Reproduce with libvirt-3.2.0-14.el7_4.2.x86_64.
Steps:
# cat rng.xml
<rng model='virtio'>
<backend model='egd' type='udp'>
<source mode='bind' host='127.0.0.1'/>
<source mode='connect' host='127.0.0.1' service='1234'/>
</backend>
</rng>
# virsh attach-device V rng.xml
error: Failed to attach device from rng.xml
error: internal error: argument key 'port' must not have null value
Verify with libvirt-3.8.0-1.el7.x86_64.
Steps:
# cat rng.xml
<rng model='virtio'>
<backend model='egd' type='udp'>
<source mode='bind' host='127.0.0.1'/>
<source mode='connect' host='127.0.0.1' service='1234'/>
</backend>
</rng>
# virsh attach-device V rng.xml
Device attached successfully
# virsh dumpxml V|grep '/rng' -B7
<rng model='virtio'>
<backend model='egd' type='udp'>
<source mode='bind' host='127.0.0.1'/>
<source mode='connect' host='127.0.0.1' service='1234'/>
</backend>
<alias name='rng0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</rng>
# netstat -tunap|grep 1234
udp 0 0 127.0.0.1:53291 127.0.0.1:1234 ESTABLISHED 20107/qemu-kvm <==Can successfully bind to a port
Scenario 3: Edit - missing service attribute:
Reproduce with libvirt-3.2.0-14.el7_4.2.x86_64.
Steps:
# virsh edit V (same as rng.xml)
...
<rng model='virtio'>
<backend model='egd' type='udp'>
<source mode='bind' host='127.0.0.1'/>
<source mode='connect' host='127.0.0.1' service='1234'/>
</backend>
</rng>
...
# virsh dumpxml V|grep '/rng' -B7
<rng model='virtio'>
<backend model='egd' type='udp'>
<source mode='bind'/> <=='host' disappears
<source mode='connect' host='127.0.0.1' service='1234'/>
...
# virsh start V
Domain V started
# virsh dumpxml V|grep '/rng' -B7
<rng model='virtio'>
<backend model='egd' type='udp'>
<source mode='bind'/> <== No 'host'
<source mode='connect' host='127.0.0.1' service='1234'/>
...
# netstat -tunap|grep 1234
udp 0 0 127.0.0.1:56327 127.0.0.1:1234 ESTABLISHED 27931/qemu-kvm
# virsh destroy V
Domain V destroyed
# virsh dumpxml V|grep '/rng' -B7
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</memballoon>
<rng model='virtio'>
<backend model='egd' type='udp'>
<==No "bind" any more
<source mode='connect' host='127.0.0.1' service='1234'/>
...
Verify with libvirt-3.8.0-1.el7.x86_64.
Steps:
# virsh edit V
Domain V XML configuration edited.
# virsh dumpxml V|grep '/rng' -B7
<rng model='virtio'>
<backend model='egd' type='udp'>
<source mode='bind' host='127.0.0.1'/>
<source mode='connect' host='127.0.0.1' service='1234'/>
...
# virsh start V
Domain V started
# virsh dumpxml V|grep '/rng' -B7
<rng model='virtio'>
<backend model='egd' type='udp'>
<source mode='bind' host='127.0.0.1'/>
<source mode='connect' host='127.0.0.1' service='1234'/>
...
# netstat -tunap|grep 1234
udp 0 0 127.0.0.1:42293 127.0.0.1:1234 ESTABLISHED 20353/qemu-kvm
# virsh destroy V
Domain V destroyed
# virsh dumpxml V|grep '/rng' -B7
<rng model='virtio'>
<backend model='egd' type='udp'>
<source mode='bind' host='127.0.0.1'/>
<source mode='connect' host='127.0.0.1' service='1234'/>
...
The 'host' attribute for "bind" mode never disappears.
Since all the results are expected with libvirt-3.8.0-1.el7.x86_64, mark this bug as verified according to comment 5, comment 6 and comment 7. 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://access.redhat.com/errata/RHEA-2018:0704 |
Description of problem: Libvirt doesn't bind to specified port when attach rng device of udp type without host attribute Version-Release number of selected component: libvirt-3.2.0-5.virtcov.el7.x86_64 How reproducible: 100% Steps to Reproduce: 0.Start a guest 1.Prepare a rng file with bind mode: # cat egd-udp-bind.xml <rng model='virtio'> <backend model='egd' type='udp'> <source mode='bind' service='2234'/> ====> No host attribute here <source mode='connect' host='127.0.0.1' service='1234'/> </backend> </rng> 2.Attach the rng device: # virsh attach-device rhel7.4 egd-udp-bind.xml Device attached successfully 3.check bind port: # netstat -tunap|grep 1234 udp 0 0 127.0.0.1:54377 127.0.0.1:1234 ESTABLISHED 10129/qemu-kvm Actual results: In step 3,rng device binds to port 53477 Expected results: In step 3,rng device binds to port 2234 Additional info: 1. Define a guest with same rng device, then start guest, it binds to correct port # virsh dumpxml rhel7 ... <rng model='virtio'> <backend model='egd' type='udp'> <source mode='bind' service='2234'/> <source mode='connect' host='127.0.0.1' service='1234'/> </backend> <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/> </rng> # virsh start rhel7 # netstat -tunap|grep 1234 udp 0 0 127.0.0.1:2234 127.0.0.1:1234 ESTABLISHED 9770/qemu-kvm 2. Hotplug a rng device of udp mode with host attribute for bind mode like below, it also binds to correct port: # cat rng.xml <rng model='virtio'> <backend model='egd' type='udp'> <source mode='bind' host='localhost' service='2234'/> ===> with host attribute <source mode='connect' host='127.0.0.1' service='1234'/> </backend> </rng> # virsh attach-device rhel7 rng.xml # netstat -tunap |grep 1234 udp 0 0 127.0.0.1:2234 127.0.0.1:1234 ESTABLISHED 11326/qemu-kvm