[libvirt] [PATCH] storage: new backend: btrfs subvolumes
Daniel P. Berrange
berrange at redhat.com
Thu Sep 5 13:57:57 UTC 2013
On Mon, Sep 02, 2013 at 02:48:12PM +0300, Oskari Saarenmaa wrote:
> This commit adds a new storage pool driver, btrfs, which can be used to
> manage btrfs subvolumes on an existing btrfs filesystem. The driver can
> create new blank subvolumes and snapshots of existing subvolumes as well
> as delete existing subvolumes.
>
> The subvolumes created are automatically made visible on the host side
> and can be attached to domains using the <filesystem> tags as defined in
> 'format domain' documentation.
>
> Libvirt volumes do not implement quotas at the moment because the current
> (btrfs-progs-0.20.rc1.20130501git7854c8b-4.fc20.x86_64) support for quota
> management in btrfs-progs is lacking the necessary features, for example
> it's not possible to see the quota assigned to a certain subvolume and
> usage information is only updated on syncfs(2). Quota support will be
> implemented once the tools gain the necessary features.
>
> Signed-off-by: Oskari Saarenmaa <os at ohmu.fi>
You're going to hate me, but having played around with this, I don't
believe it should be a separate pool driver. I think it should be
part of the 'storage_fs.c' driver. The way I see it, a btrfs subvolume
is just a special kind of volume in a directory.
eg given a directory located on btrnfs /foo/bar it is perfectly
valid to want to support
/foo/bar/somedir (plain directory)
/foo/bar/voldir (subvolume directory)
/foo/var/somefile.qcow2 (qcow2 file)
etc.
I'd suggest that we should make it possible to create directories
in the FS storage pool, but supporting use of a new attribute
type='file|network|dir'
on the top level <volume> element.
Then distinguish between plain directories, and those backed by
a subvolme using the <format> element,
So, eg to create a btrfs subvolume use
<volume type='dir'>
<name>wizz</name>
<key>/mnt/btr/wizz</key>
<source>
</source>
<capacity unit='bytes'>0</capacity>
<allocation unit='bytes'>0</allocation>
<target>
<path>/mnt/btr/wizz</path>
<format type='volume'/>
</target>
</volume>
This is a more generic approach that will work if any other FS grow
support for subvolumes like btrfs has.
Regards,
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 :|
More information about the libvir-list
mailing list