[sheepdog] [PATCH 2/2] collie: show 'auto-recovery' status for 'cluster info'

MORITA Kazutaka morita.kazutaka at gmail.com
Mon May 20 19:56:17 CEST 2013


> diff --git a/collie/cluster.c b/collie/cluster.c
> index dc7ff5a..3ae901b 100644
> --- a/collie/cluster.c
> +++ b/collie/cluster.c
> @@ -155,7 +155,8 @@ static int cluster_info(int argc, char **argv)
>  	if (!raw_output)
>  		printf("Cluster status: ");
>  	if (rsp->result == SD_RES_SUCCESS)
> -		printf("running\n");
> +		printf("running, auto-recovery %s\n", logs->disable_recovery ?
> +		       "disabled" : "enabled");
>  	else
>  		printf("%s\n", sd_strerror(rsp->result));

After this change, we need to update tests too.  IMO, this patch should be
merged with the patch to update the tests.

>  
> diff --git a/include/internal_proto.h b/include/internal_proto.h
> index a04af88..a5d21f7 100644
> --- a/include/internal_proto.h
> +++ b/include/internal_proto.h
> @@ -130,7 +130,7 @@ struct epoch_log {
>  	uint64_t time;		/* treated as time_t */
>  	uint32_t epoch;
>  	uint32_t nr_nodes;
> -	uint32_t nr_copies;
> +	uint8_t disable_recovery;
>  	struct sd_node nodes[SD_MAX_NODES];
>  };

This structure is sent on the wire, and should be changed carefully.  That being
said, it isn't already 64-bit aligned.  I'd suggest the following change.

 	uint64_t time;		/* treated as time_t */
 	uint32_t epoch;
-	uint32_t nr_nodes;
-	uint32_t nr_copies;
+	uint16_t nr_nodes;
+	uint8_t disable_recovery;
+	uint8_t __pad;
 	struct sd_node nodes[SD_MAX_NODES];
 };


More information about the sheepdog mailing list