virsh 错误:域已处于静止状态

virsh 错误:域已处于静止状态

我的虚拟机备份脚本在创建快照时失败。

virsh snapshot-create-as --domain machine_1 snap --diskspec vda,file=/srv/test/test-snap.qcow2 --disk-only --atomic --no-metadata --quiesce
error: Requested operation is not valid: domain is already quiesced

即使在虚拟机重新启动后,系统仍然处于静止状态,并且我收到相同的错误。

我以为 quiesce 意味着 FS 冻结,但这毫无意义,因为登录故障虚拟机时我仍然可以写入 FS。而且这在重启后不会消失,对吗?

这可能是一个通信问题,导致主机认为 GA 说机器处于静止状态,但事实并非如此?

无论如何,是否有命令可以查询静止状态(除了尝试快照并查看是否出现错误)?

假设故障虚拟机在发生不可重现的错误后处于静止状态,我可以通过退出静止状态来修复该问题,无论这意味着什么。是否有 virsh 命令可以取消虚拟机的静止状态?

整个备份过程以前可以正常工作,但现在在 2 台虚拟机上失败了,但在另外 2 台虚拟机上仍然可以工作,我想不出它们之间有什么相关区别。

软件版本:

  • 主机是 Debian Jessie,带有从 backports 来的 qemu-kvm 2.8+dfsg-3~bop8+1。
  • 客户机是带有 qemu-guest-agent 2.8+dfsg-6+deb9u4 的 Debian Stretch。

(记录显示,备份脚本是在 GitHub 上。基本上,它所做的是 1/ 创建快照,2/ 复制,3/ 提交快照。)

如果我quiesce从快照命令行中删除该选项,一切就会顺利进行。但显然,这并不理想。

答案1

根本原因是漏洞该问题已在 libvirt 1.2.11 中修复。

上游已修复:

commit 6085d917d5c5839b7ed351e99fadbbb56f5178fe
Author: Michal Privoznik <[email protected]>
Date: Thu Nov 27 11:43:56 2014 +0100

qemu: Don't track quiesced state of FSs

https://bugzilla.redhat.com/show_bug.cgi?id=1160084

As of b6d4dad11b (1.2.5) we are trying to keep the status of FSFreeze
in the guest. Even though I've tried to fixed couple of corner cases
(6ea54769ba18), it occurred to me just recently, that the approach is
broken by design. Firstly, there are many other ways to talk to
qemu-ga (even through libvirt) that filesystems can be thawed (e.g.
qemu-agent-command) without libvirt noticing. Moreover, there are
plenty of ways to thaw filesystems without even qemu-ga noticing (yes,
qemu-ga keeps internal track of FSFreeze status). So, instead of
keeping the track ourselves, or asking qemu-ga for stale state, it's
the best to let qemu-ga deal with that (and possibly let guest kernel
propagate an error).

Moreover, there's one bug with the following approach, if fsfreeze
command failed, we've executed fsthaw subsequently. So issuing
domfsfreeze in virsh gave the following result:

virsh # domfsfreeze gentoo
Froze 1 filesystem(s)

virsh # domfsfreeze gentoo
error: Unable to freeze filesystems
error: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': The command guest-fsfreeze-freeze has been disabled for this instance

virsh # domfsfreeze gentoo
Froze 1 filesystem(s)

virsh # domfsfreeze gentoo
error: Unable to freeze filesystems
error: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': The command guest-fsfreeze-freeze has been disabled for this instance

升级到较新版本可以解决此问题。

相关内容