[lxc-devel] [go-lxc/v2] c/r: add support for liblxc's ghost_limit
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/go-lxc/pull/64 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: Tycho Andersen From 091761630c651f5725385c2b0db5a73b60c86556 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Tue, 19 Jul 2016 14:41:15 -0600 Subject: [PATCH] c/r: add support for liblxc's ghost_limit Signed-off-by: Tycho Andersen --- container.go | 1 + lxc-binding.c | 1 + lxc-binding.h | 1 + options.go| 1 + 4 files changed, 4 insertions(+) diff --git a/container.go b/container.go index 5d253f8..82bf1ef 100644 --- a/container.go +++ b/container.go @@ -1527,6 +1527,7 @@ func (c *Container) Migrate(cmd uint, opts MigrateOptions) error { extras := C.struct_extra_migrate_opts{ preserves_inodes: C.bool(opts.PreservesInodes), action_script:cActionScript, + ghost_limit: C.uint64_t(opts.GhostLimit), } ret := C.int(C.go_lxc_migrate(c.container, C.uint(cmd), &copts, &extras)) diff --git a/lxc-binding.c b/lxc-binding.c index 7712d8e..4592b68 100644 --- a/lxc-binding.c +++ b/lxc-binding.c @@ -368,6 +368,7 @@ bool go_lxc_restore(struct lxc_container *c, char *directory, bool verbose) { int go_lxc_migrate(struct lxc_container *c, unsigned int cmd, struct migrate_opts *opts, struct extra_migrate_opts *extras) { #if VERSION_AT_LEAST(2, 0, 4) opts->action_script = extras->action_script; + opts->ghost_limit = extras->ghost_limit; #endif #if VERSION_AT_LEAST(2, 0, 1) diff --git a/lxc-binding.h b/lxc-binding.h index da046f0..f7ccd84 100644 --- a/lxc-binding.h +++ b/lxc-binding.h @@ -88,6 +88,7 @@ struct migrate_opts { struct extra_migrate_opts { bool preserves_inodes; char *action_script; + uint64_t ghost_limit; }; int go_lxc_migrate(struct lxc_container *c, unsigned int cmd, struct migrate_opts *opts, struct extra_migrate_opts *extras); diff --git a/options.go b/options.go index 47dc392..5b53c60 100644 --- a/options.go +++ b/options.go @@ -195,4 +195,5 @@ type MigrateOptions struct { PredumpDir string PreservesInodes bool ActionScriptstring + GhostLimit uint64 } ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/lxc] b2b7b0: c/r: add support for ghost-limit in CRIU
Branch: refs/heads/master Home: https://github.com/lxc/lxc Commit: b2b7b0d22395929f822a0c524e31bdc099e758d0 https://github.com/lxc/lxc/commit/b2b7b0d22395929f822a0c524e31bdc099e758d0 Author: Tycho Andersen Date: 2016-07-19 (Tue, 19 Jul 2016) Changed paths: M src/lxc/criu.c M src/lxc/lxccontainer.h Log Message: --- c/r: add support for ghost-limit in CRIU This is an old option that we probably should have exposed long ago :) Signed-off-by: Tycho Andersen Commit: e4203378cce12058ff16c8746fb89ac7568a4f26 https://github.com/lxc/lxc/commit/e4203378cce12058ff16c8746fb89ac7568a4f26 Author: Christian Brauner Date: 2016-07-20 (Wed, 20 Jul 2016) Changed paths: M src/lxc/criu.c M src/lxc/lxccontainer.h Log Message: --- Merge pull request #1089 from tych0/ghost-limit c/r: add support for ghost-limit in CRIU Compare: https://github.com/lxc/lxc/compare/bafda6b63ba3...e4203378cce1___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/master] c/r: add support for ghost-limit in CRIU
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1089 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) === This is an old option that we probably should have exposed long ago :) Signed-off-by: Tycho Andersen From b2b7b0d22395929f822a0c524e31bdc099e758d0 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Tue, 19 Jul 2016 14:27:26 -0600 Subject: [PATCH] c/r: add support for ghost-limit in CRIU This is an old option that we probably should have exposed long ago :) Signed-off-by: Tycho Andersen --- src/lxc/criu.c | 17 + src/lxc/lxccontainer.h | 6 ++ 2 files changed, 23 insertions(+) diff --git a/src/lxc/criu.c b/src/lxc/criu.c index 804fd41..d330d72 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -169,6 +169,10 @@ static void exec_criu(struct criu_opts *opts) /* --force-irmap */ if (!opts->user->preserves_inodes) static_args++; + + /* --ghost-limit 1024 */ + if (opts->user->ghost_limit) + static_args += 2; } else if (strcmp(opts->action, "restore") == 0) { /* --root $(lxc_mount_point) --restore-detached * --restore-sibling --pidfile $foo --cgroup-root $foo @@ -300,6 +304,19 @@ static void exec_criu(struct criu_opts *opts) if (!opts->user->preserves_inodes) DECLARE_ARG("--force-irmap"); + if (opts->user->ghost_limit) { + char ghost_limit[32]; + + ret = sprintf(ghost_limit, "%lu", opts->user->ghost_limit); + if (ret < 0 || ret >= sizeof(ghost_limit)) { + ERROR("failed to print ghost limit %lu", opts->user->ghost_limit); + goto err; + } + + DECLARE_ARG("--ghost-limit"); + DECLARE_ARG(ghost_limit); + } + /* only for final dump */ if (strcmp(opts->action, "dump") == 0 && !opts->user->stop) DECLARE_ARG("--leave-running"); diff --git a/src/lxc/lxccontainer.h b/src/lxc/lxccontainer.h index e4915d2..06bec58 100644 --- a/src/lxc/lxccontainer.h +++ b/src/lxc/lxccontainer.h @@ -902,6 +902,12 @@ struct migrate_opts { * unconditionally disable this feature. In-flight connections are * not fully established TCP connections: SYN, SYN-ACK */ bool disable_skip_in_flight; + + /* This is the maximum file size for deleted files (which CRIU calls +* "ghost" files) that will be handled. 0 indicates the CRIU default, +* which at this time is 1MB. +*/ + uint64_t ghost_limit; }; /*! ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxd/master] Document image export target behavior and fix bugs
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2216 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) === Add help documentation for the target of `image export`. If the target is a file, append the appropriate file extension to the user-provided filename. Properly parse the Content-Disposition header to retrieve the image's filename instead of assuming `filename` is the only parameter in the header. Fix a bug where specifying a filename (as opposed to a directory) would create the file with incorrect permissions (664 instead of 600). Fixes #2205 Signed-off-by: Sean Christopherson From 8d8f813ca0dd80a24f9635092b2b870ced8cc2ff Mon Sep 17 00:00:00 2001 From: Sean Christopherson Date: Tue, 19 Jul 2016 10:14:59 -0700 Subject: [PATCH] Document image export target behavior and fix bugs Add help documentation for the target of `image export`. If the target is a file, append the appropriate file extension to the user-provided filename. Properly parse the Content-Disposition header to retrieve the image's filename instead of assuming `filename` is the only parameter in the header. Fix a bug where specifying a filename (as opposed to a directory) would create the file with incorrect permissions (664 instead of 600). Fixes #2205 Signed-off-by: Sean Christopherson --- client.go | 60 +++--- lxc/image.go | 11 - po/lxd.pot| 115 +++--- test/suites/basic.sh | 7 ++- test/suites/remote.sh | 6 +-- 5 files changed, 105 insertions(+), 94 deletions(-) diff --git a/client.go b/client.go index 3e0d791..533773f 100644 --- a/client.go +++ b/client.go @@ -845,56 +845,44 @@ func (c *Client) ExportImage(image string, target string) (string, error) { if target == "-" { wr = os.Stdout destpath = "stdout" - } else if fi, err := os.Stat(target); err == nil { - // file exists, so check if folder - switch mode := fi.Mode(); { - case mode.IsDir(): - // save in directory, header content-disposition can not be null - // and will have a filename - cd := strings.Split(raw.Header["Content-Disposition"][0], "=") - - // write filename from header - destpath = filepath.Join(target, cd[1]) - f, err := os.Create(destpath) - defer f.Close() - - if err != nil { - return "", err - } - - wr = f - - default: - // overwrite file - destpath = target - f, err := os.OpenFile(destpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) - defer f.Close() + } else { + _, cdParams, err := mime.ParseMediaType(raw.Header.Get("Content-Disposition")) + if err != nil { + return "", err + } + filename, ok := cdParams["filename"] + if !ok { + return "", fmt.Errorf("No filename in Content-Disposition header.") + } - if err != nil { - return "", err + if fi, err := os.Stat(target); err == nil && fi.Mode().IsDir() { + // The target is a directory, use the filename verbatim from the + // Content-Disposition header + destpath = filepath.Join(target, filename) + } else { + // The target is a file, parse the extension from the source filename + // and append it to the target filename. + ext := filepath.Ext(filename) + if strings.HasSuffix(filename, fmt.Sprintf(".tar%s", ext)) { + ext = fmt.Sprintf(".tar%s", ext) } - - wr = f + destpath = fmt.Sprintf("%s%s", target, ext) } - } else { - // write as simple file - destpath = target - f, err := os.Create(destpath) - defer f.Close() - wr = f + f, err := os.OpenFile(destpath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) if err != nil { return "", err } + defer f.Close() + + wr = f } _, err = io.Copy(wr, raw.Body) - if err != nil { return "", err } - // it streams to stdout or file, so
[lxc-devel] [lxc/lxc] 330ae3: lxccontainer: detect if we should send SIGRTMIN+3
Branch: refs/heads/master Home: https://github.com/lxc/lxc Commit: 330ae3d350e060e5702a0e5ef5d0faa8df6e https://github.com/lxc/lxc/commit/330ae3d350e060e5702a0e5ef5d0faa8df6e Author: Christian Brauner Date: 2016-07-19 (Tue, 19 Jul 2016) Changed paths: M src/lxc/lxccontainer.c M src/lxc/utils.c M src/lxc/utils.h Log Message: --- lxccontainer: detect if we should send SIGRTMIN+3 This is required by systemd to cleanly shutdown. Other init systems should not have SIGRTMIN+3 in the blocked signals set. Signed-off-by: Christian Brauner Commit: bafda6b63ba3b5f9c73fe72b3440f429e7b754ae https://github.com/lxc/lxc/commit/bafda6b63ba3b5f9c73fe72b3440f429e7b754ae Author: Serge Hallyn Date: 2016-07-19 (Tue, 19 Jul 2016) Changed paths: M src/lxc/lxccontainer.c M src/lxc/utils.c M src/lxc/utils.h Log Message: --- Merge pull request #1086 from brauner/detect_sigrtmin_3 [RFC]: lxccontainer: detect if we should send SIGRTMIN+3 Compare: https://github.com/lxc/lxc/compare/31c32ef27020...bafda6b63ba3___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxd/master] list: fix concurrent read/write
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2214 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 can't concurrently write, but we can't concurrently read either, so let's extend the lock duration. Closes #2183 fatal error: concurrent map read and map write goroutine 1 [running]: runtime.throw(0x9cd180, 0x21) /usr/lib/go-1.6/src/runtime/panic.go:530 +0x90 fp=0xc8200f0fa8 sp=0xc8200f0f90 runtime.mapaccess2_faststr(0x808280, 0xc8201db140, 0xc8201b43d0, 0xb, 0x0, 0xdbf920) /usr/lib/go-1.6/src/runtime/hashmap_fast.go:307 +0x5b fp=0xc8200f1008 sp=0xc8200f0fa8 main.(*listCmd).listContainers(0xc82000be30, 0xc8200d0700, 0xc8201e, 0x32, 0x50, 0xc820011a50, 0x1, 0x1, 0xc82008ff00, 0x3, ...) /build/lxd-ma7bPQ/lxd-2.0.2/obj-x86_64-linux-gnu/src/github.com/lxc/lxd/lxc/list.go:254 +0x651 fp=0xc8200f1750 sp=0xc8200f1008 main.(*listCmd).run(0xc82000be30, 0xc8200f2030, 0x0, 0x0, 0x0, 0x0, 0x0) /build/lxd-ma7bPQ/lxd-2.0.2/obj-x86_64-linux-gnu/src/github.com/lxc/lxd/lxc/list.go:401 +0x1324 fp=0xc8200f1ae8 sp=0xc8200f1750 main.run(0x0, 0x0) /build/lxd-ma7bPQ/lxd-2.0.2/obj-x86_64-linux-gnu/src/github.com/lxc/lxd/lxc/main.go:151 +0x1098 fp=0xc8200f1df0 sp=0xc8200f1ae8 main.main() /build/lxd-ma7bPQ/lxd-2.0.2/obj-x86_64-linux-gnu/src/github.com/lxc/lxd/lxc/main.go:23 +0x3a fp=0xc8200f1f40 sp=0xc8200f1df0 runtime.main() /usr/lib/go-1.6/src/runtime/proc.go:188 +0x2b0 fp=0xc8200f1f90 sp=0xc8200f1f40 runtime.goexit() /usr/lib/go-1.6/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc8200f1f98 sp=0xc8200f1f90 Signed-off-by: Tycho Andersen From 7d755a934690734f17d3c7eb661e190d0d06a7ec Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Tue, 19 Jul 2016 09:25:50 -0600 Subject: [PATCH] list: fix concurrent read/write We can't concurrently write, but we can't concurrently read either, so let's extend the lock duration. Closes #2183 fatal error: concurrent map read and map write goroutine 1 [running]: runtime.throw(0x9cd180, 0x21) /usr/lib/go-1.6/src/runtime/panic.go:530 +0x90 fp=0xc8200f0fa8 sp=0xc8200f0f90 runtime.mapaccess2_faststr(0x808280, 0xc8201db140, 0xc8201b43d0, 0xb, 0x0, 0xdbf920) /usr/lib/go-1.6/src/runtime/hashmap_fast.go:307 +0x5b fp=0xc8200f1008 sp=0xc8200f0fa8 main.(*listCmd).listContainers(0xc82000be30, 0xc8200d0700, 0xc8201e, 0x32, 0x50, 0xc820011a50, 0x1, 0x1, 0xc82008ff00, 0x3, ...) /build/lxd-ma7bPQ/lxd-2.0.2/obj-x86_64-linux-gnu/src/github.com/lxc/lxd/lxc/list.go:254 +0x651 fp=0xc8200f1750 sp=0xc8200f1008 main.(*listCmd).run(0xc82000be30, 0xc8200f2030, 0x0, 0x0, 0x0, 0x0, 0x0) /build/lxd-ma7bPQ/lxd-2.0.2/obj-x86_64-linux-gnu/src/github.com/lxc/lxd/lxc/list.go:401 +0x1324 fp=0xc8200f1ae8 sp=0xc8200f1750 main.run(0x0, 0x0) /build/lxd-ma7bPQ/lxd-2.0.2/obj-x86_64-linux-gnu/src/github.com/lxc/lxd/lxc/main.go:151 +0x1098 fp=0xc8200f1df0 sp=0xc8200f1ae8 main.main() /build/lxd-ma7bPQ/lxd-2.0.2/obj-x86_64-linux-gnu/src/github.com/lxc/lxd/lxc/main.go:23 +0x3a fp=0xc8200f1f40 sp=0xc8200f1df0 runtime.main() /usr/lib/go-1.6/src/runtime/proc.go:188 +0x2b0 fp=0xc8200f1f90 sp=0xc8200f1f40 runtime.goexit() /usr/lib/go-1.6/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc8200f1f98 sp=0xc8200f1f90 Signed-off-by: Tycho Andersen --- lxc/list.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lxc/list.go b/lxc/list.go index a4863c3..b8fbffa 100644 --- a/lxc/list.go +++ b/lxc/list.go @@ -283,12 +283,12 @@ func (c *listCmd) listContainers(d *lxd.Client, cinfos []shared.ContainerInfo, f for _, cInfo := range cinfos { for _, column := range columns { if column.NeedsState && cInfo.IsActive() { + cStatesLock.Lock() _, ok := cStates[cInfo.Name] if ok { continue } - cStatesLock.Lock() cStates[cInfo.Name] = nil cStatesLock.Unlock() @@ -296,12 +296,12 @@ func (c *listCmd) listContainers(d *lxd.Client, cinfos []shared.ContainerInfo, f } if column.NeedsSnapshots { + cSnapshotsLock.Lock() _, ok := cSnapshots[cInfo.Name] if ok { continue } - cSnapshotsLock.Lock() cSnapshots[cInfo.Name] = nil cSnapshotsLock.Unlock() ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://
[lxc-devel] [pylxd/master] Bump version to 2.0.4
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/pylxd/pull/160 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: Chuck Short From 54e1248d18f3ab78ba2ca4124235f4253fab686a Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Tue, 19 Jul 2016 11:18:30 -0400 Subject: [PATCH] Bump version to 2.0.4 Signed-off-by: Chuck Short --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index cb83b55..9bae12c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] name = pylxd summary = python library for lxd -version = 2.0.3 +version = 2.0.4 description-file = README.rst author = Paul Hummer ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/lxc] a361e5: lxc-copy: update manpage to include tmpfs option
Branch: refs/heads/master Home: https://github.com/lxc/lxc Commit: a361e56278d247ba1127e905130ee1c72ab68871 https://github.com/lxc/lxc/commit/a361e56278d247ba1127e905130ee1c72ab68871 Author: Christian Brauner Date: 2016-07-19 (Tue, 19 Jul 2016) Changed paths: M doc/lxc-copy.sgml.in Log Message: --- lxc-copy: update manpage to include tmpfs option Signed-off-by: Christian Brauner Commit: 31c32ef27020926866a65a765c12492c4049de0e https://github.com/lxc/lxc/commit/31c32ef27020926866a65a765c12492c4049de0e Author: Serge Hallyn Date: 2016-07-19 (Tue, 19 Jul 2016) Changed paths: M doc/lxc-copy.sgml.in Log Message: --- Merge pull request #1087 from brauner/2016-07-16/clone_on_tmpfs lxc-copy: update manpage to include tmpfs option Compare: https://github.com/lxc/lxc/compare/897dcac41f53...31c32ef27020___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel