Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1695463 - "Invalid parameter 'pid'" error info shown after execute "guest-exec-status" twice.
Summary: "Invalid parameter 'pid'" error info shown after execute "guest-exec-status" ...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: qemu-kvm
Version: 8.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Marc-Andre Lureau
QA Contact: FuXiangChun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-04-03 07:28 UTC by xiagao
Modified: 2019-04-11 09:06 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-04-09 09:54:23 UTC
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)

Description xiagao 2019-04-03 07:28:04 UTC
Description of problem:
as $subject

Version-Release number of selected component (if applicable):
qemu-guest-agent-2.12.0-63.module+el8+2833+c7d6d092.x86_64

How reproducible:
100%

Steps to Reproduce:
1.boot up rhel8.0 guest with qemu-guest-agaent installed.
2.run guest cmd via qga socket
# nc -U /tmp/helloworld2 
{"execute": "guest-exec", "arguments": {"path": "echo", "arg": ["This", "is", "a", "test."], "capture-output": true}} 
{"return": {"pid": 2622}}
3.check the guest process status via "guest-exec-status"
{"execute": "guest-exec-status", "arguments": {"pid":2622}}
{"return": {"exitcode": 0, "out-data": "VGhpcyBpcyBhIHRlc3QuCg==", "exited": true}}

4.want to check it again.
{"execute": "guest-exec-status", "arguments": {"pid":2622}}
{"error": {"class": "GenericError", "desc": "Invalid parameter 'pid'"}}



Actual results:
It should success for the second check.

Expected results:
{"return": {"exitcode": 0, "out-data": "VGhpcyBpcyBhIHRlc3QuCg==", "exited": true}}

Additional info:
qemu cmd line:
/usr/libexec/qemu-kvm -name test-vm -enable-kvm -m 3G -smp 4,maxcpus=8,sockets=8,cores=1,threads=1 -nodefaults -cpu 'Broadwell',+kvm_pv_unhalt,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time,xsave -rtc base=localtime,driftfix=none -boot order=cd,menu=on -M q35 -vga std -vnc :11 -qmp tcp:0:1234,server,nowait -monitor stdio \

-device pcie-root-port,id=pcie-root-port-6,slot=6,chassis=6,bus=pcie.0  \
-blockdev driver=file,cache.direct=off,cache.no-flush=on,filename=rhel8.0.qcow2,node-name=system_disk_file \
-blockdev driver=qcow2,node-name=system_disk,file=system_disk_file \
-device virtio-blk-pci,bus=pcie-root-port-6,drive=system_disk,id=disk1,werror=stop,rerror=stop,serial=MYDISK-1,bootindex=0 \
        
-device pcie-root-port,id=pcie-root-port-7,slot=7,chassis=7,addr=0x7,bus=pcie.0  \
-device virtio-net-pci,mac=9a:d0:d1:c2:d3:d5,id=net1,vectors=4,netdev=hostnet1,bus=pcie-root-port-7,addr=0x0  \
-netdev tap,id=hostnet1,vhost=on \
-device piix3-usb-uhci,id=usb -device usb-tablet,id=input0 \

-device pcie-root-port,id=pcie-root-port-4,slot=4,chassis=4,addr=0x4,bus=pcie.0  \
-device pcie-root-port,id=pcie-root-port-5,slot=5,chassis=5,addr=0x5,bus=pcie.0  \
-device virtio-serial-pci,id=virtio-serial1,max_ports=31,bus=pcie-root-port-4  \
-chardev socket,id=channel2,path=/tmp/helloworld2,server,nowait  -device virtserialport,bus=virtio-serial1.0,chardev=channel2,name=org.qemu.guest_agent.0 \

Comment 2 Marc-Andre Lureau 2019-04-08 21:05:13 UTC
It is working as expected.

@guest-exec-status:
[...]
"Reap the process and associated metadata if it has exited"

Closing, feel free to reopen if I missed something

Comment 3 xiagao 2019-04-09 03:19:33 UTC
(In reply to Marc-Andre Lureau from comment #2)
> It is working as expected.
> 
> @guest-exec-status:
> [...]
> "Reap the process and associated metadata if it has exited"
> 
> Closing, feel free to reopen if I missed something

I don't think it works as expected, could you explain more? Thanks.


I test it with waiting 60s to check process status. 
step 1, {"execute": "guest-exec", "arguments": {"path": "echo", "arg": ["This", "is", "a", "test."], "capture-output": true}} 
{"return": {"pid": 7925}}

step 2, after 60s. check the status of this process.
{"execute": "guest-exec-status", "arguments": {"pid":7925}}
{"return": {"exitcode": 0, "out-data": "VGhpcyBpcyBhIHRlc3QuCg==", "exited": true}}

step 3, check again.
{"execute": "guest-exec-status", "arguments": {"pid":7925}}
{"error": {"class": "GenericError", "desc": "Invalid parameter 'pid'"}}

Comment 4 xiagao 2019-04-09 05:24:52 UTC
Also hit it in windows guest, I think it's not reasonable that can only get the status once.

{"execute": "guest-exec", "arguments": {"path": "ping", "arg": ["www.redhat.com -t"], "capture-output": true}} 
{"return": {"pid": 3308}}

{"execute": "guest-exec-status", "arguments": {"pid": 3308}}
{"return": {"exitcode": 1, "out-data": "UGluZyByZXF1ZXN0IGNvdWxkIG5vdCBmaW5kIGhvc3Qgd3d3LnJlZGhhdC5jb20gLXQuIFBsZWFzZSBjaGVjayB0aGUgbmFtZSBhbmQgdHJ5IGFnYWluLg0K", "exited": true}}

{"execute": "guest-exec-status", "arguments": {"pid": 3308}}
{"error": {"class": "GenericError", "desc": "Invalid parameter 'pid'"}}

{"execute": "guest-exec-status", "arguments": {"pid": 3308}}
{"error": {"class": "GenericError", "desc": "Invalid parameter 'pid'"}}

{"execute": "guest-exec-status", "arguments": {"pid": 3308}}
{"error": {"class": "GenericError", "desc": "Invalid parameter 'pid'"}}

Comment 5 Marc-Andre Lureau 2019-04-09 06:20:52 UTC
(In reply to xiagao from comment #4)
> Also hit it in windows guest, I think it's not reasonable that can only get
> the status once.
> 

This is working as expected. If the client wants to retrieve the result multiple time, it can as well save it.

If the agent is changed to keep the result around, it will need new commands to clear it later, and new option to peek the result.

I am afraid I lack convincing arguments to propose this kind of changes upstream.

Comment 6 xiagao 2019-04-09 07:35:22 UTC
(In reply to Marc-Andre Lureau from comment #5)
> (In reply to xiagao from comment #4)
> > Also hit it in windows guest, I think it's not reasonable that can only get
> > the status once.
> > 
> 
> This is working as expected. If the client wants to retrieve the result
> multiple time, it can as well save it.
> 
> If the agent is changed to keep the result around, it will need new commands
> to clear it later, and new option to peek the result.
> 
> I am afraid I lack convincing arguments to propose this kind of changes
> upstream.

I still think it's better to retrieve the result multiple time. I have the following scenario.

Issue "ping www.redhat.com -n 10" command, it may need 10s to finish.
If we check the result within 10s with "guest-exec-status", what we get is the not-final result and we can't check the result twice which isn't reasonable.

@xfu, What's your opinion?

Comment 7 Marc-Andre Lureau 2019-04-09 08:07:38 UTC
as long as the process has not exited, you can query status multiple times.

Comment 8 xiagao 2019-04-09 09:54:23 UTC
I see. Thanks for your kind explaination.
close it as not a bug.


Note You need to log in before you can comment on or make changes to this bug.