Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add QEMU Guest Agent #6152

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

add QEMU Guest Agent #6152

wants to merge 3 commits into from

Conversation

hgy59
Copy link
Contributor

@hgy59 hgy59 commented Jun 19, 2024

Description

  • initial version of qemu-ga, builds for arch-x64-7.1 only

Fixes #6019

Checklist

  • Build rule all-supported completed successfully
  • New installation of package completed successfully
  • Package upgrade completed successfully (Manually install the package again)
  • Package functionality was tested
  • Any needed documentation is updated/created

Type of change

  • New Package

- initial version, builds for arch-x64-7.1 only
@hgy59
Copy link
Contributor Author

hgy59 commented Jun 19, 2024

@sgelineau17 can you please try, whether this works with proxmox?

@tofuHero
Copy link

this qemu-ga build is not work on my DSM vm.

this is DSM vm setting:
图片

and this vm status:
图片

qemu-ga is installed on this vm:
图片

qemu-ga command output:

root@a300-DS920plus:~# qemu-ga 
1720684752.201439: critical: failed to write persistent state to /var/packages/qemu-ga/var/run/qga.state: Failed to create file “/var/packages/qemu-ga/var/run/qga.state.TI8LQ2”: No such file or directory
1720684752.201478: critical: unable to create state file at path /var/packages/qemu-ga/var/run/qga.state
1720684752.201488: critical: failed to load persistent state
1720684752.201495: critical: error initializing guest agent

@hgy59
Copy link
Contributor Author

hgy59 commented Jul 11, 2024

@tofuHero did you try to add the missing folder /var/packages/qemu/var/run ?

after creating the run folder, I get a different error (not running under qemu/proxmox):

$ sudo qemu-ga
1720716108.104297: critical: error opening channel '/dev/virtio-ports/org.qemu.guest_agent.0': No such file or directory
1720716108.104594: critical: failed to create guest agent channel
1720716108.104675: critical: failed to initialize guest agent channel

@r0bb10
Copy link

r0bb10 commented Jul 11, 2024

@tofuHero did you try to add the missing folder /var/packages/qemu/var/run ?

after creating the run folder, I get a different error (not running under qemu/proxmox):

$ sudo qemu-ga
1720716108.104297: critical: error opening channel '/dev/virtio-ports/org.qemu.guest_agent.0': No such file or directory
1720716108.104594: critical: failed to create guest agent channel
1720716108.104675: critical: failed to initialize guest agent channel

i've done that and also got this error.

@hgy59
Copy link
Contributor Author

hgy59 commented Jul 11, 2024

@r0bb10 I did some analysis on the qemu-ga package of https://spk7.imnks.com/

  1. qemu-ga runs as a service
  2. the service must run as root, so you have to patch the privilege file after installation and each update (to replace package by root) and then restart the package
  3. the package installs the var/run folder
  4. the package includes two kernel modules for console (hvc_console.ko and virtio_console.ko)
  5. before service start:
    • the package loads the console modules on demand with insmod
    • the package creates the virtio-ports device on demand (and binds /dev/vport1p1 to /dev/virtio-ports/org.qemu.guest_agent.0)
    • the package creates the folder /var/local/run on demand

We could clone the functions of the implementation by imnks.com/jim.plus, but I doubt that it will be more stable.

- must run as root, so manual action is required for installation an upgrade
- ensure /dev/virtio-ports/org.qemu.guest_agent.0 exists before service starts
@hgy59
Copy link
Contributor Author

hgy59 commented Jul 13, 2024

@tofuHero, @r0bb10 I did some progress.
On my virtual DSM qemu-ga is running now as service (with manual patch of privilege file and manual service start).

I guess when not running virtual dsm, the kernel module virtio_console.ko is not running and we must include it in the package.

Can you please check with:
lsmod | grep -i virtio_console

on my virtual dsm it shows:

# lsmod | grep -i virtio_console
virtio_console         19522  1
virtio_ring             5789  6 virtio_blk,virtio_net,virtio_pci,virtio_rng,virtio_console,virtio_scsi
virtio                  5698  6 virtio_blk,virtio_net,virtio_pci,virtio_rng,virtio_console,virtio_scsi

@r0bb10
Copy link

r0bb10 commented Jul 13, 2024

@tofuHero, @r0bb10 I did some progress. On my virtual DSM qemu-ga is running now as service (with manual patch of privilege file and manual service start).

I guess when not running virtual dsm, the kernel module virtio_console.ko is not running and we must include it in the package.

Can you please check with: lsmod | grep -i virtio_console

on my virtual dsm it shows:

# lsmod | grep -i virtio_console
virtio_console         19522  1
virtio_ring             5789  6 virtio_blk,virtio_net,virtio_pci,virtio_rng,virtio_console,virtio_scsi
virtio                  5698  6 virtio_blk,virtio_net,virtio_pci,virtio_rng,virtio_console,virtio_scsi

mm installed the latest version Build #6811, done the run-as root, package starts and no error seem obvious

root@vdsm:/volume1/@appstore/qemu-ga/bin# /volume1/@appstore/qemu-ga/bin/qemu-ga -v
1720894497.519524: debug: Guest agent version 9.0.1 started
1720894497.519566: debug: disabling command: guest-get-devices
1720894497.519635: debug: received EOF
1720894497.620480: debug: received EOF
1720894497.721515: debug: received EOF
1720894497.822490: debug: received EOF
1720894497.923571: debug: received EOF
1720894498.024563: debug: received EOF
1720894498.125515: debug: received EOF
1720894498.226596: debug: received EOF
1720894498.327556: debug: received EOF
1720894498.428602: debug: received EOF
1720894498.529475: debug: received EOF
1720894498.630571: debug: received EOF
1720894498.731513: debug: received EOF
1720894498.832537: debug: received EOF
1720894498.933481: debug: received EOF
1720894499.034596: debug: received EOF

and

root@vdsm:/volume1/@appstore/qemu-ga/bin# lsmod | grep -i virtio_console
virtio_console         19522  1
virtio_ring             5789  6 virtio_blk,virtio_net,virtio_pci,virtio_rng,virtio_console,virtio_scsi
virtio                  5698  6 virtio_blk,virtio_net,virtio_pci,virtio_rng,virtio_console,virtio_scsi

log file

root@vdsm:/volume1/@appdata/qemu-ga# tail -f qemu-ga.log
Sat Jul 13 20:19:30 CEST 2024
Begin service_prestart
End service_prestart
Starting qemu-ga command /volume1/@appstore/qemu-ga/bin/qemu-ga --daemonize --logfile /volume1/@appdata/qemu-ga/qemu-ga.log --pidfile /volume1/@appdata/qemu-ga/qemu-ga.pid

@hgy59 hgy59 mentioned this pull request Jul 14, 2024
10 tasks
@mreid-tt mreid-tt mentioned this pull request Sep 29, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Qemu Guest Agent for Synology VM on Proxmox
3 participants