qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I expose qemu-guest-agent QMP capabilities to the qmp tcp se


From: Stefano Cappa
Subject: Re: How can I expose qemu-guest-agent QMP capabilities to the qmp tcp server in qemu on the same TCP socket port?
Date: Mon, 12 Jul 2021 08:56:57 +0200

A user on stackoverflow answered me that "proxying" is not implemented (https://stackoverflow.com/questions/68162860/how-can-i-expose-qemu-guest-agent-qmp-capabilities-to-the-qmp-tcp-server-in-qemu), so I ask here for a confirmation:
Is exposing 2 tcp ports the only way to communicate via TCP socket with qemu and guest agent via qmp?

qga_proxy is not implemented, but is there another way to do this proxying?


Il giorno dom 4 lug 2021 alle ore 14:53 Stefano Cappa <stefano.cappa.ks89@gmail.com> ha scritto:
Hi,
I already posted this question on stackoverflow https://stackoverflow.com/questions/68162860/how-can-i-expose-qemu-guest-agent-qmp-capabilities-to-the-qmp-tcp-server-in-qemu but I didn't receive any answer.
I re-post the question here with some news.

I'm using qemu-system-x86_64 to run a vm exposing QMP commands via TCP connection in this way:

qemu-system-x86_64 \
-smp 4 -m 4096 \
-vga std \
-display vnc=:0 \
-netdev user,id=n0 \
-device e1000,netdev=n0 \
-usb -device usb-tablet \
-qmp tcp:localhost:8124,server,nowait \
-k en-us \
-boot d \
-hda /filesystem/filesystem.img
Everything is ok, because I can send QMP commands to qemu locally via TCP socket connection on port 8124.

Then I installed qemu-guest-agent on the vm (Ubuntu 21.04 desktop) and I created the virtio ports required by the quemu-guest-agent service in this way:

qemu-system-x86_64 \
-smp 4 -m 4096 \
-vga std \
-display vnc=:0 \
-netdev user,id=n0 \
-device e1000,netdev=n0 \
-chardev socket,path=/tmp/qga.sock,server,nowait,id=qga0 \
-device virtio-serial \
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \
-usb -device usb-tablet \
-qmp tcp:localhost:8124,server,nowait \
-k en-us \
-boot d \
-hda /filesystem/filesystem.img

quemu-guest-agent systemd service is up and running as expected (obviously on a local socket, not via TCP).

Now I want to see qemu-guest-agent QMP capabilities via TCP socket connection. How can I achieve this?

Based on the official guide(https://wiki.qemu.org/Features/GuestAgent) I have to change chardev in this way -chardev qga_proxy,id=qga0 \ but it's not working. It seems an obsolete info in that guide, because this command is not supported today. It throws error: qemu-system-x86_64: -chardev qga_proxy,id=qga0: 'qga_proxy' is not a valid char driver name

Which is the correct way to expose guest-agent QMP commands through TCP socket?

At the moment, I found this solution:

qemu-system-x86_64 \
-smp 4 -m 4096 \
-vga std \
-display vnc=:0 \
-netdev user,id=n0 \
-device e1000,netdev=n0 \
-chardev socket,id=qga0,port=8125,host:localhost,server,nowait \
-device virtio-serial \
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \
-usb -device usb-tablet \
-qmp tcp:localhost:8124,server,nowait \
-k en-us \
-boot d \
-hda /filesystem/filesystem.img

but it opens 2 different TCP sockets on 2 different ports (8124, 8125). Is there a better way?
"Poxying" guest agent capabilities via the same qmp connection on port 8124 seems the optimal solution in my use case. Is it possibile?

Thank you.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]