Add --nonetns switch to user-cr checkpoint
PATCH 1/1 Add --nonetns switch to user-cr checkpoint
This allows the caller to set the CHECKPOINT_NONETNS flag on the checkpoint operation, thus skipping the checkpointing of network namespaces entirely.
--- app-checkpoint.h | 1 + checkpoint-main.c | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-)
app-checkpoint.h +1 -0
@@ -5,6 +5,7 @@ struct app_checkpoint_args {int uerrfd;int container;int verbose; +int flags; };struct app_restart_args {
checkpoint-main.c +7 -0
@@ -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" +" --nonetns do not checkpoint network namespace(s)\n" " -v,--verbose verbose output\n" "" ;
@@ -61,6 +62,7 @@ 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, 3 }, { NULL, 0, NULL, 0 } };static char optc[] ="hvco:l:" ;
@@ -71,6 +73,7 @@ static void parse_args(struct app_checkpoint_args *args, int argc, char *argv[]) args->outfd =-1 ; args->logfd =-1 ; args->uerrfd =fileno (stderr); + args->flags =0 ; output =NULL ; logfile =NULL ;
@@ -109,6 +112,9 @@ static void parse_args(struct app_checkpoint_args *args, int argc, char *argv[])case 'v' : args->verbose =1 ;break ; +case 3 : + args->flags |=CHECKPOINT_NONETNS ; +break ;default :usage (usage_str); }
@@ -164,6 +170,7 @@ int main(int argc, char *argv[])exit (1 ); } + flags = args.flags;if (!args.container) flags |=CHECKPOINT_SUBTREE ;
Signature · 1 line
1.6.3.3
A message that is not in the archive (sent off-list or not yet received): 1270046482-16053-1-git-send-email-danms-r/[email protected]
Serge E. Hallyn
Acked-byQuoted 4 lines · Dan Smith
This allows the caller to set the
CHECKPOINT_NONETNSflag on the checkpoint operation, thus skipping the checkpointing of network namespaces entirely.Signed-off-by Dan Smith <danms-r/[email protected]>
Thanks, Dan. Can we add '-N' as a synonym for my lazy fingers?
Also, args does get memset to 0 before parse_args() gets called so you don't need to set args->flag to 0 there.
But
Quoted 70 lines
--- app-checkpoint.h | 1 + checkpoint-main.c | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-)app-checkpoint.h +1
-0@@ -5,6 +5,7 @@ struct app_checkpoint_args {int uerrfd;int container;int verbose; +int flags; };struct app_restart_args {checkpoint-main.c +7
-0@@ -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" +" --nonetns do not checkpoint network namespace(s)\n" " -v,--verbose verbose output\n" "" ;@@ -61,6 +62,7 @@ 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, 3 }, { NULL, 0, NULL, 0 } };static char optc[] ="hvco:l:" ;@@ -71,6 +73,7 @@ static void parse_args(struct app_checkpoint_args *args, int argc, char *argv[]) args->outfd =-1 ; args->logfd =-1 ; args->uerrfd =fileno (stderr); + args->flags =0 ; output =NULL ; logfile =NULL ;@@ -109,6 +112,9 @@ static void parse_args(struct app_checkpoint_args *args, int argc, char *argv[])case 'v' : args->verbose =1 ;break ; +case 3 : + args->flags |=CHECKPOINT_NONETNS ; +break ;default :usage (usage_str); }@@ -164,6 +170,7 @@ int main(int argc, char *argv[])exit (1 ); } + flags = args.flags;if (!args.container) flags |=CHECKPOINT_SUBTREE ;Signature · 6 lines
1.6.3.3 _______________________________________________ Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org https://lists.linux-foundation.org/mailman/listinfo/containers
A message that is not in the archive (sent off-list or not yet received): 20100331145740.GA11124-r/[email protected]
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.
Signature · 15 lines
Dan Smith IBM Linux Technology Center email: danms-r/[email protected] 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-r/[email protected]> Acked-by: Serge Hallyn <serue-r/[email protected]>
app-checkpoint.h +1 -0
@@ -5,6 +5,7 @@ struct app_checkpoint_args {int uerrfd;int container;int verbose; +int flags; };struct app_restart_args {
checkpoint-main.c +7 -1
@@ -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 ;
A message that is not in the archive (sent off-list or not yet received): 87634ced9n.fsf-FLMGYpZoEPULwtHQx/[email protected]
Quoted 4 lines · Dan Smith
SH> Also, args does get memset to 0 before
parse_args()gets called so SH> you don't need to setargs->flagto 0 there.I wanted it to be really, really zeroed.
:)
Looks great.
thanks,
-serge
Quoted 70 lines
Signature · 15 lines
Dan Smith IBM Linux Technology Center email: danms-r/[email protected] 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-r/[email protected]> Acked-by: Serge Hallyn <serue-r/[email protected]>app-checkpoint.h +1
-0@@ -5,6 +5,7 @@ struct app_checkpoint_args {int uerrfd;int container;int verbose; +int flags; };struct app_restart_args {checkpoint-main.c +7
-1@@ -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 ;
Looks good, thanks.
I think the default behavior of 'checkpoint' should be to not chekcpoint net-ns, at the very least in the subtree-checkpoint case.
I prefer the container case to also not include it by default.
These can be tuned in the 'checkpoint' utility, or (better ?) by using CHECKPOINT_NETNS instead of CHECKPOINT_NONETNS...
Oren.
Quoted 67 lines · Dan Smith
This allows the caller to set the
CHECKPOINT_NONETNSflag on the checkpoint operation, thus skipping the checkpointing of network namespaces entirely.Signed-off-by Dan Smith <danms-r/[email protected]>--- app-checkpoint.h | 1 + checkpoint-main.c | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-)app-checkpoint.h +1
-0@@ -5,6 +5,7 @@ struct app_checkpoint_args {int uerrfd;int container;int verbose; +int flags; };struct app_restart_args {checkpoint-main.c +7
-0@@ -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" +" --nonetns do not checkpoint network namespace(s)\n" " -v,--verbose verbose output\n" "" ;@@ -61,6 +62,7 @@ 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, 3 }, { NULL, 0, NULL, 0 } };static char optc[] ="hvco:l:" ;@@ -71,6 +73,7 @@ static void parse_args(struct app_checkpoint_args *args, int argc, char *argv[]) args->outfd =-1 ; args->logfd =-1 ; args->uerrfd =fileno (stderr); + args->flags =0 ; output =NULL ; logfile =NULL ;@@ -109,6 +112,9 @@ static void parse_args(struct app_checkpoint_args *args, int argc, char *argv[])case 'v' : args->verbose =1 ;break ; +case 3 : + args->flags |=CHECKPOINT_NONETNS ; +break ;default :usage (usage_str); }@@ -164,6 +170,7 @@ int main(int argc, char *argv[])exit (1 ); } + flags = args.flags;if (!args.container) flags |=CHECKPOINT_SUBTREE ;
A message that is not in the archive (sent off-list or not yet received): [email protected]
OL> I think the default behavior of 'checkpoint' should be to not OL> chekcpoint net-ns, at the very least in the subtree-checkpoint OL> case.
OL> I prefer the container case to also not include it by default.
OL> These can be tuned in the 'checkpoint' utility, or (better ?) OL> by using CHECKPOINT_NETNS instead of CHECKPOINT_NONETNS...
Okay, so you want to change NONETNS to NETNS and then make user-cr have a positive flag instead of a negative one, yes?
Signature · 3 lines
Dan Smith IBM Linux Technology Center email: danms-r/[email protected]
A message that is not in the archive (sent off-list or not yet received): 87wrwrclv4.fsf-FLMGYpZoEPULwtHQx/[email protected]
Quoted 4 lines · Dan Smith
OL> I think the default behavior of 'checkpoint' should be to not OL> chekcpoint net-ns, at the very least in the subtree-checkpoint OL> case.
Quoted 8 lines
OL> I prefer the container case to also not include it by default.
OL> These can be tuned in the 'checkpoint' utility, or (better ?) OL> by using
CHECKPOINT_NETNSinstead ofCHECKPOINT_NONETNS...Okay, so you want to change NONETNS to NETNS and then make user-cr have a positive flag instead of a negative one, yes?
please ;)