They don't work right now, so until we fix that, don't allow it.
(This patch is for stable-1.0)
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
.destroy = &dir_destroy,
.create = &dir_create,
.can_snapshot = false,
+ .can_backup = true,
};
.destroy = &zfs_destroy,
.create = &zfs_create,
.can_snapshot = true,
+ .can_backup = true,
};
//
.destroy = &lvm_destroy,
.create = &lvm_create,
.can_snapshot = true,
+ .can_backup = false,
};
/*
.destroy = &btrfs_destroy,
.create = &btrfs_create,
.can_snapshot = true,
+ .can_backup = true,
};
//
.destroy = &loop_destroy,
.create = &loop_create,
.can_snapshot = false,
+ .can_backup = true,
};
//
.destroy = &overlayfs_destroy,
.create = &overlayfs_create,
.can_snapshot = true,
+ .can_backup = true,
};
//
.destroy = &aufs_destroy,
.create = &aufs_create,
.can_snapshot = true,
+ .can_backup = true,
};
struct bdev *bdev;
const struct bdev_type *q;
+ if (!src)
+ return NULL;
+
q = bdev_query(src);
if (!q)
return NULL;
return ret;
}
+bool bdev_can_backup(struct lxc_conf *conf)
+{
+ struct bdev *bdev = bdev_init(conf->rootfs.path, NULL, NULL);
+ bool ret;
+
+ if (!bdev)
+ return false;
+ ret = bdev->ops->can_backup;
+ bdev_put(bdev);
+ return ret;
+}
+
/*
* is an unprivileged user allowed to make this kind of snapshot
*/
const char *cname, const char *oldpath, const char *lxcpath,
int snap, uint64_t newsize, struct lxc_conf *conf);
bool can_snapshot;
+ bool can_backup;
};
/*
char *overlay_getlower(char *p);
bool bdev_is_dir(const char *path);
+bool bdev_can_backup(struct lxc_conf *conf);
/*
* Instantiate a bdev object. The src is used to determine which blockdev
if (!c || !lxcapi_is_defined(c))
return -1;
+ if (!bdev_can_backup(c->lxc_conf)) {
+ ERROR("%s's backing store cannot be backed up.", c->name);
+ ERROR("Your container must use another backing store type.");
+ return -1;
+ }
+
// /var/lib/lxc -> /var/lib/lxcsnaps \0
ret = snprintf(snappath, MAXPATHLEN, "%ssnaps/%s", c->config_path, c->name);
if (ret < 0 || ret >= MAXPATHLEN)