]> git.proxmox.com Git - qemu-server.git/commit
migration: avoid crash with heavy IO on local VM disk
authorFiona Ebner <f.ebner@proxmox.com>
Thu, 4 Jul 2024 09:32:11 +0000 (11:32 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 30 Jul 2024 19:19:51 +0000 (21:19 +0200)
commit60e1b142fb3a6b4aa9edb8f9386eb9db14bb5d07
tree7c5f63a14e7d834aa00d2c7f82669273026f0f3a
parent7b4fac1275d43a7819d3f051cfb3a1ddb5594ca3
migration: avoid crash with heavy IO on local VM disk

There is a possibility that the drive-mirror job is not yet done when
the migration wants to inactivate the source's blockdrives:

> bdrv_co_write_req_prepare: Assertion `!(bs->open_flags & BDRV_O_INACTIVE)' failed.

This can be prevented by using the 'write-blocking' copy mode (also
called active mode) for the mirror. However, with active mode, the
guest write speed is limited by the synchronous writes to the mirror
target. For this reason, a way to start out in the faster 'background'
mode and later switch to active mode was introduced in QEMU 8.2.

The switch is done once the mirror job for all drives is ready to be
completed to reduce the time spent where guest IO is limited.

The loop waiting for actively-synced to become true is not an endless
loop: Once the remaining dirty parts have been mirrored by the
background iteration, the actively-synced flag will be set. Because
the 'block-job-change' QMP command already succeeded, new writes will
be done synchronously to the target and thus not lead to new dirty
parts. If the job fails or vanishes (shouldn't actually happen,
because auto-dismiss is false), the loop will be exited and the error
propagated.

Reported rarely, but steadily over the years:
https://forum.proxmox.com/threads/78954/post-353651
https://forum.proxmox.com/threads/78954/post-380015
https://forum.proxmox.com/threads/100020/post-431660
https://forum.proxmox.com/threads/111831/post-482425
https://forum.proxmox.com/threads/111831/post-499807
https://forum.proxmox.com/threads/137849/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
PVE/QemuMigrate.pm
PVE/QemuServer.pm
test/MigrationTest/QemuMigrateMock.pm