mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-09 01:50:35 +00:00
fix lxc-wait waiting forever for FREEZING, FROZEN, THAWED states
These states are kept by the kernel in the freezer.state cgroup item, and are never set in handler->state with lxc_set_state(). If lxc transitions a container to/from the freezer after an lxc-wait for one of the above states has already started, the lxc-wait will never see the new state. This change has lxc send the new state to the lxc-monitor socket. Signed-off-by: Dwight Engen <dwight.engen@oracle.com> Acked-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
parent
e35cb41b8c
commit
d27b0806cd
@ -32,6 +32,8 @@
|
|||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
#include "state.h"
|
||||||
|
#include "monitor.h"
|
||||||
|
|
||||||
#include <lxc/log.h>
|
#include <lxc/log.h>
|
||||||
#include <lxc/cgroup.h>
|
#include <lxc/cgroup.h>
|
||||||
@ -95,7 +97,10 @@ static int freeze_unfreeze(const char *name, int freeze)
|
|||||||
|
|
||||||
ret = strncmp(f, tmpf, strlen(f));
|
ret = strncmp(f, tmpf, strlen(f));
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
{
|
||||||
|
lxc_monitor_send_state(name, freeze ? FROZEN : THAWED);
|
||||||
break; /* Success */
|
break; /* Success */
|
||||||
|
}
|
||||||
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
@ -119,6 +124,7 @@ out:
|
|||||||
|
|
||||||
int lxc_freeze(const char *name)
|
int lxc_freeze(const char *name)
|
||||||
{
|
{
|
||||||
|
lxc_monitor_send_state(name, FREEZING);
|
||||||
return freeze_unfreeze(name, 1);
|
return freeze_unfreeze(name, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ Options :\n\
|
|||||||
-n, --name=NAME NAME for name of the container\n\
|
-n, --name=NAME NAME for name of the container\n\
|
||||||
-s, --state=STATE ORed states to wait for\n\
|
-s, --state=STATE ORed states to wait for\n\
|
||||||
STOPPED, STARTING, RUNNING, STOPPING,\n\
|
STOPPED, STARTING, RUNNING, STOPPING,\n\
|
||||||
ABORTING, FREEZING, FROZEN\n\
|
ABORTING, FREEZING, FROZEN, THAWED\n\
|
||||||
-t, --timeout=TMO Seconds to wait for state changes\n",
|
-t, --timeout=TMO Seconds to wait for state changes\n",
|
||||||
.options = my_longopts,
|
.options = my_longopts,
|
||||||
.parser = my_parser,
|
.parser = my_parser,
|
||||||
|
Loading…
Reference in New Issue
Block a user