reduce: generate uuid if user doesn't pass one
Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I29a68cac0c2ace3db65e684c36d1512ce72078ac Reviewed-on: https://review.gerrithub.io/433086 Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
0c6b87b7db
commit
38259b9982
@ -245,12 +245,6 @@ spdk_reduce_vol_init(struct spdk_reduce_vol_params *params,
|
||||
return;
|
||||
}
|
||||
|
||||
if (spdk_mem_all_zero(¶ms->uuid, sizeof(params->uuid))) {
|
||||
SPDK_ERRLOG("no uuid specified\n");
|
||||
cb_fn(cb_arg, NULL, -EINVAL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (backing_dev->close == NULL || backing_dev->readv == NULL ||
|
||||
backing_dev->writev == NULL || backing_dev->unmap == NULL) {
|
||||
SPDK_ERRLOG("backing_dev function pointer not specified\n");
|
||||
@ -290,6 +284,10 @@ spdk_reduce_vol_init(struct spdk_reduce_vol_params *params,
|
||||
return;
|
||||
}
|
||||
|
||||
if (spdk_mem_all_zero(¶ms->uuid, sizeof(params->uuid))) {
|
||||
spdk_uuid_generate(¶ms->uuid);
|
||||
}
|
||||
|
||||
memcpy(&vol->uuid, ¶ms->uuid, sizeof(params->uuid));
|
||||
vol->backing_dev = backing_dev;
|
||||
|
||||
|
@ -232,8 +232,8 @@ init_failure(void)
|
||||
CU_ASSERT(g_ziperrno == -EINVAL);
|
||||
SPDK_CU_ASSERT_FATAL(g_vol == NULL);
|
||||
|
||||
/* pm_file now has valid size, but uuid is still all zeroes.
|
||||
* This should fail.
|
||||
/* pm_file now has valid size, but backing_dev still has null function
|
||||
* pointers. This should fail.
|
||||
*/
|
||||
pm_file_init(&pm_file, ¶ms);
|
||||
|
||||
@ -243,17 +243,6 @@ init_failure(void)
|
||||
CU_ASSERT(g_ziperrno == -EINVAL);
|
||||
SPDK_CU_ASSERT_FATAL(g_vol == NULL);
|
||||
|
||||
/* uuid is now valid, but backing_dev still has null function pointers.
|
||||
* This should fail.
|
||||
*/
|
||||
spdk_uuid_generate(¶ms.uuid);
|
||||
|
||||
g_vol = NULL;
|
||||
g_ziperrno = 0;
|
||||
spdk_reduce_vol_init(¶ms, &backing_dev, &pm_file, init_cb, NULL);
|
||||
CU_ASSERT(g_ziperrno == -EINVAL);
|
||||
SPDK_CU_ASSERT_FATAL(g_vol == NULL);
|
||||
|
||||
pm_file_close(&pm_file);
|
||||
pm_file_destroy();
|
||||
}
|
||||
@ -343,7 +332,6 @@ init_md(void)
|
||||
params.vol_size = 1024 * 1024; /* 1MB */
|
||||
params.chunk_size = 16 * 1024;
|
||||
params.backing_io_unit_size = 512;
|
||||
spdk_uuid_generate(¶ms.uuid);
|
||||
|
||||
backing_dev_init(&backing_dev, ¶ms);
|
||||
pm_file_init(&pm_file, ¶ms);
|
||||
|
Loading…
Reference in New Issue
Block a user