jpmorrison / OSX-Qemu

1 stars 0 forks source link

Qemu Guest Agent #6

Open jpmorrison opened 3 years ago

jpmorrison commented 3 years ago

Apple: AppleQEMUGuestAgent starts automatically in Catalina - probably others. Guessing that +hypervisor is a trigger.

Look for '/usr/libexec/AppleQEMUGuestAgent' to see if it's included.

Issue: /var/log/guestagent.log fills with errors if /dev/tty.org.qemu.guest_agent.0 isn't mapped.

Windows/Linux: these guests can use the device too. Install on guest OS if it's not already loaded.

Fix:

Add a virtio serial port with the name org.qemu.guest_agent.0. With docker, -chardev socket,telnet=on,host=0.0.0.0,port=XXX,server=on might be easier

-chardev socket,path=/tmp/qga.sock,server=on,wait=off,id=qga0 \
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 

Example:

$ socat  unix-connect:/tmp/qga.sock -
{"execute": "guest-info"}
{"return":{"version":"1.3-AppleVirtIO-16.140.6~70 (JazzSecuritySky tools)","supported_commands":[{"enabled":true,"name":"guest-exec","success-response":true},{"enabled":true,"name":"guest-exec-status","success-response":true},{"enabled":true,"name":"guest-info","success-response":true},{"enabled":true,"name":"guest-sync","success-response":true},{"enabled":true,"name":"guest-sync-delimited","success-response":true},{"enabled":true,"name":"guest-ping","success-response":true},{"enabled":true,"name":"guest-file-open","success-response":true},{"enabled":true,"name":"guest-file-close","success-response":true},{"enabled":true,"name":"guest-file-read","success-response":true},{"enabled":true,"name":"guest-file-write","success-response":true},{"enabled":true,"name":"guest-file-seek","success-response":true},{"enabled":true,"name":"guest-file-flush","success-response":true},{"enabled":true,"name":"guest-network-get-interfaces","success-response":true},{"enabled":true,"name":"guest-shutdown","success-response":true},{"enabled":true,"name":"apple-guest-set-remote-login","success-response":true}]}}
jpmorrison commented 3 years ago

{"execute": "guest-shutdown"}