[sheepdog] [PATCH v1] dog: use -T as the option for showing elapsed time

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Aug 11 15:40:45 CEST 2014


At Mon, 11 Aug 2014 17:17:33 +0800,
Bingpeng Zhu wrote:
> 
> Currently, "-t" has been used as the option abbr for both showing
> elapsed time of executing dog command and enabling strict mode.
> "-t" for strict mode is already available in stable-0.8. For keeping
> compatibility, maybe we should use "-T" for showing elapsed time.
> 
> Signed-off-by: Bingpeng Zhu <bingpeng.zbp at alibaba-inc.com>
> ---
>  dog/cluster.c |   16 ++++++++--------
>  dog/dog.c     |    4 ++--
>  dog/node.c    |   14 +++++++-------
>  dog/vdi.c     |   42 +++++++++++++++++++++---------------------
>  4 files changed, 38 insertions(+), 38 deletions(-)

Applied, thanks. I'm Cc-ing Ruoyu because he added the -t
option. Ruoyu, -t option is conflicting with current -t (strict), so I
applied this patch. I should've pointed the duplication of the option
at the review time, sorry.

Thanks,
Hitoshi

> 
> diff --git a/dog/cluster.c b/dog/cluster.c
> index 6649507..9cf96a8 100644
> --- a/dog/cluster.c
> +++ b/dog/cluster.c
> @@ -745,25 +745,25 @@ failure:
>  }
>  
>  static struct subcommand cluster_cmd[] = {
> -	{"info", NULL, "aprhvt", "show cluster information",
> +	{"info", NULL, "aprhvT", "show cluster information",
>  	 NULL, CMD_NEED_NODELIST, cluster_info, cluster_options},
> -	{"format", NULL, "bctapht", "create a Sheepdog store",
> +	{"format", NULL, "bctaphT", "create a Sheepdog store",
>  	 NULL, CMD_NEED_NODELIST, cluster_format, cluster_options},
> -	{"shutdown", NULL, "apht", "stop Sheepdog",
> +	{"shutdown", NULL, "aphT", "stop Sheepdog",
>  	 NULL, 0, cluster_shutdown, cluster_options},
>  	{"snapshot", "<tag|idx> <path> [vdi1] [vdi2] ...",
> -	 "aphtm", "snapshot/restore the cluster",
> +	 "aphTm", "snapshot/restore the cluster",
>  	 cluster_snapshot_cmd, CMD_NEED_ARG,
>  	 cluster_snapshot, cluster_options},
> -	{"recover", NULL, "afpht",
> +	{"recover", NULL, "afphT",
>  	 "See 'dog cluster recover' for more information",
>  	 cluster_recover_cmd, CMD_NEED_ARG,
>  	 cluster_recover, cluster_options},
> -	{"reweight", NULL, "apht", "reweight the cluster", NULL, 0,
> +	{"reweight", NULL, "aphT", "reweight the cluster", NULL, 0,
>  	 cluster_reweight, cluster_options},
> -	{"check", NULL, "apht", "check and repair cluster", NULL,
> +	{"check", NULL, "aphT", "check and repair cluster", NULL,
>  	 CMD_NEED_NODELIST, cluster_check, cluster_options},
> -	{"alter-copy", NULL, "aphtc", "set the cluster's redundancy level",
> +	{"alter-copy", NULL, "aphTc", "set the cluster's redundancy level",
>  	 NULL, CMD_NEED_NODELIST, cluster_alter_copy, cluster_options},
>  	{NULL,},
>  };
> diff --git a/dog/dog.c b/dog/dog.c
> index fba44cf..76925f1 100644
> --- a/dog/dog.c
> +++ b/dog/dog.c
> @@ -43,7 +43,7 @@ static const struct sd_option dog_options[] = {
>  	 "                          single spaces and print all sizes in decimal bytes"},
>  	{'v', "verbose", false, "print more information than default"},
>  	{'h', "help", false, "display this help and exit"},
> -	{'t', "time", false, "show elapsed time"},
> +	{'T', "time", false, "show elapsed time"},
>  
>  	{ 0, NULL, false, NULL },
>  };
> @@ -524,7 +524,7 @@ int main(int argc, char **argv)
>  		case 'h':
>  			subcommand_usage(argv[1], argv[2], EXIT_SUCCESS);
>  			break;
> -		case 't':
> +		case 'T':
>  			elapsed_time = true;
>  			break;
>  		case '?':
> diff --git a/dog/node.c b/dog/node.c
> index f9f7351..3912496 100644
> --- a/dog/node.c
> +++ b/dog/node.c
> @@ -626,19 +626,19 @@ static int node_log(int argc, char **argv)
>  }
>  
>  static struct subcommand node_cmd[] = {
> -	{"kill", "<node id>", "aprhlt", "kill node", NULL,
> +	{"kill", "<node id>", "aprhlT", "kill node", NULL,
>  	 CMD_NEED_NODELIST, node_kill, node_options},
> -	{"list", NULL, "aprht", "list nodes", NULL,
> +	{"list", NULL, "aprhT", "list nodes", NULL,
>  	 CMD_NEED_NODELIST, node_list},
> -	{"info", NULL, "aprht", "show information about each node", NULL,
> +	{"info", NULL, "aprhT", "show information about each node", NULL,
>  	 CMD_NEED_NODELIST, node_info},
> -	{"recovery", NULL, "aphPrt", "show recovery information of nodes", NULL,
> +	{"recovery", NULL, "aphPrT", "show recovery information of nodes", NULL,
>  	 CMD_NEED_NODELIST, node_recovery, node_options},
> -	{"md", "[disks]", "aprAfht", "See 'dog node md' for more information",
> +	{"md", "[disks]", "aprAfhT", "See 'dog node md' for more information",
>  	 node_md_cmd, CMD_NEED_ARG, node_md, node_options},
> -	{"stat", NULL, "aprwht", "show stat information about the node", NULL,
> +	{"stat", NULL, "aprwhT", "show stat information about the node", NULL,
>  	 0, node_stat, node_options},
> -	{"log", NULL, "apht", "show or set log level of the node", node_log_cmd,
> +	{"log", NULL, "aphT", "show or set log level of the node", node_log_cmd,
>  	 CMD_NEED_ARG, node_log},
>  	{NULL,},
>  };
> diff --git a/dog/vdi.c b/dog/vdi.c
> index 6870582..84715b3 100644
> --- a/dog/vdi.c
> +++ b/dog/vdi.c
> @@ -2829,70 +2829,70 @@ static int vdi_lock(int argc, char **argv)
>  }
>  
>  static struct subcommand vdi_cmd[] = {
> -	{"check", "<vdiname>", "seapht", "check and repair image's consistency",
> +	{"check", "<vdiname>", "seaphT", "check and repair image's consistency",
>  	 NULL, CMD_NEED_NODELIST|CMD_NEED_ARG,
>  	 vdi_check, vdi_options},
> -	{"create", "<vdiname> <size>", "Pycaphrvt", "create an image",
> +	{"create", "<vdiname> <size>", "PycaphrvT", "create an image",
>  	 NULL, CMD_NEED_NODELIST|CMD_NEED_ARG,
>  	 vdi_create, vdi_options},
> -	{"snapshot", "<vdiname>", "saphrvt", "create a snapshot",
> +	{"snapshot", "<vdiname>", "saphrvT", "create a snapshot",
>  	 NULL, CMD_NEED_ARG,
>  	 vdi_snapshot, vdi_options},
> -	{"clone", "<src vdi> <dst vdi>", "sPnaphrvt", "clone an image",
> +	{"clone", "<src vdi> <dst vdi>", "sPnaphrvT", "clone an image",
>  	 NULL, CMD_NEED_ARG,
>  	 vdi_clone, vdi_options},
> -	{"delete", "<vdiname>", "sapht", "delete an image",
> +	{"delete", "<vdiname>", "saphT", "delete an image",
>  	 NULL, CMD_NEED_ARG,
>  	 vdi_delete, vdi_options},
> -	{"rollback", "<vdiname>", "saphfrvt", "rollback to a snapshot",
> +	{"rollback", "<vdiname>", "saphfrvT", "rollback to a snapshot",
>  	 NULL, CMD_NEED_ARG,
>  	 vdi_rollback, vdi_options},
> -	{"list", "[vdiname]", "aprhot", "list images",
> +	{"list", "[vdiname]", "aprhoT", "list images",
>  	 NULL, 0, vdi_list, vdi_options},
> -	{"tree", NULL, "apht", "show images in tree view format",
> +	{"tree", NULL, "aphT", "show images in tree view format",
>  	 NULL, 0, vdi_tree, vdi_options},
> -	{"graph", NULL, "apht", "show images in Graphviz dot format",
> +	{"graph", NULL, "aphT", "show images in Graphviz dot format",
>  	 NULL, 0, vdi_graph, vdi_options},
> -	{"object", "<vdiname>", "isapht",
> +	{"object", "<vdiname>", "isaphT",
>  	 "show object information in the image",
>  	 vdi_object_cmd, CMD_NEED_ARG,
>  	 vdi_object, vdi_options},
> -	{"track", "<vdiname>", "isaphot",
> +	{"track", "<vdiname>", "isaphoT",
>  	 "show the object epoch trace in the image",
>  	 NULL, CMD_NEED_NODELIST|CMD_NEED_ARG,
>  	 vdi_track, vdi_options},
> -	{"setattr", "<vdiname> <key> [value]", "dxapht", "set a VDI attribute",
> +	{"setattr", "<vdiname> <key> [value]", "dxaphT", "set a VDI attribute",
>  	 NULL, CMD_NEED_ARG,
>  	 vdi_setattr, vdi_options},
> -	{"getattr", "<vdiname> <key>", "apht", "get a VDI attribute",
> +	{"getattr", "<vdiname> <key>", "aphT", "get a VDI attribute",
>  	 NULL, CMD_NEED_ARG,
>  	 vdi_getattr, vdi_options},
> -	{"resize", "<vdiname> <new size>", "apht", "resize an image",
> +	{"resize", "<vdiname> <new size>", "aphT", "resize an image",
>  	 NULL, CMD_NEED_ARG,
>  	 vdi_resize, vdi_options},
> -	{"read", "<vdiname> [<offset> [<len>]]", "sapht",
> +	{"read", "<vdiname> [<offset> [<len>]]", "saphT",
>  	 "read data from an image",
>  	 NULL, CMD_NEED_ARG,
>  	 vdi_read, vdi_options},
> -	{"write", "<vdiname> [<offset> [<len>]]", "apwht",
> +	{"write", "<vdiname> [<offset> [<len>]]", "apwhT",
>  	 "write data to an image",
>  	 NULL, CMD_NEED_ARG,
>  	 vdi_write, vdi_options},
> -	{"backup", "<vdiname> <backup>", "sFapht",
> +	{"backup", "<vdiname> <backup>", "sFaphT",
>  	 "create an incremental backup between two snapshots",
>  	 NULL, CMD_NEED_NODELIST|CMD_NEED_ARG,
>  	 vdi_backup, vdi_options},
> -	{"restore", "<vdiname> <backup>", "sapht",
> +	{"restore", "<vdiname> <backup>", "saphT",
>  	 "restore snapshot images from a backup",
>  	 NULL, CMD_NEED_NODELIST|CMD_NEED_ARG,
>  	 vdi_restore, vdi_options},
> -	{"cache", "<vdiname>", "sapht",
> +	{"cache", "<vdiname>", "saphT",
>  	 "Run 'dog vdi cache' for more information",
>  	 vdi_cache_cmd, CMD_NEED_ARG,
>  	 vdi_cache, vdi_options},
> -	{"alter-copy", "<vdiname>", "capht", "set the vdi's redundancy level",
> +	{"alter-copy", "<vdiname>", "caphT", "set the vdi's redundancy level",
>  	 NULL, CMD_NEED_ARG|CMD_NEED_NODELIST, vdi_alter_copy, vdi_options},
> -	{"lock", NULL, "apht", "See 'dog vdi lock' for more information",
> +	{"lock", NULL, "aphT", "See 'dog vdi lock' for more information",
>  	 vdi_lock_cmd, CMD_NEED_ARG, vdi_lock, vdi_options},
>  	{NULL,},
>  };
> -- 
> 1.7.1
> 
> 
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list