Skip to contentSkip to conversation

Rename --directory option to --statefile

PATCH In review Sukadev Bhattiprolu 4 participants 10 messages Feb 24, 2010 8 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Rename --directory option to --statefile

----
From 94fe79c36ac3aed69c8d97f8e4d17c9b02961b97 Mon Sep 17 00:00:00 2001
From: Sukadev Bhattiprolu <[email protected]>
Date: Tue, 23 Feb 2010 17:47:51 -0800
Subject: [PATCH 1/2] Rename --directory option to --statefile

[See following mail for an intro to this patch set

https://lists.linux-foundation.org/pipermail/containers/2010-February/023048.html]

The --directory is misleading since the option seems to expect an checkpoint image file.

---
 src/lxc/lxc_restart.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
src/lxc/lxc_restart.c +5 -5
index 7db1d85..83d3d7b 100644
@@ -52,7 +52,7 @@ static int my_checker(const struct lxc_arguments* args)
 static int my_parser(struct lxc_arguments* args, int c, char* arg)
 {
 	switch (c) {
-	case 'd': args->statefile = arg; break;
+	case 'i': args->statefile = arg; break;
 	case 'f': args->rcfile = arg; break;
 	case 'p': args->flags = LXC_FLAG_PAUSE; break;
 	case 's': return lxc_config_define_add(&defines, arg);
@@ -62,7 +62,7 @@ static int my_parser(struct lxc_arguments* args, int c, char* arg)
 }
 
 static const struct option my_longopts[] = {
-	{"directory", required_argument, 0, 'd'},
+	{"statefile", required_argument, 0, 'i'},
 	{"rcfile", required_argument, 0, 'f'},
 	{"pause", no_argument, 0, 'p'},
 	{"define", required_argument, 0, 's'},
@@ -72,14 +72,14 @@ static const struct option my_longopts[] = {
 static struct lxc_arguments my_args = {
 	.progname = "lxc-restart",
 	.help     = "\
---name=NAME --directory STATEFILE\n\
+--name=NAME --statefile STATEFILE\n\
 \n\
-lxc-restart restarts from STATEFILE the NAME container\n\
+lxc-restart restarts from checkpoint image STATEFILE the NAME container\n\
 \n\
 Options :\n\
   -n, --name=NAME      NAME for name of the container\n\
   -p, --pause          do not release the container after the restart\n\
-  -d, --directory=STATEFILE for name of statefile\n\
+  -i, --statefile=STATEFILE for name of statefile\n\
   -f, --rcfile=FILE Load configuration file FILE\n\
   -s, --define KEY=VAL Assign VAL to configuration variable KEY\n",
 	.options  = my_longopts,
Signature · 1 line
1.6.6.1

A message that is not in the archive (sent off-list or not yet received): 20100224084108.GG18758-r/[email protected]

#2 lore raw

PATCH 2/2 Have lxc_restart call app_restart()

From 86023fbab91bc5c7a727e43e853615f27b70fbcf Mon Sep 17 00:00:00 2001
From: Sukadev Bhattiprolu <[email protected]>
Date: Tue, 23 Feb 2010 22:38:14 -0800
Subject: [PATCH 2/2][LXC] Have lxc_restart call app_restart()

Have lxc_restart() call app_restart() exported by libcheckpoint.a from the USER-CR git tree.

TODO: - Similarly implement lxc_checkpoint
- Use dynamic linking with liblxc.so

---
 src/lxc/Makefile2 |   16 +++++++++
 src/lxc/restart.c |   91 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 107 insertions(+), 0 deletions(-)
 create mode 100644 src/lxc/Makefile2
src/lxc/Makefile2 new file +16 -0
new file mode 100644
index 0000000..9aba841
@@ -0,0 +1,16 @@
+
+CFLAGS = -static -I . -I ..
+
+LDFLAGS = /lib/libcheckpoint.a -lutil
+
+LXC_OBJS = start.o conf.o confile.o arguments.o monitor.o log.o mainloop.o \
+		utils.o commands.o state.o cgroup.o error.o namespace.o \
+		parse.o network.o af_unix.o console.o nl.o stop.o
+
+RESTART_OBJS = $(LXC_OBJS) lxc_restart.o restart.o
+
+lxc_restart: $(RESTART_OBJS)
+	$(CC) -o lxc_restart $(RESTART_OBJS) $(LDFLAGS)
+
+clean:
+	rm -f $(RESTART_OBJS)
src/lxc/restart.c +91 -0

102 lines not on this page · raw message

Signature · 1 line
1.6.6.1

A message that is not in the archive (sent off-list or not yet received): 20100224084156.GH18758-r/[email protected]

#4 lore raw

Re: [PATCH 2/2][LXC] Have lxc_restart call app_restart()

Quoted 12 lines · Sukadev Bhattiprolu
src/lxc/Makefile2 new file +6 -0
new file mode 100644
index 0000000..9aba841
@@ -0,0 +1,16 @@
+
+CFLAGS = -static -I . -I ..
+
+LDFLAGS = /lib/libcheckpoint.a -lutil
+
+LXC_OBJS = start.o conf.o confile.o arguments.o monitor.o log.o mainloop.o \

src/lxc/Makefile2 line 16

Quoted 10 lines
src/lxc/Makefile2 new file +10 -0
+		utils.o commands.o state.o cgroup.o error.o namespace.o \
+		parse.o network.o af_unix.o console.o nl.o stop.o
+
+RESTART_OBJS = $(LXC_OBJS) lxc_restart.o restart.o
+
+lxc_restart: $(RESTART_OBJS)
+	$(CC) -o lxc_restart $(RESTART_OBJS) $(LDFLAGS)
+
+clean:
+	rm -f $(RESTART_OBJS)

you should patch Makefile.am.

C.

A message that is not in the archive (sent off-list or not yet received): 4B84E80A.7060208-NmTC/[email protected]

#7 lore raw
Quoted 6 lines · Cedric Le Goater
Quoted 5 lines · Sukadev Bhattiprolu

[See following mail for an intro to this patch set

https://lists.linux-foundation.org/pipermail/containers/2010-February/023048.html]

Quoted 7 lines
Quoted 2 lines

The --directory is misleading since the option seems to expect an checkpoint image file.

sigh.

This has some major impact on our side as it is a 9 year old API ... We'll look into it to see how painful it is to change.

We can keep --directory and add --statefile.
For --statefile option we can use a switch for IS_DIR, IS_REG.

--directory becomes deprecated and we switch to the statefile option step by step.

Does it make sense ?

-- Daniel

A message that is not in the archive (sent off-list or not yet received): 4B84E94E.3000406-NmTC/[email protected]

#9 lore raw
Quoted 9 lines · Daniel Lezcano [dlezcano-NmTC/[email protected]] wrote:
Quoted 8 lines · Cedric Le Goater
Quoted 7 lines · Sukadev Bhattiprolu

[See following mail for an intro to this patch set

https://lists.linux-foundation.org/pipermail/containers/2010-February/023048.html]

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

The --directory is misleading since the option seems to expect an checkpoint image file.

sigh.

This has some major impact on our side as it is a 9 year old API ... We'll look into it to see how painful it is to change.

Ah, did not realize it caused that much pain.

Quoted 8 lines

We can keep --directory and add --statefile.
For --statefile option we can use a switch for IS_DIR, IS_REG.

--directory becomes deprecated and we switch to the statefile option step by step.

Does it make sense ?

Yes, I think it will work.

BTW, what was the rationale for a directory ? Is it meant to be used with predefined file names in the specified directory ?

Quoted 2 lines

-- Daniel

A message that is not in the archive (sent off-list or not yet received): 20100224181150.GA3276-r/[email protected]

#11 lore raw
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

This has some major impact on our side as it is a 9 year old API ... We'll look into it to see how painful it is to change.

Ah, did not realize it caused that much pain.

bah. we should change anyway.

Quoted 6 lines
Quoted 6 lines

We can keep --directory and add --statefile.
For --statefile option we can use a switch for IS_DIR, IS_REG.

--directory becomes deprecated and we switch to the statefile option step by step.

Quoted 6 lines
Quoted 1 line

Does it make sense ?

Yes, I think it will work.

BTW, what was the rationale for a directory ? Is it meant to be used with predefined file names in the specified directory ?

the mcr statefile use to be a directory, organized in such a way it was easy to analyze its contents and easy to restart concurrently tasks and shared states. it's still a directory but it's shrinking to be a file and even a stream.

your request makes sense for the long term so we should take it.

c.

A message that is not in the archive (sent off-list or not yet received): 4B856BC8.5060000-NmTC/[email protected]

#13 lore raw
Quoted 20 lines · Cedric Le Goater
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines

This has some major impact on our side as it is a 9 year old API ... We'll look into it to see how painful it is to change.

Ah, did not realize it caused that much pain.

bah. we should change anyway.

Quoted 6 lines
Quoted 6 lines

We can keep --directory and add --statefile.
For --statefile option we can use a switch for IS_DIR, IS_REG.

--directory becomes deprecated and we switch to the statefile option step by step.

Quoted 6 lines
Quoted 1 line

Does it make sense ?

Yes, I think it will work.

BTW, what was the rationale for a directory ? Is it meant to be used with predefined file names in the specified directory ?

Quoted 8 lines

the mcr statefile use to be a directory, organized in such a way it was easy to analyze its contents and easy to restart concurrently tasks and shared states. it's still a directory but it's shrinking to be a file and even a stream.

your request makes sense for the long term so we should take it.

c.

Are we sure that we won't find other information which lxc_checkpoint will want to store which sys_checkpoint() ignores? A link to a btrfs snapshot, for instance.

-serge

A message that is not in the archive (sent off-list or not yet received): 20100224183024.GA22624-r/[email protected]

#15 lore raw
Quoted 3 lines · Serge E. Hallyn

Are we sure that we won't find other information which lxc_checkpoint will want to store which sys_checkpoint() ignores? A link to a btrfs snapshot, for instance.

after having froze the container and before running the lxc-checkpoint command, one should be free to prepend information to the statefile. no ?

C.

A message that is not in the archive (sent off-list or not yet received): 4B85725C.3010002-NmTC/[email protected]

#17 lore raw
Quoted 7 lines · Cedric Le Goater
Quoted 3 lines · Serge E. Hallyn

Are we sure that we won't find other information which lxc_checkpoint will want to store which sys_checkpoint() ignores? A link to a btrfs snapshot, for instance.

after having froze the container and before running the lxc-checkpoint command, one should be free to prepend information to the statefile. no ?

Hmm, that might work. I"ll leave it for Oren to answer that :)

-serge