]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-info to report the FROZEN state
authorMichel Normand <normand@fr.ibm.com>
Tue, 24 Nov 2009 08:47:27 +0000 (09:47 +0100)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Tue, 24 Nov 2009 08:47:27 +0000 (09:47 +0100)
this state is reported when the lxc-freeze command
was issued on the container.

Signed-off-by: Michel Normand <normand@fr.ibm.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/state.c
src/lxc/state.h

index 04966579de1a9ab6f8226838f6af77e398e89eb8..029f0ae81ee7a6b4ec546bae13f79b289051c5ec 100644 (file)
@@ -40,7 +40,7 @@ lxc_log_define(lxc_state, lxc);
 
 static char *strstate[] = {
        "STOPPED", "STARTING", "RUNNING", "STOPPING",
-       "ABORTING", "FREEZING", "FROZEN",
+       "ABORTING", "FREEZING", "FROZEN", "THAWED",
 };
 
 const char *lxc_state2str(lxc_state_t state)
@@ -72,13 +72,17 @@ int lxc_rmstate(const char *name)
 
 static int freezer_state(const char *name)
 {
+       char *nsgroup;
        char freezer[MAXPATHLEN];
        char status[MAXPATHLEN];
        FILE *file;
        int err;
 
-       snprintf(freezer, MAXPATHLEN,
-                LXCPATH "/%s/freezer.state", name);
+       err = lxc_cgroup_path_get(&nsgroup, name);
+       if (err)
+               return -1;
+
+       snprintf(freezer, MAXPATHLEN, "%s/freezer.state", nsgroup);
 
        file = fopen(freezer, "r");
        if (!file)
@@ -95,7 +99,7 @@ static int freezer_state(const char *name)
        return lxc_str2state(status);
 }
 
-lxc_state_t lxc_getstate(const char *name)
+static lxc_state_t __lxc_getstate(const char *name)
 {
        struct lxc_command command = {
                .request = { .type = LXC_COMMAND_STATE },
@@ -128,11 +132,11 @@ lxc_state_t lxc_getstate(const char *name)
        return command.answer.ret;
 }
 
-lxc_state_t lxc_state(const char *name)
+lxc_state_t lxc_getstate(const char *name)
 {
        int state = freezer_state(name);
        if (state != FROZEN && state != FREEZING)
-               state = lxc_getstate(name);
+               state = __lxc_getstate(name);
        return state;
 }
 
index c56860d70793e8352a4213094fb4d53223c2e079..f64169873098b3dbca495b549447b2e14c7930f6 100644 (file)
@@ -25,7 +25,7 @@
 
 typedef enum {
        STOPPED, STARTING, RUNNING, STOPPING,
-       ABORTING, FREEZING, FROZEN, MAX_STATE,
+       ABORTING, FREEZING, FROZEN, THAWED, MAX_STATE,
 } lxc_state_t;
 
 extern int lxc_rmstate(const char *name);