[lxc-devel] [lxc/lxc] 1f5666: remove extra 'ret'
Branch: refs/heads/master Home: https://github.com/lxc/lxc Commit: 1f56665557fb75898cb9cbf550063cc8259cf9ad https://github.com/lxc/lxc/commit/1f56665557fb75898cb9cbf550063cc8259cf9ad Author: Tycho Andersen Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/criu.c Log Message: --- remove extra 'ret' Signed-off-by: Tycho Andersen Commit: f3886023c18ce703cb05425d33d8c4e3ca441a3f https://github.com/lxc/lxc/commit/f3886023c18ce703cb05425d33d8c4e3ca441a3f Author: Tycho Andersen Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/criu.c Log Message: --- c/r: write status only after trying to parse the pid Previously, we write a "success" status but tried to parse the pid. This meant that we wouldn't notice a successful restore but failure to parse the pid, which was a little strange. We still don't know the child pid, so we will end up with a restored process tree and a running container, but at least in this case the API will return false indicating that something failed. We could kill(-1, 9) in this case, but since liblxc runs as root sometimes (e.g. LXD), that would be a Very Bad Thing. Signed-off-by: Tycho Andersen Commit: 43ae0e64b7e1dd93a5b5dc6ffa1bf1a519402743 https://github.com/lxc/lxc/commit/43ae0e64b7e1dd93a5b5dc6ffa1bf1a519402743 Author: Christian Brauner Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/criu.c Log Message: --- Merge pull request #1155 from tych0/migration-fixes Migration fixes Compare: https://github.com/lxc/lxc/compare/605bb3c84783...43ae0e64b7e1___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/master] Migration fixes
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1155 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === From 1f56665557fb75898cb9cbf550063cc8259cf9ad Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Fri, 26 Aug 2016 16:13:06 -0400 Subject: [PATCH 1/2] remove extra 'ret' Signed-off-by: Tycho Andersen --- src/lxc/criu.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lxc/criu.c b/src/lxc/criu.c index c20c00a..5a48c72 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -749,8 +749,6 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_ ERROR("criu process exited %d, output:\n%s\n", WEXITSTATUS(status), buf); goto out_fini_handler; } else { - int ret; - ret = snprintf(buf, sizeof(buf), "/proc/self/task/%lu/children", (unsigned long)syscall(__NR_gettid)); if (ret < 0 || ret >= sizeof(buf)) { ERROR("snprintf'd too many characters: %d", ret); From f3886023c18ce703cb05425d33d8c4e3ca441a3f Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Fri, 26 Aug 2016 16:29:45 -0400 Subject: [PATCH 2/2] c/r: write status only after trying to parse the pid Previously, we write a "success" status but tried to parse the pid. This meant that we wouldn't notice a successful restore but failure to parse the pid, which was a little strange. We still don't know the child pid, so we will end up with a restored process tree and a running container, but at least in this case the API will return false indicating that something failed. We could kill(-1, 9) in this case, but since liblxc runs as root sometimes (e.g. LXD), that would be a Very Bad Thing. Signed-off-by: Tycho Andersen --- src/lxc/criu.c | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/lxc/criu.c b/src/lxc/criu.c index 5a48c72..71c9b9c 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -723,15 +723,6 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_ goto out_fini_handler; } - ret = write(status_pipe, &status, sizeof(status)); - close(status_pipe); - status_pipe = -1; - - if (sizeof(status) != ret) { - SYSERROR("failed to write all of status"); - goto out_fini_handler; - } - if (WIFEXITED(status)) { char buf[4096]; @@ -780,6 +771,15 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_ close(pipes[0]); + ret = write(status_pipe, &status, sizeof(status)); + close(status_pipe); + status_pipe = -1; + + if (sizeof(status) != ret) { + SYSERROR("failed to write all of status"); + goto out_fini_handler; + } + /* * See comment in lxcapi_start; we don't care if these * fail because it's just a beauty thing. We just @@ -805,7 +805,12 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_ out: if (status_pipe >= 0) { - status = 1; + /* ensure getting here was a failure, e.g. if we failed to +* parse the child pid or something, even after a successful +* restore +*/ + if (!status) + status = 1; if (write(status_pipe, &status, sizeof(status)) != sizeof(status)) { SYSERROR("writing status failed"); } ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/lxc] 476402: cleanup: tools: remove --name from lxc-top usage m...
Branch: refs/heads/stable-2.0 Home: https://github.com/lxc/lxc Commit: 476402ab6c7daea1db8ff103767dc88ac5331570 https://github.com/lxc/lxc/commit/476402ab6c7daea1db8ff103767dc88ac5331570 Author: Wolfgang Bumiller Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/tools/lxc_top.c Log Message: --- cleanup: tools: remove --name from lxc-top usage message It doesn't have any effect on what lxc-top does and is only accepted on account of being part of the common option list. Signed-off-by: Wolfgang Bumiller Commit: b4e66653f4c3ac0240e5ff810c74a44f554e2bac https://github.com/lxc/lxc/commit/b4e66653f4c3ac0240e5ff810c74a44f554e2bac Author: Wolfgang Bumiller Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/tools/lxc_execute.c Log Message: --- cleanup: whitespaces in option alignment for lxc-execute Signed-off-by: Wolfgang Bumiller Commit: 3b9494bd64334d9c02a4fd2f9af04fa839830667 https://github.com/lxc/lxc/commit/3b9494bd64334d9c02a4fd2f9af04fa839830667 Author: Stéphane Graber Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M templates/lxc-download.in Log Message: --- Use full GPG fingerprint instead of long IDs. With how easy it is to create a collision on a short ID nowadays and given that the user doesn't actually have to remember or manually enter the key ID, lets just use the full fingerprint from now on. Signed-off-by: Stéphane Graber Commit: fe3b02ff94da199a8a327b3e92b6e42f2d875a45 https://github.com/lxc/lxc/commit/fe3b02ff94da199a8a327b3e92b6e42f2d875a45 Author: Wolfgang Bumiller Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/arguments.c M src/lxc/arguments.h M src/lxc/tools/lxc_cgroup.c M src/lxc/tools/lxc_checkpoint.c M src/lxc/tools/lxc_console.c M src/lxc/tools/lxc_copy.c M src/lxc/tools/lxc_destroy.c M src/lxc/tools/lxc_device.c M src/lxc/tools/lxc_freeze.c M src/lxc/tools/lxc_info.c M src/lxc/tools/lxc_snapshot.c M src/lxc/tools/lxc_stop.c M src/lxc/tools/lxc_unfreeze.c M src/lxc/tools/lxc_wait.c Log Message: --- tools: move --rcfile to the common options list In almost all commands it's a useful addition to the -n switch which is a common option, too. Signed-off-by: Wolfgang Bumiller Commit: 700f5c364c4650149006131ded6baf4f85dcd32c https://github.com/lxc/lxc/commit/700f5c364c4650149006131ded6baf4f85dcd32c Author: Wolfgang Bumiller Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/tools/lxc_attach.c M src/lxc/tools/lxc_cgroup.c M src/lxc/tools/lxc_checkpoint.c M src/lxc/tools/lxc_console.c M src/lxc/tools/lxc_copy.c M src/lxc/tools/lxc_destroy.c M src/lxc/tools/lxc_device.c M src/lxc/tools/lxc_freeze.c M src/lxc/tools/lxc_info.c M src/lxc/tools/lxc_snapshot.c M src/lxc/tools/lxc_stop.c M src/lxc/tools/lxc_unfreeze.c M src/lxc/tools/lxc_wait.c Log Message: --- tools: set configfile after load_config In order to cause c->is_defined() to become true. Signed-off-by: Wolfgang Bumiller Commit: d36ccc89dbd1dd1e564a70999f0780d08e48cab5 https://github.com/lxc/lxc/commit/d36ccc89dbd1dd1e564a70999f0780d08e48cab5 Author: Wolfgang Bumiller Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M doc/common_options.sgml.in Log Message: --- doc: add --rcfile to common opts Signed-off-by: Wolfgang Bumiller Commit: d2fc8f3bac94504ff99c26bdbb31007703c8ac43 https://github.com/lxc/lxc/commit/d2fc8f3bac94504ff99c26bdbb31007703c8ac43 Author: Sungbae Yoo Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M doc/ko/lxc-attach.sgml.in Log Message: --- doc: Update Korean lxc-attach(1) * Update for commit 03b0398 * Fix mistranslation words Signed-off-by: Sungbae Yoo Commit: 88a2aad66bfd4aec5da8ff684572cb98a4ce981d https://github.com/lxc/lxc/commit/88a2aad66bfd4aec5da8ff684572cb98a4ce981d Author: Sungbae Yoo Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M doc/ko/common_options.sgml.in Log Message: --- doc: Add --rcfile to Korean common opts Update for commit 71d74a8 Signed-off-by: Sungbae Yoo Commit: e30ace060250dbf0ed50cb117db8f123779d6136 https://github.com/lxc/lxc/commit/e30ace060250dbf0ed50cb117db8f123779d6136 Author: Sungbae Yoo Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M doc/ja/common_options.sgml.in Log Message: --- doc: Add --rcfile to Japanese common opts Update for commit 71d74a8 Signed-off-by: Sungbae Yoo Commit: 2aec5fd4cacb53e191c4c0c31a50305078ae7c17 https://github.com/lxc/lxc/commit/2aec5fd4cacb53e191c4c0c31a50305078ae7c17 Author: Christian Brauner Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/tools/lxc_autostart.c M src/lxc/tools/lxc_cgroup.
[lxc-devel] [lxd/master] Make a database backup on schema updates
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2318 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Closes #2299 Signed-off-by: Stéphane Graber From efad6b50fa3e9291cabf149a1ec951e5d48ff35a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Fri, 26 Aug 2016 16:21:57 -0400 Subject: [PATCH] Make a database backup on schema updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #2299 Signed-off-by: Stéphane Graber --- lxd/db_update.go | 11 +++ 1 file changed, 11 insertions(+) diff --git a/lxd/db_update.go b/lxd/db_update.go index b3c6894..a5ea755 100644 --- a/lxd/db_update.go +++ b/lxd/db_update.go @@ -95,11 +95,22 @@ func (u *dbUpdate) apply(currentVersion int, d *Daemon) error { func dbUpdatesApplyAll(d *Daemon) error { currentVersion := dbGetSchema(d.db) + backup := false for _, update := range dbUpdates { if update.version <= currentVersion { continue } + if !backup { + shared.Log.Info("Updating the LXD database schema. Backup made as \"lxd.db.bak\"") + err := shared.FileCopy(shared.VarPath("lxd.db"), shared.VarPath("lxd.db.bak")) + if err != nil { + return err + } + + backup = true + } + err := update.apply(currentVersion, d) if err != nil { return err ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/lxc] 3eba9b: c/r: Fix pid_t on some arches
Branch: refs/heads/master Home: https://github.com/lxc/lxc Commit: 3eba9b495e5fda6067b636a7251780c035ceb527 https://github.com/lxc/lxc/commit/3eba9b495e5fda6067b636a7251780c035ceb527 Author: Stéphane Graber Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/criu.c Log Message: --- c/r: Fix pid_t on some arches Signed-off-by: Stéphane Graber Commit: 605bb3c847830999231ab8cb47d293f710454223 https://github.com/lxc/lxc/commit/605bb3c847830999231ab8cb47d293f710454223 Author: Christian Brauner Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/criu.c Log Message: --- Merge pull request #1154 from stgraber/master c/r: Fix pid_t on some arches Compare: https://github.com/lxc/lxc/compare/69dffc98e32c...605bb3c84783___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/master] c/r: Fix pid_t on some arches
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1154 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Stéphane Graber From 3eba9b495e5fda6067b636a7251780c035ceb527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Fri, 26 Aug 2016 15:41:34 -0400 Subject: [PATCH] c/r: Fix pid_t on some arches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- src/lxc/criu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/criu.c b/src/lxc/criu.c index 76d7080..c20c00a 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -751,7 +751,7 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_ } else { int ret; - ret = snprintf(buf, sizeof(buf), "/proc/self/task/%" PRId64 "/children", syscall(__NR_gettid)); + ret = snprintf(buf, sizeof(buf), "/proc/self/task/%lu/children", (unsigned long)syscall(__NR_gettid)); if (ret < 0 || ret >= sizeof(buf)) { ERROR("snprintf'd too many characters: %d", ret); goto out_fini_handler; ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/lxc] 75d219: c/r: use /proc/self/tid/children instead of pidfil...
Branch: refs/heads/master Home: https://github.com/lxc/lxc Commit: 75d219f0cc6be29d192677c5a8bd1bfd9528437b https://github.com/lxc/lxc/commit/75d219f0cc6be29d192677c5a8bd1bfd9528437b Author: Tycho Andersen Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/criu.c Log Message: --- c/r: use /proc/self/tid/children instead of pidfile All we really needed a unique temp file for was passing the pid. Since CRIU opened this with O_EXCL | O_CREAT, this was "safe" (users could still overwrite it afterwards, but the monitor would immediately die since the only valid number in there was the init process). In any case, we can just read /proc/self/tid/children, which lists the child process. Closes #1150 Signed-off-by: Tycho Andersen Commit: 69dffc98e32ce2f523073e108229d7d00e6493d9 https://github.com/lxc/lxc/commit/69dffc98e32ce2f523073e108229d7d00e6493d9 Author: Christian Brauner Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/criu.c Log Message: --- Merge pull request #1152 from tych0/fix-migration-2.0.4 c/r: use /proc/self/tid/children instead of pidfile Compare: https://github.com/lxc/lxc/compare/e854c5e31579...69dffc98e32c___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/master] c/r: use /proc/self/tid/children instead of pidfile
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1152 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === All we really needed a unique temp file for was passing the pid. Since CRIU opened this with O_EXCL | O_CREAT, this was "safe" (users could still overwrite it afterwards, but the monitor would immediately die since the only valid number in there was the init process). In any case, we can just read /proc/self/tid/children, which lists the child process. Closes #1150 Signed-off-by: Tycho Andersen From 9e77dc1781be15d4ca7a85aab5a8ac85b9db4bef Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Fri, 26 Aug 2016 16:07:19 + Subject: [PATCH] c/r: use /proc/self/tid/children instead of pidfile All we really needed a unique temp file for was passing the pid. Since CRIU opened this with O_EXCL | O_CREAT, this was "safe" (users could still overwrite it afterwards, but the monitor would immediately die since the only valid number in there was the init process). In any case, we can just read /proc/self/tid/children, which lists the child process. Closes #1150 Signed-off-by: Tycho Andersen --- src/lxc/criu.c | 38 ++ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/src/lxc/criu.c b/src/lxc/criu.c index 65998ed..f053e32 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -69,7 +69,6 @@ struct criu_opts { char tty_id[32]; /* the criu tty id for /dev/console, i.e. "tty[${rdev}:${dev}]" */ /* restore: the file to write the init process' pid into */ - char *pidfile; const char *cgroup_path; int console_fd; /* The path that is bind mounted from /dev/console, if any. We don't @@ -176,10 +175,10 @@ static void exec_criu(struct criu_opts *opts) static_args += 2; } else if (strcmp(opts->action, "restore") == 0) { /* --root $(lxc_mount_point) --restore-detached -* --restore-sibling --pidfile $foo --cgroup-root $foo +* --restore-sibling --cgroup-root $foo * --lsm-profile apparmor:whatever */ - static_args += 10; + static_args += 8; tty_info[0] = 0; if (load_tty_major_minor(opts->user->directory, tty_info, sizeof(tty_info))) @@ -330,8 +329,6 @@ static void exec_criu(struct criu_opts *opts) DECLARE_ARG(opts->c->lxc_conf->rootfs.mount); DECLARE_ARG("--restore-detached"); DECLARE_ARG("--restore-sibling"); - DECLARE_ARG("--pidfile"); - DECLARE_ARG(opts->pidfile); DECLARE_ARG("--cgroup-root"); DECLARE_ARG(opts->cgroup_path); @@ -604,13 +601,8 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_ { pid_t pid; struct lxc_handler *handler; - int fd, status; + int status; int pipes[2] = {-1, -1}; - char pidfile[] = "criu_restore_XX"; - - fd = mkstemp(pidfile); - if (fd < 0) - goto out; handler = lxc_init(c->name, c->lxc_conf, c->config_path); if (!handler) @@ -690,7 +682,6 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_ os.action = "restore"; os.user = opts; os.c = c; - os.pidfile = pidfile; os.cgroup_path = cgroup_canonical_path(handler); os.console_fd = c->lxc_conf->console.slave; os.criu_version = criu_version; @@ -742,8 +733,9 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_ } if (WIFEXITED(status)) { + char buf[4096]; + if (WEXITSTATUS(status)) { - char buf[4096]; int n; n = read(pipes[0], buf, sizeof(buf)); @@ -758,18 +750,21 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_ goto out_fini_handler; } else { int ret; - FILE *f = fdopen(fd, "r"); + + ret = snprintf(buf, sizeof(buf), "/proc/self/%" PRId64 "/children", syscall(__NR_gettid)); + if (ret < 0 || ret >= sizeof(buf)) { + ERROR("snprintf'd too many characters: %d", ret); + goto out_fini_handler; + } + + FILE *f = fopen(buf, "r"); if (!f) { -
[lxc-devel] [lxc/lxc] 30a5e4: tools: use boolean for ret in lxc_device.c
Branch: refs/heads/master Home: https://github.com/lxc/lxc Commit: 30a5e4367b05e393f32594014fb0d82b76f0a60a https://github.com/lxc/lxc/commit/30a5e4367b05e393f32594014fb0d82b76f0a60a Author: Christian Brauner Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/tools/lxc_device.c Log Message: --- tools: use boolean for ret in lxc_device.c Signed-off-by: Christian Brauner Commit: e854c5e315796a9efdce32518d46857792c67126 https://github.com/lxc/lxc/commit/e854c5e315796a9efdce32518d46857792c67126 Author: Serge Hallyn Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/tools/lxc_device.c Log Message: --- Merge pull request #1151 from brauner/2016-08-26/fix_lxc_device tools: use boolean for ret in lxc_device.c Compare: https://github.com/lxc/lxc/compare/fe8ded6d57e7...e854c5e31579___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/master] tools: use boolean for ret in lxc_device.c
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1151 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Christian Brauner As spotted by @hallyn. From 30a5e4367b05e393f32594014fb0d82b76f0a60a Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Fri, 26 Aug 2016 12:49:23 +0200 Subject: [PATCH] tools: use boolean for ret in lxc_device.c Signed-off-by: Christian Brauner --- src/lxc/tools/lxc_device.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/lxc/tools/lxc_device.c b/src/lxc/tools/lxc_device.c index abf52b9..39c560c 100644 --- a/src/lxc/tools/lxc_device.c +++ b/src/lxc/tools/lxc_device.c @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) { struct lxc_container *c; char *cmd, *dev_name, *dst_name; - int ret = 1; + bool ret = false; if (geteuid() != 0) { ERROR("%s must be run as root", argv[0]); @@ -164,7 +164,6 @@ int main(int argc, char *argv[]) } if (ret != true) { ERROR("Failed to add %s to %s.", dev_name, c->name); - ret = 1; goto err1; } INFO("Add %s to %s.", dev_name, c->name); @@ -176,7 +175,6 @@ int main(int argc, char *argv[]) } if (ret != true) { ERROR("Failed to del %s from %s.", dev_name, c->name); - ret = 1; goto err1; } INFO("Delete %s from %s.", dev_name, c->name); ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/lxc] b52b05: tools: use exit(EXIT_*) everywhere
Branch: refs/heads/master Home: https://github.com/lxc/lxc Commit: b52b0595913059cb18ac396ede5d42a63950f0a2 https://github.com/lxc/lxc/commit/b52b0595913059cb18ac396ede5d42a63950f0a2 Author: Christian Brauner Date: 2016-08-18 (Thu, 18 Aug 2016) Changed paths: M src/lxc/tools/lxc_autostart.c M src/lxc/tools/lxc_cgroup.c M src/lxc/tools/lxc_checkpoint.c M src/lxc/tools/lxc_config.c M src/lxc/tools/lxc_console.c M src/lxc/tools/lxc_device.c M src/lxc/tools/lxc_execute.c M src/lxc/tools/lxc_freeze.c M src/lxc/tools/lxc_info.c M src/lxc/tools/lxc_monitor.c M src/lxc/tools/lxc_start.c M src/lxc/tools/lxc_stop.c M src/lxc/tools/lxc_top.c M src/lxc/tools/lxc_unfreeze.c M src/lxc/tools/lxc_unshare.c M src/lxc/tools/lxc_usernsexec.c M src/lxc/tools/lxc_wait.c Log Message: --- tools: use exit(EXIT_*) everywhere Signed-off-by: Christian Brauner Commit: f0c6ee287ccdf55e3a533bf1bc085f94242036f1 https://github.com/lxc/lxc/commit/f0c6ee287ccdf55e3a533bf1bc085f94242036f1 Author: Christian Brauner Date: 2016-08-18 (Thu, 18 Aug 2016) Changed paths: M src/lxc/tools/lxc_clone.c M src/lxc/tools/lxc_config.c M src/lxc/tools/lxc_device.c M src/lxc/tools/lxc_unshare.c M src/lxc/tools/lxc_usernsexec.c Log Message: --- tools: unify exit() calls outside of main() This also changes the help exit status of lxc-unshare and lxc-usernsexec. So far they did exit(EXIT_FAILURE) whereas all other tools do exit(EXIT_SUCCESS). Let's align them with the rest of the tools. This should be safe to do. Signed-off-by: Christian Brauner Commit: fe8ded6d57e74c32238b8dc560b5d79807f4501e https://github.com/lxc/lxc/commit/fe8ded6d57e74c32238b8dc560b5d79807f4501e Author: Serge Hallyn Date: 2016-08-26 (Fri, 26 Aug 2016) Changed paths: M src/lxc/tools/lxc_autostart.c M src/lxc/tools/lxc_cgroup.c M src/lxc/tools/lxc_checkpoint.c M src/lxc/tools/lxc_clone.c M src/lxc/tools/lxc_config.c M src/lxc/tools/lxc_console.c M src/lxc/tools/lxc_device.c M src/lxc/tools/lxc_execute.c M src/lxc/tools/lxc_freeze.c M src/lxc/tools/lxc_info.c M src/lxc/tools/lxc_monitor.c M src/lxc/tools/lxc_start.c M src/lxc/tools/lxc_stop.c M src/lxc/tools/lxc_top.c M src/lxc/tools/lxc_unfreeze.c M src/lxc/tools/lxc_unshare.c M src/lxc/tools/lxc_usernsexec.c M src/lxc/tools/lxc_wait.c Log Message: --- Merge pull request #1139 from brauner/2016-08-18/use_exit_in_all_tools tools: use exit(EXIT_*) everywhere Compare: https://github.com/lxc/lxc/compare/ff475ab9ff63...fe8ded6d57e7___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
Re: [lxc-devel] File capability can not pass to process inside container
> Here is the questions: > 1) Does the lxc-2.0.0 supports file capability? If not, is there way make > it works. Nothing to do with lxc. THe kernel does not support file capabilities inside a user namespace as of yet. ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxcfs/master] bindings: revert cgroup check
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxcfs/pull/136 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === We do not need to check whether mode & W_OK is passed in. Even if the cgroup root mount is writeable operations like cg_mkdir() et al. will fail with e.g. EPERM. Basically all operations will fail on the cgroup root mount point because the first operation they perform is pick_controller_from_path(). That is to say they try to e.g. pick "blkio" from /var/lib/lxcfs/cgroup/blkio/some/cgroups an similiar for all other controllers. If pick_controller_from_path() fails they all return an appropriate errno. For example, cg_mkdir() does: controller = pick_controller_from_path(fc, path); if (!controller) return errno == ENOENT ? -EPERM : -errno; This means, we do not need to return an errno already in cg_access when mode & W_OK is passed in. This has the advantage that users are still able to descend into /var/lib/lxcfs/cgroup via: cd /var/lib/lxcfs/cgroup but are still blocked from doing any write operations. Signed-off-by: Christian Brauner From 5ccc353f1fb14ce36ad6ec738ca709336fe4d312 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 25 Aug 2016 22:33:07 +0200 Subject: [PATCH] bindings: revert cgroup check We do not need to check whether mode & W_OK is passed in. Even if the cgroup root mount is writeable operations like cg_mkdir() et al. will fail with e.g. EPERM. Basically all operations will fail on the cgroup root mount point because the first operation they perform is pick_controller_from_path(). That is to say they try to e.g. pick "blkio" from /var/lib/lxcfs/cgroup/blkio/some/cgroups an similiar for all other controllers. If pick_controller_from_path() fails they all return an appropriate errno. For example, cg_mkdir() does: controller = pick_controller_from_path(fc, path); if (!controller) return errno == ENOENT ? -EPERM : -errno; This means, we do not need to return an errno already in cg_access when mode & W_OK is passed in. This has the advantage that users are still able to descend into /var/lib/lxcfs/cgroup via: cd /var/lib/lxcfs/cgroup but are still blocked from doing any write operations. Signed-off-by: Christian Brauner --- bindings.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bindings.c b/bindings.c index 281aad2..8a5909a 100644 --- a/bindings.c +++ b/bindings.c @@ -1926,11 +1926,8 @@ int cg_access(const char *path, int mode) struct cgfs_files *k = NULL; struct fuse_context *fc = fuse_get_context(); - if (strcmp(path, "/cgroup") == 0) { - if ((mode & W_OK) == 0) - return -EACCES; + if (strcmp(path, "/cgroup") == 0) return 0; - } if (!fc) return -EIO; ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxcfs/master] don't use argv[0] in usage output
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxcfs/pull/134 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === otherwise this generates "funny" manpages like /home/remote/egolov/Devel/lxcfs/.libs/lt-lxcfs [-p pidfile] mountpoint /home/remote/egolov/Devel/lxcfs/.libs/lt-lxcfs -h or /build/lxcfs-8lNGve/lxcfs-2.0/.1/.libs/lt-lxcfs [-p pidfile] mountpoint /build/lxcfs-8lNGve/lxcfs-2.0/.1/.libs/lt-lxcfs -h Signed-off-by: Evgeni Golov From c3fb7d7fbdc2d9cb2e9e818ac8fce52442583921 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 26 Aug 2016 09:33:09 +0200 Subject: [PATCH] don't use argv[0] in usage output otherwise this generates "funny" manpages like /home/remote/egolov/Devel/lxcfs/.libs/lt-lxcfs [-p pidfile] mountpoint /home/remote/egolov/Devel/lxcfs/.libs/lt-lxcfs -h or /build/lxcfs-8lNGve/lxcfs-2.0/.1/.libs/lt-lxcfs [-p pidfile] mountpoint /build/lxcfs-8lNGve/lxcfs-2.0/.1/.libs/lt-lxcfs -h Signed-off-by: Evgeni Golov --- lxcfs.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lxcfs.c b/lxcfs.c index 47afe13..e745ce5 100644 --- a/lxcfs.c +++ b/lxcfs.c @@ -708,13 +708,13 @@ const struct fuse_operations lxcfs_ops = { .fgetattr = NULL, }; -static void usage(const char *me) +static void usage() { fprintf(stderr, "Usage:\n"); fprintf(stderr, "\n"); - fprintf(stderr, "%s [-p pidfile] mountpoint\n", me); + fprintf(stderr, "lxcfs [-p pidfile] mountpoint\n"); fprintf(stderr, " Default pidfile is %s/lxcfs.pid\n", RUNTIME_PATH); - fprintf(stderr, "%s -h\n", me); + fprintf(stderr, "lxcfs -h\n"); exit(1); } @@ -838,7 +838,7 @@ int main(int argc, char *argv[]) exit(EXIT_SUCCESS); } if (argc != 2 || is_help(argv[1])) - usage(argv[0]); + usage(); do_reload(); if (signal(SIGUSR1, reload_handler) == SIG_ERR) { ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel