[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Open qcow2 on multiple hosts simultaneously.
From: |
kvaps |
Subject: |
Re: Open qcow2 on multiple hosts simultaneously. |
Date: |
Wed, 21 Jun 2023 14:16:30 +0200 |
> QCOW2 caches two forms of data, cluster metadata (L1/L2 data, refcount
> table, etc) and mutable header information (file size, snapshot
> entries, etc). This data is discarded after the last piece of incoming
> migration data is received but before the guest starts, hence QCOW2
> images are safe to use with migration.
> QEMU's qcow2 implementation only supports one writer. Live migration is
> a slight exception, it takes care that only one host writes at any given
> time and also drops caches to avoid stale metadata during migration.
I just found that using 'cache.direct=true' makes active devices
synchronized on both hosts.
However it reduces the performance of the disk subsystem by half.
QEMU Storage Daemon QMP Reference Manual says:
> direct: boolean (optional)
> enables use of O_DIRECT (bypass the host page cache; default: false)
According to this description and the description for another option:
> drop-cache: boolean (optional) (If: CONFIG_LINUX)
> invalidate page cache during live migration. This prevents stale data on
> the migration destination with cache.direct=off.
I can make an assumption that when cache.direct is enabled, it should
be safe to use the device in ReadWriteMany from both nodes.
If so, then I just need to enable this option only on time when the
device requires to be attached on more than one host. (eg. while
live-migrating)
Can anyone confirm my assumption?
Best Regards,
Andrei Kvapil