On 06/20/2011 04:52 PM, Eric Blake wrote:
> LVM snapshot may become invalid in the case of running out the
volume size,
> So, adding an API for checking whether snapshot is valid will be needed.
I'm not quite sure I follow the scenario you are envisioning here.
Would you mind stepping through an example (mapping [proposed] libvirt
API calls to lvm commands would be helpful), on how an original lvm
partition is created, then a snapshot partition, then how you run out of
volume size in that snapshot? It sounds like you are saying that there
is a way to create an lvm snapshot that is valid at the time that is
created, but later on, subsequent actions cause the snapshot to run out
of space and no longer be valid. But my understanding is that a
snapshot is a constant size (it represents a known state of the disk at
a fixed point in time), only the deltas to that snapshot (aka the live
disk) ever have the potential to grow beyond the amount of storage used
by the snapshot. Or are you worried about creating an lvm snapshot by
libvirt, but then a third party program changes the property of the lvm
snapshot volume to change its size?
Or is it something like the following scenario:
start with 10G lvm partition
create snapshot A to a 10GB partition
make 2G worth of changes
create snapshot B to a 2GB partition
decide to delete snapshot A (merging it back into B)
at that point, the 10G partition for the live file is still adequate,
but now the effort of merging the 10G of data from snapshot into the 2G
of storage reserved for snapshot B will fail, because the partition for
B is not large enough.
But I still don't see how that needs a new API; it seems like this would
be a case of making the 'delete A' operation fail rather than a case of
silently making snapshot B invalid. If the only way to make a snapshot
lvm partition invalid is by making changes to that lvm partition outside
the knowledge of libvirt, then I don't know that libvirt can protect
itself against such 3rd party actions; and if libvirt's own actions can
never cause an invalidation, then what is the point of adding an API to
detect an invalid snapshot? But I'm relatively inexperienced with lvm,
so an example of what you mean will go a long way to help me understand
the scenario you are envisioning.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org