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
The same problem still happens on FreeBSD 14.1-RELEASE-p6 with qemu-ga 9.1.1. Running the fsfreeze-hook script does only run the freeze command, not the thaw, until the second run. Any chance someone can confirm this bug ? Thanks.
Moved to newer guests: Guest: FreeBSD 14.2-RELEASE-p3 stable/25.1-n269825-cbaf3aa6b26b SMP amd64 with Guest agent version 10.0.2 Host: AlmaLinux 10 with qemu-kvm-core-9.1.0-15.el10.alma.1.x86_64 The problem still persists. When running a freeze request: On host: ``` virsh domfsfreeze myfreebsd.local Froze 0 filesystem(s) ``` On guest FreeBSD: ``` # qemu-ga -v 1751638476.246589: debug: Guest agent version 10.0.2 started 1751639176.131446: debug: read data, count: 59, data: {"execute":"guest-sync", "arguments":{"id":1751639177116}} 1751639176.132034: debug: process_event: called 1751639176.132501: debug: processing command 1751639176.132545: debug: sending data, count: 26 1751639176.133560: debug: read data, count: 36, data: {"execute":"guest-fsfreeze-freeze"} 1751639176.140080: debug: process_event: called 1751639176.140091: debug: processing command 1751639176.140547: warning: disabling logging due to filesystem freeze 1751639176.145020: debug: disabling command: guest-get-time 1751639176.146596: debug: disabling command: guest-set-time 1751639176.146601: debug: disabling command: guest-shutdown 1751639176.146604: debug: disabling command: guest-file-open 1751639176.146606: debug: disabling command: guest-file-close 1751639176.146609: debug: disabling command: guest-file-read 1751639176.146611: debug: disabling command: guest-file-write 1751639176.146614: debug: disabling command: guest-file-seek 1751639176.146616: debug: disabling command: guest-file-flush 1751639176.146619: debug: disabling command: guest-fsfreeze-freeze 1751639176.146854: debug: disabling command: guest-fsfreeze-freeze-list 1751639176.146857: debug: disabling command: guest-network-get-interfaces 1751639176.146860: debug: disabling command: guest-set-user-password 1751639176.146863: debug: disabling command: guest-exec-status 1751639176.146865: debug: disabling command: guest-exec 1751639176.146867: debug: disabling command: guest-get-host-name 1751639176.146870: debug: disabling command: guest-get-users 1751639176.146880: debug: disabling command: guest-get-timezone 1751639176.147109: debug: disabling command: guest-get-osinfo 1751639176.147112: debug: disabling command: guest-ssh-get-authorized-keys 1751639176.147115: debug: disabling command: guest-ssh-add-authorized-keys 1751639176.147117: debug: disabling command: guest-ssh-remove-authorized-keys 1751639176.147120: debug: disabling command: guest-get-load 1751639176.147137: warning: logging re-enabled due to filesystem unfreeze 1751639176.147405: debug: enabling command: guest-get-time 1751639176.179069: debug: enabling command: guest-set-time 1751639176.179078: debug: enabling command: guest-shutdown 1751639176.179082: debug: enabling command: guest-file-open 1751639176.179086: debug: enabling command: guest-file-close 1751639176.179374: debug: enabling command: guest-file-read 1751639176.179378: debug: enabling command: guest-file-write 1751639176.179382: debug: enabling command: guest-file-seek 1751639176.179386: debug: enabling command: guest-file-flush 1751639176.179390: debug: enabling command: guest-fsfreeze-freeze 1751639176.179395: debug: enabling command: guest-fsfreeze-freeze-list 1751639176.179399: debug: enabling command: guest-network-get-interfaces 1751639176.179694: debug: enabling command: guest-set-user-password 1751639176.179698: debug: enabling command: guest-exec-status 1751639176.179702: debug: enabling command: guest-exec 1751639176.179706: debug: enabling command: guest-get-host-name 1751639176.179710: debug: enabling command: guest-get-users 1751639176.179714: debug: enabling command: guest-get-timezone 1751639176.180018: debug: enabling command: guest-get-osinfo 1751639176.180024: debug: enabling command: guest-ssh-get-authorized-keys 1751639176.180027: debug: enabling command: guest-ssh-add-authorized-keys 1751639176.180031: debug: enabling command: guest-ssh-remove-authorized-keys 1751639176.180034: debug: enabling command: guest-get-load 1751639176.180048: debug: sending data, count: 14 ``` Thaw op: On host: ``` virsh domfsthaw myfreebsd.local Thawed 0 filesystem(s) ``` On guest: ``` 1751639243.743626: debug: read data, count: 34, data: {"execute":"guest-fsfreeze-thaw"} 1751639243.744081: debug: process_event: called 1751639243.744087: debug: processing command 1751639243.744168: debug: sending data, count: 14 ``` From the above, it looks like the thaw operation is just not launched by libvirt since it considered it never froze the filesystem. Running a snapshot with `--quiesce --disk-only` sill leaves the system in "frozen state". I have no idea if the problem comes from qemu-ga in FreeBSD or libvirt's way of managing the thaw command if no fs has been frozen. For now, I am able to do the following to get coherent snasphots on FreeBSD: On host: ``` virsh snapshot-create myfreebsd.local --quiesce --atomic --disk-only virsh domfsthaw myfreebsd.local ``` Any insight would be appreciated.