[libvirt] RFC: btrfs storage pool using subvolumes & snapshots

Oskari Saarenmaa os at ohmu.fi
Thu Aug 29 22:57:52 UTC 2013


I wrote an experimental btrfs storage pool which uses subvolumes (and
optionally snapshots) as storage volumes in LXC domains.  The code is
available at https://github.com/saaros/libvirt/compare/btrfs-storage but
it's still missing some features like quotas for the subvolumes
(currently the capacity definition for volumes is ignored) and doesn't
have any documentation so far.

Sample usage:
  mkdir /virtual; mkfs.btrfs /dev/vdb; mount -t btrfs /dev/vdb /virtual
  virsh pool-create-as testpool btrfs --target /virtual
  virsh vol-create-as testpool vanilla 0
  echo vanilla > /virtual/vanilla/test
  virsh vol-create-as testpool test 0 --backing-vol vanilla
  cat /virtual/test/test
  btrfs subvolume list /virtual

Does this look like a useful feature and does it make sense to implement
it as a new storage pool type, or should it be merged into an existing
one?  I looked at the existing ones and couldn't really figure out how
to make it fit nicely in any of them.

As far as I could tell none of the existing storage pools or volumes
offered a way to create a new copy-on-write volume for easy use in LXC
domains using the libvirt API.  With the new btrfs pool I was able to
replace KVM domains using qcow2 volumes with LXC + btrfs with very
little changes to the application code.

Cheers,
Oskari




More information about the libvir-list mailing list