lvol: add UUID to lvols snapshots and clones

See commit 8887697f8c62 ("bdev/lvol: add UUID to lvols")

Change-Id: I8b0c2678678588fc9ab85bfcf19fefffc0e26b0c
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/407300
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Tomasz Kulasek 2018-04-11 14:27:03 +02:00 committed by Daniel Verkamp
parent be0eef0a0d
commit 2da6293e85

View File

@ -1116,7 +1116,7 @@ spdk_lvol_create_snapshot(struct spdk_lvol *origlvol, const char *snapshot_name,
struct spdk_blob *origblob;
struct spdk_lvol_with_handle_req *req;
struct spdk_blob_xattr_opts snapshot_xattrs;
char *xattr_names = LVOL_NAME;
char *xattr_names[] = {LVOL_NAME, "uuid"};
int rc;
if (origlvol == NULL) {
@ -1150,9 +1150,11 @@ spdk_lvol_create_snapshot(struct spdk_lvol *origlvol, const char *snapshot_name,
newlvol->lvol_store = origlvol->lvol_store;
snprintf(newlvol->name, sizeof(newlvol->name), "%s", snapshot_name);
snapshot_xattrs.count = 1;
spdk_uuid_generate(&newlvol->uuid);
spdk_uuid_fmt_lower(newlvol->uuid_str, sizeof(newlvol->uuid_str), &newlvol->uuid);
snapshot_xattrs.count = SPDK_COUNTOF(xattr_names);
snapshot_xattrs.ctx = newlvol;
snapshot_xattrs.names = &xattr_names;
snapshot_xattrs.names = xattr_names;
snapshot_xattrs.get_value = spdk_lvol_get_xattr_value;
req->lvol = newlvol;
req->cb_fn = cb_fn;
@ -1171,7 +1173,7 @@ spdk_lvol_create_clone(struct spdk_lvol *origlvol, const char *clone_name,
struct spdk_lvol_store *lvs;
struct spdk_blob *origblob;
struct spdk_blob_xattr_opts clone_xattrs;
char *xattr_names = LVOL_NAME;
char *xattr_names[] = {LVOL_NAME, "uuid"};
int rc;
if (origlvol == NULL) {
@ -1205,9 +1207,11 @@ spdk_lvol_create_clone(struct spdk_lvol *origlvol, const char *clone_name,
newlvol->lvol_store = lvs;
snprintf(newlvol->name, sizeof(newlvol->name), "%s", clone_name);
clone_xattrs.count = 1;
spdk_uuid_generate(&newlvol->uuid);
spdk_uuid_fmt_lower(newlvol->uuid_str, sizeof(newlvol->uuid_str), &newlvol->uuid);
clone_xattrs.count = SPDK_COUNTOF(xattr_names);
clone_xattrs.ctx = newlvol;
clone_xattrs.names = &xattr_names;
clone_xattrs.names = xattr_names;
clone_xattrs.get_value = spdk_lvol_get_xattr_value;
req->lvol = newlvol;
req->cb_fn = cb_fn;