]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
commands: add TRACE()ers
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 9 Jun 2017 15:20:20 +0000 (17:20 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 12 Jun 2017 22:58:25 +0000 (00:58 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/commands.c
src/lxc/start.c

index bb354a50544140e62b78c83b45b8ede7bff09ad1..d9f955fc0c9c88e07948b38c6ad3e6b8317f78e0 100644 (file)
@@ -297,12 +297,20 @@ static int lxc_cmd(const char *name, struct lxc_cmd_rr *cmd, int *stopped,
                return -1;
 
        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 (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;
-               else
-                       SYSERROR("Command %s failed to connect to \"@%s\".",
-                                lxc_cmd_str(cmd->req.cmd), offset);
+               } else {
+                       SYSERROR("command %s failed to connect to \"@%s\": %s",
+                                lxc_cmd_str(cmd->req.cmd), offset,
+                                strerror(errno));
+               }
+
                return -1;
        }
 
@@ -462,20 +470,26 @@ char *lxc_cmd_get_cgroup_path(const char *name, const char *lxcpath,
        };
 
        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;
+       }
 
        if (!ret) {
-               WARN("Container \"%s\" has stopped before sending its state.", name);
+               WARN("container \"%s\" has stopped before sending its state", name);
                return NULL;
        }
 
        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));
                return NULL;
        }
 
+       TRACE("command %s successful for container \"%s\"",
+             lxc_cmd_str(cmd.req.cmd), name);
+
        return cmd.rsp.data;
 }
 
index fbc196692f8e5e3cf670691db918ebd2e6675c8a..0d1bdb5cca69fd792005aa9d02d4f70a6df1aa90 100644 (file)
@@ -384,6 +384,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.");
                #endif
        }
+       TRACE("lxc mainloop is ready");
 
        return lxc_mainloop(&descr, -1);