FreeBSD用のQEMUゲストエージェントのGitHubに書いてある通りに進めるだけ。
現状、Portsは存在しないようなので、zipを取ってきて展開する。
2021年3月16日にemulators/qemu-gueat-agentとしてports化された。
$ fetch https://github.com/aborche/qemu-guest-agent/archive/master.zip $ tar -xvf master.zip
PortsのQEMUのMakefileにパッチを充てる。上記のゲストエージェントは、portsに対するパッチ集となっており、portsを間借りする形で作られるようだ。
$ cd /usr/ports/emulators/qemu
# echo '--- Makefile.orig 2018-10-27 17:23:47.760934000 +0300
+++ Makefile 2018-10-27 17:10:31.140104000 +0300
@@ -23,7 +23,7 @@
USES?= cpe gmake pkgconfig bison perl5 python:2.7,build tar:bzip2
USE_PERL5= build
MAKE_ENV+= BSD_MAKE="${MAKE}" V=1
-.if !defined(PKGNAMESUFFIX) || ${PKGNAMESUFFIX} != "-utils"
+.if !defined(PKGNAMESUFFIX) || (${PKGNAMESUFFIX} != "-utils" && ${PKGNAMESUFFIX} != "-guest-agent")
USE_XORG= pixman
USE_GNOME+= cairo glib20 libxml2
ONLY_FOR_ARCHS= amd64 i386 powerpc powerpc64' | patch
ゲストエージェントの展開場所に戻ってmakeする。
$ cd /path/to/qemu-guest-agent
# make && make install
(略)
===> Installing for qemu-guest-agent-5.0.1
===> Checking if qemu-guest-agent is already installed
===> Registering installation for qemu-guest-agent-5.0.1
Installing qemu-guest-agent-5.0.1...
=======================================================
Modify your `/etc/rc.conf` by adding these settings
qemu_guest_agent_enable="YES"
qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"
and run
# service qemu-guest-agent start
For detailed help use `qemu-ga -h`
=======================================================
===> SECURITY REPORT:
This port has installed the following files which may act as network
servers and may therefore pose a remote security risk to the system.
/usr/local/bin/qemu-ga
If there are vulnerabilities in these programs there may be a security
risk to the system. FreeBSD makes no guarantee about the security of
ports included in the Ports Collection. Please type 'make deinstall'
to deinstall the port if this is a concern.
For more information, and contact details about the security
status of this software, see the following webpage:
http://wiki.qemu.org/Main_Page
インストールはPackagesの作法に則った形で行われるっぽい。
動作にはvirtio_consoleが必要なので設定する。
# echo 'virtio_console_load="YES"' >> /boot/loader.conf # kldload virtio_console
カーネルモジュールを読み込むと/dev/vtcon/が生えてくるはずだが、もしなければ、VMホスト側のQEMUエージェントタイプがvirtioになっているか確認する。
続いてゲストエージェントの設定&実行。
以下の2行を/etc/rc.confに追加。
qemu_guest_agent_enable="YES" qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"
からのゲストエージェントを起動。
# service qemu-guest-agent start
Proxmox VEの仮想マシンのサマリーで、VMのIPアドレスが表示されればゲストエージェントが問題なく動いていると分かる。
素のKVM環境ならvirshとか使えばいいんじゃないかな?