mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-27 16:18:16 +00:00
start: lxc_destroy_container_on_signal()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
4c8e880e32
commit
ae3beac9af
@ -1980,28 +1980,29 @@ static void lxc_destroy_container_on_signal(struct lxc_handler *handler,
|
|||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
char destroy[MAXPATHLEN];
|
char destroy[MAXPATHLEN];
|
||||||
bool bret = true;
|
|
||||||
int ret = 0;
|
|
||||||
struct lxc_container *c;
|
struct lxc_container *c;
|
||||||
|
int ret = 0;
|
||||||
|
bool bret = true;
|
||||||
|
|
||||||
if (handler->conf->rootfs.path && handler->conf->rootfs.mount) {
|
if (handler->conf->rootfs.path && handler->conf->rootfs.mount) {
|
||||||
bret = do_destroy_container(handler);
|
bret = do_destroy_container(handler);
|
||||||
if (!bret) {
|
if (!bret) {
|
||||||
ERROR("Error destroying rootfs for container \"%s\".", name);
|
ERROR("Error destroying rootfs for container \"%s\"", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
INFO("Destroyed rootfs for container \"%s\".", name);
|
INFO("Destroyed rootfs for container \"%s\"", name);
|
||||||
|
|
||||||
ret = snprintf(destroy, MAXPATHLEN, "%s/%s", handler->lxcpath, name);
|
ret = snprintf(destroy, MAXPATHLEN, "%s/%s", handler->lxcpath, name);
|
||||||
if (ret < 0 || ret >= MAXPATHLEN) {
|
if (ret < 0 || ret >= MAXPATHLEN) {
|
||||||
ERROR("Error destroying directory for container \"%s\".", name);
|
ERROR("Error destroying directory for container \"%s\"", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
c = lxc_container_new(name, handler->lxcpath);
|
c = lxc_container_new(name, handler->lxcpath);
|
||||||
if (c) {
|
if (c) {
|
||||||
if (container_disk_lock(c)) {
|
if (container_disk_lock(c)) {
|
||||||
INFO("Could not update lxc_snapshots file.");
|
INFO("Could not update lxc_snapshots file");
|
||||||
lxc_container_put(c);
|
lxc_container_put(c);
|
||||||
} else {
|
} else {
|
||||||
mod_all_rdeps(c, false);
|
mod_all_rdeps(c, false);
|
||||||
@ -2017,10 +2018,10 @@ static void lxc_destroy_container_on_signal(struct lxc_handler *handler,
|
|||||||
ret = lxc_rmdir_onedev(destroy, NULL);
|
ret = lxc_rmdir_onedev(destroy, NULL);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
ERROR("Error destroying directory for container \"%s\".", name);
|
ERROR("Error destroying directory for container \"%s\"", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
INFO("Destroyed directory for container \"%s\".", name);
|
INFO("Destroyed directory for container \"%s\"", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lxc_rmdir_onedev_wrapper(void *data)
|
static int lxc_rmdir_onedev_wrapper(void *data)
|
||||||
|
Loading…
Reference in New Issue
Block a user