Bug 1001994
Summary: | add QMP/HMP support for the getfd/closefd command | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Sibiao Luo <sluo> |
Component: | qemu-kvm | Assignee: | Luiz Capitulino <lcapitulino> |
Status: | CLOSED WORKSFORME | QA Contact: | Virtualization Bugs <virt-bugs> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 6.5 | CC: | acathrow, bsarathy, chayang, flang, juzhang, lcapitulino, michen, mkenneth, qzhang, virt-maint, xfu |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2013-08-29 03:05:07 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: |
Description
Sibiao Luo
2013-08-28 09:32:44 UTC
What's the problem here? Did you even try to pass a fd to QEMU? You have to have another process to pass QEMU a fd before you can use getfd. Besides, you run getfd in the monitor that got the fd sent to. That is, if you're running HMP then the sending process has to send the fd to the HMP socket; you won't see a fd sent to QMP in HMP. (In reply to Luiz Capitulino from comment #1) > What's the problem here? Did you even try to pass a fd to QEMU? > > You have to have another process to pass QEMU a fd before you can use getfd. > Besides, you run getfd in the monitor that got the fd sent to. That is, if > you're running HMP then the sending process has to send the fd to the HMP > socket; you won't see a fd sent to QMP in HMP. Ok, tried it as your instructor as following, it worked well. host info: # uname -r && rpm -q qemu-kvm 2.6.32-413.el6.x86_64 qemu-kvm-0.12.1.2-2.398.el6.x86_64 Steps and results: 1. Start QEMU with a QMP UDP socket. e.g:...-chardev socket,id=test,path=/tmp/qmp-monitor,server,nowait -mon chardev=test,mode=control 2. Build the attached program and run it, like this: (1) Get the pass-fd.c from : https://bugzilla.redhat.com/show_bug.cgi?id=959308#c27 # cc -Wall -o pass-fd pass-fd.c # touch /tmp/foo.txt # ./pass-fd /tmp/foo.txt /tmp/qmp-monitor sent fd 3 3. Find out QEMU's pid with ps and enter its /proc/*/fd dir, like: # pidof qemu-kvm 18706 # cd /proc/18706/fd 4. Do a ls -la and verify that /tmp/foo.txt is listed. fd]# ls -la ... lrwx------. 1 root root 64 Aug 28 22:48 35 -> /tmp/foo.txt ... 5. Connect to the QMP socket and run: # nc -U /tmp/qmp-monitor {"QMP": {"version": {"qemu": {"micro": 1, "minor": 12, "major": 0}, "package": "(qemu-kvm-0.12.1.2)"}, "capabilities": []}} {"execute":"qmp_capabilities"} {"return": {}} { "execute": "getfd", "arguments": { "fdname": "foo" } } {"return": {}} { "execute": "closefd", "arguments": { "fdname": "foo" } } {"return": {}} 6. Check it: # pidof qemu-kvm 18706 # cd /proc/18706/fd fd]# ls -la ... <------------/tmp/foo.txt was not listed here. Base on above, it works for me now, so close it, thanks for your kindly reminds. Best Regards, sluo |