[lxc-devel] [PATCH 1/1] lxcapi_clone: exit early on snapshot clones

Stéphane Graber stgraber at ubuntu.com
Sat Jan 25 23:02:53 UTC 2014


On Sat, Jan 25, 2014 at 04:28:24PM -0600, Serge Hallyn wrote:
> If the user explicitly asks for a snapshot clone (in which
> case maybe_snap is not set), we cannot abide this currently.
> Rather than exit later with more cryptic error messages, exit
> out early.
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/lxc/bdev.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c
> index 2c3388f..09b7ca7 100644
> --- a/src/lxc/bdev.c
> +++ b/src/lxc/bdev.c
> @@ -2101,6 +2101,11 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
>  
>  	/* check for privilege */
>  	if (am_unpriv()) {
> +		if (snap && !maybe_snap) {
> +			ERROR("Unprivileged users cannot snapshot");
> +			bdev_put(orig);
> +			return NULL;
> +		}
>  		if (bdevtype && strcmp(bdevtype, "dir") != 0) {
>  			ERROR("Unprivileged users can only make dir copy-clones");
>  			bdev_put(orig);
> -- 
> 1.8.5.3
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140125/977ac417/attachment.pgp>


More information about the lxc-devel mailing list