[libvirt PATCH 0/4] storage: support controlling COW attribute for pool

Daniel P. Berrangé berrange at redhat.com
Mon Jul 20 17:33:18 UTC 2020

We already support a "nocow" flag for storage volumes, but this requires
extra work by the mgmt app or user when creating images on btrfs. We
want to "do the right thing" out of the box for btrfs.

We achieve this by changint the storage pool code so that when creating
a storage pool we always try to disable COW on btrfs filesystems. We
then add an <cow state="yes|no"/> feature in the pool XML to let apps
override the default logic.

The COW setting on the pool is inherited by any volumes.

The main thing not solved here is that the default directory at
/var/lib/libvirt/images is created by the RPM itself, not by a
normal "pool-build" command.

Fortunately it appears that virt-install  will explicitly invoke a
storage pool build even if the directory already exists.

Daniel P. Berrangé (4):
  util: add a helper method for controlling the COW flag on btrfs
  storage: convert to use virFileSetCOW
  storage: attempt to disable COW by default
  conf: add control over COW for storage pool directories

 docs/formatstorage.html.in                   | 25 +++++++
 docs/schemas/storagepool.rng                 | 30 ++++++++
 src/conf/storage_conf.c                      | 49 +++++++++++++
 src/conf/storage_conf.h                      |  8 +++
 src/libvirt_private.syms                     |  1 +
 src/storage/storage_util.c                   | 46 +++++-------
 src/util/virfile.c                           | 76 ++++++++++++++++++++
 src/util/virfile.h                           |  3 +
 tests/storagepoolxml2xmlin/pool-dir-cow.xml  | 10 +++
 tests/storagepoolxml2xmlout/pool-dir-cow.xml | 15 ++++
 tests/storagepoolxml2xmltest.c               |  1 +
 11 files changed, 237 insertions(+), 27 deletions(-)
 create mode 100644 tests/storagepoolxml2xmlin/pool-dir-cow.xml
 create mode 100644 tests/storagepoolxml2xmlout/pool-dir-cow.xml


More information about the libvir-list mailing list