Unverified Commit 2d6f6aa7 by Christian Brauner Committed by Stéphane Graber

commands: add TRACE()ers

parent 5702bdbb
...@@ -297,12 +297,20 @@ static int lxc_cmd(const char *name, struct lxc_cmd_rr *cmd, int *stopped, ...@@ -297,12 +297,20 @@ static int lxc_cmd(const char *name, struct lxc_cmd_rr *cmd, int *stopped,
return -1; return -1;
sock = lxc_abstract_unix_connect(path); sock = lxc_abstract_unix_connect(path);
TRACE("command %s tries to connect to \"@%s\"",
lxc_cmd_str(cmd->req.cmd), offset);
if (sock < 0) { if (sock < 0) {
if (errno == ECONNREFUSED) if (errno == ECONNREFUSED) {
TRACE("command %s failed to connect to \"@%s\": %s",
lxc_cmd_str(cmd->req.cmd), offset,
strerror(errno));
*stopped = 1; *stopped = 1;
else } else {
SYSERROR("Command %s failed to connect to \"@%s\".", SYSERROR("command %s failed to connect to \"@%s\": %s",
lxc_cmd_str(cmd->req.cmd), offset); lxc_cmd_str(cmd->req.cmd), offset,
strerror(errno));
}
return -1; return -1;
} }
...@@ -462,20 +470,26 @@ char *lxc_cmd_get_cgroup_path(const char *name, const char *lxcpath, ...@@ -462,20 +470,26 @@ char *lxc_cmd_get_cgroup_path(const char *name, const char *lxcpath,
}; };
ret = lxc_cmd(name, &cmd, &stopped, lxcpath, NULL); ret = lxc_cmd(name, &cmd, &stopped, lxcpath, NULL);
if (ret < 0) if (ret < 0) {
TRACE("command %s failed for container \"%s\": %s.",
lxc_cmd_str(cmd.req.cmd), name, strerror(errno));
return NULL; return NULL;
}
if (!ret) { if (!ret) {
WARN("Container \"%s\" has stopped before sending its state.", name); WARN("container \"%s\" has stopped before sending its state", name);
return NULL; return NULL;
} }
if (cmd.rsp.ret < 0 || cmd.rsp.datalen < 0) { if (cmd.rsp.ret < 0 || cmd.rsp.datalen < 0) {
ERROR("Command %s failed for container \"%s\": %s.", ERROR("command %s failed for container \"%s\": %s",
lxc_cmd_str(cmd.req.cmd), name, strerror(-cmd.rsp.ret)); lxc_cmd_str(cmd.req.cmd), name, strerror(-cmd.rsp.ret));
return NULL; return NULL;
} }
TRACE("command %s successful for container \"%s\"",
lxc_cmd_str(cmd.req.cmd), name);
return cmd.rsp.data; return cmd.rsp.data;
} }
......
...@@ -370,6 +370,7 @@ int lxc_poll(const char *name, struct lxc_handler *handler) ...@@ -370,6 +370,7 @@ int lxc_poll(const char *name, struct lxc_handler *handler)
DEBUG("Not starting utmp handler as CAP_SYS_BOOT cannot be dropped without capabilities support."); DEBUG("Not starting utmp handler as CAP_SYS_BOOT cannot be dropped without capabilities support.");
#endif #endif
} }
TRACE("lxc mainloop is ready");
return lxc_mainloop(&descr, -1); return lxc_mainloop(&descr, -1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment