[Devel] Re: [PATCH] Add --nonetns switch to user-cr checkpoint

Serge E. Hallyn serue at us.ibm.com
Wed Mar 31 08:20:15 PDT 2010


Quoting Dan Smith (danms at us.ibm.com):
> SH> Also, args does get memset to 0 before parse_args() gets called so
> SH> you don't need to set args->flag to 0 there.
> 
> I wanted it to be really, really zeroed.

:)

Looks great.

thanks,
-serge

> -- 
> Dan Smith
> IBM Linux Technology Center
> email: danms at us.ibm.com
> 
> Add --nonetns switch to user-cr checkpoint (v2)
> 
> This allows the caller to set the CHECKPOINT_NONETNS flag on the checkpoint
> operation, thus skipping the checkpointing of network namespaces entirely.
> 
> Changes in v2:
>  - Allow -N for --nonetns
>  - Remove extra flags initialization
> 
> Signed-off-by: Dan Smith <danms at us.ibm.com>
> Acked-by: Serge Hallyn <serue at us.ibm.com>
> 
> diff --git a/app-checkpoint.h b/app-checkpoint.h
> index f740085..c078f04 100644
> --- a/app-checkpoint.h
> +++ b/app-checkpoint.h
> @@ -5,6 +5,7 @@ struct app_checkpoint_args {
>  	int uerrfd;
>  	int container;
>  	int verbose;
> +	int flags;
>  };
> 
>  struct app_restart_args {
> diff --git a/checkpoint-main.c b/checkpoint-main.c
> index f6faa32..85b4133 100644
> --- a/checkpoint-main.c
> +++ b/checkpoint-main.c
> @@ -30,6 +30,7 @@ static char usage_str[] =
>  "  -l,--logfile=FILE     write error and debug data to FILE (default=none)\n"
>  "     --logile-fd=FD     write error and debug data to file descriptor FD\n"
>  "  -c,--container        require the PID is a container-init\n"
> +"  -N,--nonetns          do not checkpoint network namespace(s)\n"
>  "  -v,--verbose          verbose output\n"
>  "";
> 
> @@ -61,9 +62,10 @@ static void parse_args(struct app_checkpoint_args *args, int argc, char *argv[])
>  		{ "logfile-fd",	required_argument,	NULL, 2 },
>  		{ "container",	no_argument,		NULL, 'c' },
>  		{ "verbose",	no_argument,		NULL, 'v' },
> +		{ "nonetns",	no_argument,		NULL, 'N' },
>  		{ NULL,		0,			NULL, 0 }
>  	};
> -	static char optc[] = "hvco:l:";
> +	static char optc[] = "hvco:l:N";
>  	char *output;
>  	char *logfile;
> 
> @@ -109,6 +111,9 @@ static void parse_args(struct app_checkpoint_args *args, int argc, char *argv[])
>  		case 'v':
>  			args->verbose = 1;
>  			break;
> +		case 'N':
> +			args->flags |= CHECKPOINT_NONETNS;
> +			break;
>  		default:
>  			usage(usage_str);
>  		}
> @@ -164,6 +169,7 @@ int main(int argc, char *argv[])
>  		exit(1);
>  	}
> 
> +	flags = args.flags;
>  	if (!args.container)
>  		flags |= CHECKPOINT_SUBTREE;
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list