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

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

Il 30/08/2013 00:57, Oskari Saarenmaa ha scritto:
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.
It certainly looks useful to me! Paolo

On Fri, Aug 30, 2013 at 01:57:52AM +0300, Oskari Saarenmaa wrote:
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.
I'd certainly love to see this added in libvirt. I'm really not sure about the question fo using an existing pool vs a new pool type. I'll have to play around with your code to understand it a bit better to make a recommednation.
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.
Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (3)
-
Daniel P. Berrange
-
Oskari Saarenmaa
-
Paolo Bonzini