Proxmox VE Qemu-guest-agent

Qemu-Guest-Agent是一个辅助守护程序,安装在虚拟机中。 它用于在主机和虚拟机之间交换信息,并在虚拟机中执行命令。

在proxmox ve中,Qemu-Guest-agent主要用于两件事:
1.正确关闭虚拟机,而不是依靠ACPI命令或Windows策略
2.要在备份时冻结访客文件系

安装

Host

You have to install guest-agent in each VM and then enable it, you can do that in the Proxmox VE Webinterface (GUI)QEMU Guest Agent Option

or via CLI: qm set VMID --agent 1

Guest

Linux

On Linux you have to simply install the qemu-guest-agent, please refer to the documentation of your system.

We show here the commands for Debian/Ubuntu and Redhat based systems:

on Debian/Ubuntu based systems (with apt-get) run:

apt-get install qemu-guest-agent

and on Redhat based systems (with yum):

yum install qemu-guest-agent

Depending on the distribution, the guest agent might not start automatically after the installation.

Start it either directly with

systemctl start qemu-guest-agent

(should work for most distributions) or reboot the guest.

Windows

Screen-vioserial-device-manager.png

Screen-vioserial-driver.png

First you have to download the virtio-win driver iso (see Windows VirtIO Drivers).

Then install the virtio-serial driver:

  1. Attach the ISO to your windows VM (virtio-*.iso)
  2. Go to the windows Device Manager
  3. Look for “PCI Simple Communications Controller”
  4. Right Click -> Update Driver and select on the mounted iso in DRIVE:\vioserial\<OSVERSION>\ where <OSVERSION> is your Windows Version (e.g. 2k12R2 for Windows 2012 R2)

After that, you have to install the qemu-guest-agent:

  1. Go to the mounted ISO in explorer
  2. The guest agent installer is in the directory guest-agent
  3. Execute the installer with double click (either qemu-ga-x86_64.msi (64-bit) or qemu-ga-i386.msi (32-bit)

After that the qemu-guest-agent should be up and running. You can validate this in the list of Window Services, or in a PowerShell with:

PS C:\Users\Administrator> Get-Service QEMU-GA

Status   Name               DisplayName
------   ----               -----------
Running  QEMU-GA            QEMU Guest Agent

If it is not running, you can use the Services control panel to start it and make sure that it will start automatically on the next boot.

Testing that the communication with the guest agent is working

The communication with the guest agent takes place over a unix socket located in /var/run/qemu-server/<my_vmid>.qga You can test the communication qm agent:

qm agent <vmid> ping

if the qemu-guest-agent is correctly runnning in the VM, it will return without an error message.

See Also

http://wiki.qemu.org/Features/GuestAgent

命令 qm agent <vmid> <cmd> 
此外还有qm guest
qm agent就是qm guest cmd
qm guest主要有下面四个
qm guest cmd
qm guest exec
qm guest exec-status
qm guest passwd

 

另外一篇中文博客也有详细说明

https://foxi.buduanwang.vip/vdi/530.html/

赞 (0)

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址