1
0
mirror of https://github.com/gluster/gluster-block.git synced 2026-02-05 12:45:33 +01:00

blksize: add hw block size setting support

This will still need to depend the taregetcli's saveconfig support,
the rtslib PR is open-iscsi/rtslib-fb#150.

When creating the BV with the 'block-size <SIZE>' option:

In case all the ha nodes have supported the rtslib-fb#150:
1) if local node support the block-size, but if there is any of
   the remote nodes is not, it will fail with the cap not match error.
2) if local node does not support the block-size, no matter whether
   the remote nodes support it or not, it will always ignore the
   block-size option due to the exist bug.

In case if there is any of the ha nodes does not support rtslib-fb#150:
3) if local node support the block-size, it will always fails with the
   cap not match error.
4) if local mode does not support the block-size, no matter whether
   the remote nodes support it or not, it will ignore the block-size
   option due to the exist bug.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
Xiubo Li
2019-05-31 09:40:01 +08:00
committed by Prasanna Kumar Kalever
parent d44f79912e
commit 698dbaced0
17 changed files with 323 additions and 116 deletions

View File

@@ -18,6 +18,7 @@
"[ha <count>] [auth <enable|disable>] " \
"[prealloc <full|no>] [storage <filename>] " \
"[ring-buffer <size-in-MB-units>] " \
"[block-size <size-in-Byte-units>] " \
"<HOST1[,HOST2,...]> [size] [--json*]"
# define GB_DELETE_HELP_STR "gluster-block delete <volname/blockname> " \
"[unlink-storage <yes|no>] [force] [--json*]"
@@ -296,9 +297,10 @@ glusterBlockHelp(void)
" [prealloc <full|no>]\n"
" [storage <filename>]\n"
" [ring-buffer <size-in-MB-units>]\n"
" [block-size <size-in-Byte-units>]\n"
" <host1[,host2,...]> [size]\n"
" create block device [defaults: ha 1, auth disable, prealloc full, size in bytes,\n"
" ring-buffer default size dependends on kernel]\n"
" ring-buffer and block-size default size dependends on kernel]\n"
"\n"
" list <volname>\n"
" list available block devices.\n"
@@ -527,7 +529,7 @@ glusterBlockModify(int argcount, char **options, int json)
}
} else if (!strcmp(options[optind], "size")) {
optind++;
sparse_ret = glusterBlockParseSize("cli", options[optind++]);
sparse_ret = glusterBlockParseSize("cli", options[optind++], 0);
if (sparse_ret < 0) {
MSG(stderr, "'<size>' is incorrect");
MSG(stderr, GB_MODIFY_HELP_STR);
@@ -669,6 +671,25 @@ glusterBlockCreate(int argcount, char **options, int json)
goto out;
}
break;
case GB_CLI_CREATE_BLKSIZE:
if (isNumber(options[optind])) {
sscanf(options[optind++], "%u", &cobj.blk_size);
if (cobj.blk_size % 512) {
MSG(stderr, "'block-size' should be aligned to 512 bytes");
MSG(stderr, GB_CREATE_HELP_STR);
LOG("cli", GB_LOG_ERROR,
"failed while parsing block-size aligned to 512 bytes for block <%s/%s>",
cobj.volume, cobj.block_name);
goto out;
}
} else {
MSG(stderr, "'block-size' option is incorrect, hint: should be uint type");
MSG(stderr, GB_CREATE_HELP_STR);
LOG("cli", GB_LOG_ERROR, "failed while parsing block-size for block <%s/%s>",
cobj.volume, cobj.block_name);
goto out;
}
break;
}
}
@@ -717,7 +738,7 @@ glusterBlockCreate(int argcount, char **options, int json)
}
if (TAKE_SIZE) {
sparse_ret = glusterBlockParseSize("cli", options[optind]);
sparse_ret = glusterBlockParseSize("cli", options[optind], cobj.blk_size);
if (sparse_ret < 0) {
MSG(stderr, "'[size]' is incorrect");
MSG(stderr, GB_CREATE_HELP_STR);