2 août 2023 14:18:42 Peter Krempa <pkrempa@redhat.com>:
On Tue, Aug 01, 2023 at 12:28:56 +0200, e-m@mailbox.org wrote:
Hi,
I have a block storage which I only want to be mounted on a single node. I
know that there are many possibilities for shared storage usage but I want
to know if the following is possible (using the API).
- Have a domain running on node-A
- Initialize a migration for that domain to node-B
- Run a hook or something just before the domain starts on node-B to:
- unmount storage on node-A
- mount/prepare storage on node-B
This is not possible with qemu, because during migration the process
running the VM exists both on node-A and node-B, and has the storage
open (although not accessing it) from both sides.
At the time the migration is switching over, the source flushes buffers
and the destination starts writing into the image.
This means that the storage must be mounted on both nodes during the
migration.
What you can do though is, to save the VM state into a file and restore
it on the other node. (virsh save, virsh restore). Which uses basically
the same approach as migration, but the VM state is dumped to a file and
preserved, thus you can umount the storage for the necessary time until
it's moved to the next node.