[Ocfs2-tools-devel] [PATCH 10/25] o2cb: Add ops add-cluster aand remove-cluster

Joel Becker Joel.Becker at oracle.com
Wed Jun 23 19:28:49 PDT 2010


On Wed, Jun 23, 2010 at 11:44:20AM -0700, Sunil Mushran wrote:
> +errcode_t o2cbtool_add_cluster(struct o2cb_command *cmd)
> +{
> +	O2CBCluster *cluster;
> +	errcode_t ret = -1;
> +	gchar *clustername;
> +
> +	if (cmd->o_argc < 2) {
> +		errorf("usage: %s %s\n", cmd->o_name, cmd->o_usage);
> +		goto bail;
> +	}
> +
> +	clustername = cmd->o_argv[1];
> +
> +	cluster = o2cb_config_add_cluster(cmd->o_config, clustername);
> +	if (!cluster) {
> +		errorf("cluster '%s' already exists\n", clustername);
> +		goto bail;
> +	}

	You should say "Unable to add cluster %s", because you don't
know why it failed.

> +	ret = o2cb_config_remove_cluster(cmd->o_config, clustername);
> +	if (ret) {
> +		errorf("cluster '%s' not found\n", clustername);
> +		goto bail;

	And this could fail with many errors, not just "doesn't exist."

Joel

-- 

"In the arms of the angel, fly away from here,
 From this dark, cold hotel room and the endlessness that you fear.
 You are pulled from the wreckage of your silent reverie.
 In the arms of the angel, may you find some comfort here."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list