device: 0.874 performance: 0.849 hypervisor: 0.835 semantic: 0.814 architecture: 0.798 socket: 0.781 graphic: 0.756 x86: 0.738 virtual: 0.726 network: 0.694 ppc: 0.667 files: 0.628 risc-v: 0.614 boot: 0.604 VMM: 0.604 PID: 0.598 kernel: 0.597 arm: 0.589 register: 0.547 vnc: 0.500 KVM: 0.487 i386: 0.483 permissions: 0.467 peripherals: 0.466 TCG: 0.426 mistranslation: 0.406 user-level: 0.380 debug: 0.342 assembly: 0.311 LXD with QEMU 6.2.0 (and 7.0.0-rc3) breaks during stateful migration Description of problem: Steps to reproduce: ``` sudo snap install --lxd sudo lxd init --auto lxc init images:ubuntu/20.04/cloud v1 --vm Creating v1 lxc config device override v1 root size.state=2GiB Device root overridden for v1 lxc config set v1 migration.stateful=true lxc start v1 sleep 10 lxc exec v1 -- uptime 22:05:54 up 0 min, 0 users, load average: 0.07, 0.02, 0.00 lxc snapshot v1 --stateful Error: Migration call failed lxc snapshot v1 --stateful Error: Monitor is disconnected ``` The first attempt at `lxc snapshot v1 --stateful` caused this in the `lxc info v1 --show-log` log output: ``` qemu-system-x86_64: qemu_savevm_state_complete_precopy_non_iterable: bdrv_inactivate_all() failed (-1) ``` The second attempt caused this: ``` qemu-system-x86_64: ../block.c:6757: bdrv_inactivate_recurse: Assertion `!(bs->open_flags & BDRV_O_INACTIVE)' failed. ``` Which crashed QEMU completely and caused the VM to die. Nothing relevant showed up in dmesg, so this wasn't caused by an obvious seccomp or apparmor policy issue. Additional information: Originally reported by Stephane Graber at https://github.com/lxc/lxd/issues/9875