diff --git a/lib/lvol/lvol.c b/lib/lvol/lvol.c index 88cf4ef332..6142afcf45 100644 --- a/lib/lvol/lvol.c +++ b/lib/lvol/lvol.c @@ -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;