Bug 280615

Summary: emulators/qemu qemu-ga will not launch thaw operation after freeze on guests
Product: Ports & Packages Reporter: Orsiris de Jong <ozy>
Component: Individual Port(s)Assignee: Muhammad Moinur Rahman <bofh>
Status: New ---    
Severity: Affects Many People CC: freebsd
Priority: --- Flags: bugzilla: maintainer-feedback? (bofh)
Version: Latest   
Hardware: Any   
OS: Any   

Description Orsiris de Jong 2024-08-04 16:14:42 UTC
I have multiple FreeBSD VMs running on linux KVM hosts.

I'm trying to make a fsfreeze-hook script on a FreeBSD VM to have quiescing when backing up on KVM hosts.
I've noticed that guest's qemu-ga will launch the fsfreeze-hook with freeze argument, but won't run it again with thaw argument until a new snapshot is made, hence rendering the script useless.

Steps to reproduce the behavior, on the FreeBSD guest:


1. Create the following file in /etc/qemu/fsfreeze-hook

#!/bin/sh

case "$1" in
        "freeze")
                echo "FREEZE" >> /tmp/fsfreze
                ;;
        "thaw")
                echo "THAW" >> /tmp/fsfreze
                ;;
esac

2. Make the file executable
3. Run qemu-ga manually and specify the path to the script, eg run /usr/bin/qemu-ga -F/etc/qemu/fsfreeze-hook -d -v -l /var/log/qemu-ga.log
4. On the KVM host, run virsh snapshot-create <domain> --disk-only --atomic --quiesce
5. On guest, look into file /tmp/fsfreeze, it will contain FREEZE. So the freeze operation  has run, but no thaw operation has been requested.
6. Run the snapshot command again on KVM host
7. libvirt will complain with error: internal error: unable to execute QEMU agent command 'guest-fsfreeze-freeze': filesystems have already frozen
8. On guest, look into file tmp/fsfreeze, it will contain
FREEZE
FREEZE
THAW


Expected behavior
At the end of the snapshot process, qemu-ga should call fsfreeze-hook script with 'thaw' argument.
But it runs it only on second (failed) attempt.

Running the freeze/thaw hooks on other guests work.

Environment:

Host: Almalinux 9.4 on intel x64 with qemu-kvm 8.2.0-11 and libvirt-daemon-kvm 10.0.0-6.6
Guest: FreeBSD 14.1-RELEASE-p2 with qemu-ga 9.0.1