[Sheepdog] [PATCH] sheep: add support for gateway mode

Liu Yuan namei.unix at gmail.com
Mon May 7 07:31:53 CEST 2012


On 05/07/2012 03:36 AM, MORITA Kazutaka wrote:

> The gateway nodes only forwards requests to the sheepdog cluster, and
> doesn't store objects in local at all.  Running a gateway daemon on
> localhost and connecting to it would be an alternative to implementing
> sheepdog fail-over support in qemu because the gateway node
> automatically choose the correct target nodes.
> 
> Currently, this options is just an alias for '--vnodes 0'.  Note that
> a small storage to store epoch information is still required for
> gateway nodes.
> 
> Signed-off-by: MORITA Kazutaka <morita.kazutaka at gmail.com>
> ---
>  sheep/sheep.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/sheep/sheep.c b/sheep/sheep.c
> index 6645e8d..4e6e266 100644
> --- a/sheep/sheep.c
> +++ b/sheep/sheep.c
> @@ -40,6 +40,7 @@ static struct option const long_options[] = {
>  	{"directio", no_argument, NULL, 'D'},
>  	{"foreground", no_argument, NULL, 'f'},
>  	{"nr_gateway_worker", required_argument, NULL, 'g'},
> +	{"gateway", no_argument, NULL, 'G'},
>  	{"help", no_argument, NULL, 'h'},
>  	{"nr_io_worker", required_argument, NULL, 'i'},
>  	{"loglevel", required_argument, NULL, 'l'},
> @@ -50,7 +51,7 @@ static struct option const long_options[] = {
>  	{NULL, 0, NULL, 0},
>  };
>  
> -static const char *short_options = "ac:dDfg:hi:l:op:v:z:";
> +static const char *short_options = "ac:dDfg:Ghi:l:op:v:z:";
>  
>  static void usage(int status)
>  {
> @@ -68,6 +69,7 @@ Options:\n\
>    -D, --directio          use direct IO when accessing the object from object cache\n\
>    -f, --foreground        make the program run in the foreground\n\
>    -g, --nr_gateway_worker set the number of workers for Guests' requests (default 4)\n\
> +  -G, --gateway           make the progam run as a gateway mode (same as '-v 0')\n\
>    -h, --help              display this help and exit\n\
>    -i, --nr_io_worker      set the number of workers for sheep internal requests (default 4)\n\
>    -l, --loglevel          specify the level of logging detail\n\
> @@ -156,6 +158,10 @@ int main(int argc, char **argv)
>  				exit(1);
>  			}
>  			break;
> +		case 'G':
> +			/* same as '-v 0' */
> +			nr_vnodes = 0;
> +			break;
>  		case 'i':
>  			nr_io_worker = strtol(optarg, &p, 10);
>  			if (optarg == p || nr_io_worker < 4 || nr_io_worker > UINT32_MAX) {


What if a user both set -G and -v? Do we need to handle this corner
erroneous case?

Thanks,
Yuan



More information about the sheepdog mailing list