On 04/30/2014 11:41 AM, Michal Privoznik wrote: > When creating a new volume, it is possible to copy data into it from > another already existing volume (referred to as @origvol). Obviously, > the read-only access to @origvol is required, which is thread safe > (probably not performance-wise though). However, with current code > both @newvol and @origvol are marked as building for the time of > copying data from the @origvol to @newvol. The rationale behind > is to disallow some operations on both @origvol and @newvol, e.g. > vol-wipe, vol-delete, vol-download. > While it makes sense to not allow > such operations on partly copied mirror, but it doesn't make sense to > disallow the operations on the source (@origvol). This reads like you're talking about the operations listed above, but you only allow vol-clone on the source. > > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> > --- > > Diff to v1: > -introduced a counter in addition to not marking origvol as building > > src/conf/storage_conf.h | 1 + > src/storage/storage_driver.c | 14 +++++++------- > 2 files changed, 8 insertions(+), 7 deletions(-) > > diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c > index 2cb8347..a953dfd 100644 > --- a/src/storage/storage_driver.c > +++ b/src/storage/storage_driver.c > @@ -1640,7 +1640,7 @@ storageVolDelete(virStorageVolPtr obj, > if (virStorageVolDeleteEnsureACL(obj->conn, pool->def, vol) < 0) > goto cleanup; > > - if (vol->building) { > + if (vol->building || vol->in_use) { > virReportError(VIR_ERR_OPERATION_INVALID, > _("volume '%s' is still being allocated."), > vol->name); The error messages should be updated too. > @@ -2010,7 +2010,7 @@ storageVolDownload(virStorageVolPtr obj, > if (virStorageVolDownloadEnsureACL(obj->conn, pool->def, vol) < 0) > goto cleanup; > > - if (vol->building) { > + if (vol->building || vol->in_use) { > virReportError(VIR_ERR_OPERATION_INVALID, > _("volume '%s' is still being allocated."), Do we need to restrict VolDownload as well? > vol->name); Jan
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list