-
Notifications
You must be signed in to change notification settings - Fork 565
Description
Cloud Hypervisor recently merged PR #7494, which switches from whole-file OFD locks to byte-range advisory locks over the full disk size. This change improves compatibility with NetApp storage systems, where whole-file OFD locks are interpreted as mandatory but byte-range locks retain advisory semantics. The implementation also intentionally leaves room for a future configuration knob to select the lock granularity.
Different environments may prefer different lock semantics:
Default (byte-range) works best for storage backends like NetApp, matching QEMU behavior and maintaining advisory-lock semantics.
Whole-file locking might still be desirable for environments that rely on the traditional OFD whole-file lock behavior.
Some users may also want to disable advisory locking entirely or run in warn-only mode (supported today via lock=off|warn|on).
Right now Cloud Hypervisor internally uses byte-range locks for all disks, but users cannot opt back into the previous whole-file behavior if their infrastructure depends on it.
I'd introduce an optional per-disk parameter, for example:
--disk path=/foo.img,lock_granularity=byte-range
--disk path=/bar.img,lock_granularity=full
With the following semantics:
byte-range(default) Locks [0, size) via OFD byte-range locking.fullUses the original whole-file OFD lock (l_start=0, l_len=0).
This would map cleanly to the existing LockGranularity enum introduced in PR #7494 and require only limited plumbing through the config layer down to virtio-devices.
Is that sounds good, I can work on the implementation.