10 月 072022
错误提示
Guest agent is not responding: QEMU guest agent is not connected CODE_FILE ../src/qemu/qemu_domain.c CODE_FUNC qemuDomainAgentAvailable CODE_LINE 8526 LIBVIRT_CODE 86 LIBVIRT_DOMAIN 10 LIBVIRT_SOURCE util.error PRIORITY 3 SYSLOG_FACILITY 3 _BOOT_ID e8d41ada1ec94052900e15bd6cabd727 _CAP_EFFECTIVE 1ffffffffff _CMDLINE /usr/sbin/virtqemud --timeout 120 _COMM virtqemud _EXE /usr/sbin/virtqemud _GID 0 _HOSTNAME localhost.localdomain _MACHINE_ID 760e98b720374a9087311a1aea584dc6 _PID 4865 _RUNTIME_SCOPE system _SELINUX_CONTEXT kernel _SOURCE_REALTIME_TIMESTAMP 1700126716143085 _SYSTEMD_CGROUP /system.slice/virtqemud.service _SYSTEMD_INVOCATION_ID d8c1cb44eba54d2788eb6492ef418a46 _SYSTEMD_SLICE system.slice _SYSTEMD_UNIT virtqemud.service _TRANSPORT journal _UID 0 __CURSOR s=3e22457506824768ad4f57aee3165252;i=ed1;b=e8d41ada1ec94052900e15bd6cabd727;m=13f550484;t=60a4198fd2603;x=5ee0a5b5940edc90 __MONOTONIC_TIMESTAMP 5357503620 __REALTIME_TIMESTAMP 1700126716143107
虚拟机安装代理客户端
[ops@localhost ~]$ sudo dnf info qemu-guest-agent Last metadata expiration check: 0:00:15 ago on Thu 16 Nov 2023 05:34:49 PM HKT. Available Packages Name : qemu-guest-agent Epoch : 17 Version : 7.2.0 Release : 14.el9_2.5 Architecture : x86_64 Size : 446 k Source : qemu-kvm-7.2.0-14.el9_2.5.src.rpm Repository : appstream Summary : QEMU guest agent URL : http://www.qemu.org/ License : GPLv2 and GPLv2+ and CC-BY Description : qemu-kvm is an open source virtualizer that provides hardware emulation for : the KVM hypervisor. : : This package provides an agent to run inside guests, which communicates : with the host over a virtio-serial channel named "org.qemu.guest_agent.0" : : This package does not need to be installed on the host OS. [ops@localhost ~]$
[ops@localhost ~]$ sudo dnf install qemu-guest-agent Last metadata expiration check: 0:02:19 ago on Thu 16 Nov 2023 05:34:49 PM HKT. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: qemu-guest-agent x86_64 17:7.2.0-14.el9_2.5 appstream 446 k Transaction Summary ================================================================================ Install 1 Package Total download size: 446 k Installed size: 1.8 M Is this ok [y/N]:
服务注册
[ops@localhost ~]$ sudo systemctl enable qemu-guest-agent Unit /usr/lib/systemd/system/qemu-guest-agent.service is added as a dependency to a non-existent unit dev-virtio\x2dports-org.qemu.guest_agent.0.device. [ops@localhost ~]$ sudo systemctl start qemu-guest-agent [ops@localhost ~]$ sudo systemctl status qemu-guest-agent ● qemu-guest-agent.service - QEMU Guest Agent Loaded: loaded (/usr/lib/systemd/system/qemu-guest-agent.service; enabled;> Active: active (running) since Thu 2023-11-16 17:41:24 HKT; 10s ago Main PID: 14117 (qemu-ga) Tasks: 2 (limit: 7887) Memory: 2.4M CPU: 9ms CGroup: /system.slice/qemu-guest-agent.service └─14117 /usr/bin/qemu-ga --method=virtio-serial --path=/dev/virtio> Nov 16 17:41:24 localhost.localdomain systemd[1]: Started QEMU Guest Agent. [ops@localhost ~]$
在主机上验证可用性
[ops@localhost ~]$ sudo virsh qemu-agent-command 1stvm '{"execute":"guest-info"}' [sudo] password for ops: {"return":{"version":"7.2.0","supported_commands":[{"enabled":true,"name":"guest-get-cpustats","success-response":true},{"enabled":true,"name":"guest-get-diskstats","success-response":true},{"enabled":true,"name":"guest-ssh-remove-authorized-keys","success-response":true},{"enabled":true,"name":"guest-ssh-add-authorized-keys","success-response":true},{"enabled":true,"name":"guest-ssh-get-authorized-keys","success-response":true},{"enabled":false,"name":"guest-get-devices","success-response":true},{"enabled":true,"name":"guest-get-osinfo","success-response":true},{"enabled":true,"name":"guest-get-timezone","success-response":true},{"enabled":true,"name":"guest-get-users","success-response":true},{"enabled":true,"name":"guest-get-host-name","success-response":true},{"enabled":false,"name":"guest-exec","success-response":true},{"enabled":false,"name":"guest-exec-status","success-response":true},{"enabled":true,"name":"guest-get-memory-block-info","success-response":true},{"enabled":true,"name":"guest-set-memory-blocks","success-response":true},{"enabled":true,"name":"guest-get-memory-blocks","success-response":true},{"enabled":true,"name":"guest-set-user-password","success-response":true},{"enabled":true,"name":"guest-get-fsinfo","success-response":true},{"enabled":true,"name":"guest-get-disks","success-response":true},{"enabled":true,"name":"guest-set-vcpus","success-response":true},{"enabled":true,"name":"guest-get-vcpus","success-response":true},{"enabled":true,"name":"guest-network-get-interfaces","success-response":true},{"enabled":true,"name":"guest-suspend-hybrid","success-response":false},{"enabled":true,"name":"guest-suspend-ram","success-response":false},{"enabled":true,"name":"guest-suspend-disk","success-response":false},{"enabled":true,"name":"guest-fstrim","success-response":true},{"enabled":true,"name":"guest-fsfreeze-thaw","success-response":true},{"enabled":true,"name":"guest-fsfreeze-freeze-list","success-response":true},{"enabled":true,"name":"guest-fsfreeze-freeze","success-response":true},{"enabled":true,"name":"guest-fsfreeze-status","success-response":true},{"enabled":false,"name":"guest-file-flush","success-response":true},{"enabled":false,"name":"guest-file-seek","success-response":true},{"enabled":false,"name":"guest-file-write","success-response":true},{"enabled":false,"name":"guest-file-read","success-response":true},{"enabled":false,"name":"guest-file-close","success-response":true},{"enabled":false,"name":"guest-file-open","success-response":true},{"enabled":true,"name":"guest-shutdown","success-response":false},{"enabled":true,"name":"guest-info","success-response":true},{"enabled":true,"name":"guest-set-time","success-response":true},{"enabled":true,"name":"guest-get-time","success-response":true},{"enabled":true,"name":"guest-ping","success-response":true},{"enabled":true,"name":"guest-sync","success-response":true},{"enabled":true,"name":"guest-sync-delimited","success-response":true}]}} [ops@localhost ~]$