[lxc-devel] [lxd/master] network: Fix networkIsInUse
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2391 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) === Variable name re-use was breaking it. Signed-off-by: Stéphane Graber From d4efd0f6c770abc9456147bc9e7cfb56e4c99421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Sat, 17 Sep 2016 02:18:46 -0400 Subject: [PATCH] network: Fix networkIsInUse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Variable name re-use was breaking it. Signed-off-by: Stéphane Graber --- lxd/networks.go | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lxd/networks.go b/lxd/networks.go index cfd1e72..a5b29e3 100644 --- a/lxd/networks.go +++ b/lxd/networks.go @@ -14,23 +14,20 @@ import ( // Helper functions func networkIsInUse(c container, name string) bool { - devices := c.ExpandedDevices() - for _, name := range devices.DeviceNames() { - device := devices[name] - - if device["type"] != "nic" { + for _, d := range c.ExpandedDevices() { + if d["type"] != "nic" { continue } - if !shared.StringInSlice(device["nictype"], []string{"bridged", "macvlan"}) { + if !shared.StringInSlice(d["nictype"], []string{"bridged", "macvlan"}) { continue } - if device["parent"] == "" { + if d["parent"] == "" { continue } - if device["parent"] == name { + if d["parent"] == name { return true } } ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/lxc] 5f178b: c/r: fix typo in comment
Branch: refs/heads/master Home: https://github.com/lxc/lxc Commit: 5f178bc983a7050205b0ba374163646e9e378cf6 https://github.com/lxc/lxc/commit/5f178bc983a7050205b0ba374163646e9e378cf6 Author: Tycho Andersen Date: 2016-09-16 (Fri, 16 Sep 2016) Changed paths: M src/lxc/criu.c Log Message: --- c/r: fix typo in comment Signed-off-by: Tycho Andersen Commit: 36662416441b051bf9d3bb0e1b5d08a61b3a6420 https://github.com/lxc/lxc/commit/36662416441b051bf9d3bb0e1b5d08a61b3a6420 Author: Tycho Andersen Date: 2016-09-16 (Fri, 16 Sep 2016) Changed paths: M src/lxc/cgroups/cgfs.c M src/lxc/cgroups/cgfsng.c M src/lxc/cgroups/cgmanager.c M src/lxc/cgroups/cgroup.c M src/lxc/cgroups/cgroup.h Log Message: --- cgroup: add new functions for interacting with hierachies N.B. that these are only implemented in cgfsng, but, 15:28:28tych0 | do we still use cgfs anywhere? or the cgm backend? 15:29:19 stgraber | not anywhere we care about ...I think that's okay. Signed-off-by: Tycho Andersen Commit: aeb3682ff631e6afaa9c0b5d8a32654e8ebd2771 https://github.com/lxc/lxc/commit/aeb3682ff631e6afaa9c0b5d8a32654e8ebd2771 Author: Tycho Andersen Date: 2016-09-16 (Fri, 16 Sep 2016) Changed paths: M src/lxc/utils.c M src/lxc/utils.h Log Message: --- utils: add lxc_deslashify Signed-off-by: Tycho Andersen Commit: 0ab5703fcff8aafc3512c8b3cb446780b1c6974c https://github.com/lxc/lxc/commit/0ab5703fcff8aafc3512c8b3cb446780b1c6974c Author: Tycho Andersen Date: 2016-09-16 (Fri, 16 Sep 2016) Changed paths: M src/lxc/criu.c Log Message: --- c/r: pass --cgroup-roots on checkpoint CRIU has added support for passing --cgroup-root on dump, which we should use (see the criu commit 07d259f365f224b32914de26ea0fd59fc6db0001 for details). Note that we don't have to do any version checking or anything, because CRIU just ignored --cgroup-root on checkpoint before, so passing it is safe, and will result in correct behavior when a sufficient version of CRIU is present. Signed-off-by: Tycho Andersen Commit: 6df334d1588dfcf99a405fb700971ac27cac438c https://github.com/lxc/lxc/commit/6df334d1588dfcf99a405fb700971ac27cac438c Author: Tycho Andersen Date: 2016-09-16 (Fri, 16 Sep 2016) Changed paths: M src/lxc/cgroups/cgfsng.c Log Message: --- cgroup: get rid of weird hack in cgfsng_escape We initialized cgfsng in a strange way inside of its implementation of escape so we could use it during checkpoint. Instead, the previous patch does a hacky initialization in criu.c, and we can get rid of the hacks elsewhere :) Signed-off-by: Tycho Andersen Commit: a0c91fccd9a1ae9c68a10880d4660d63a3b411e8 https://github.com/lxc/lxc/commit/a0c91fccd9a1ae9c68a10880d4660d63a3b411e8 Author: Tycho Andersen Date: 2016-09-16 (Fri, 16 Sep 2016) Changed paths: M src/lxc/cgroups/cgfs.c M src/lxc/cgroups/cgfsng.c M src/lxc/cgroups/cgmanager.c M src/lxc/cgroups/cgroup.c M src/lxc/cgroups/cgroup.h Log Message: --- cgroup: drop cgroup_canonical_path This is almost never the right thing to use, and we don't use it any more anyway. Signed-off-by: Tycho Andersen Commit: 09e80d0cc4c7d39c43ec0e6e910346d8e1b6461c https://github.com/lxc/lxc/commit/09e80d0cc4c7d39c43ec0e6e910346d8e1b6461c Author: Tycho Andersen Date: 2016-09-16 (Fri, 16 Sep 2016) Changed paths: M src/lxc/criu.c Log Message: --- c/r: check that cgroup_num_hierarchies > 0 Otherwise in the error case, we end up subtracting two from the static_args, which would lead to a segfault :) Signed-off-by: Tycho Andersen Commit: 651ef4efbbf97d9ca661771ac8d79eb15fa1905d https://github.com/lxc/lxc/commit/651ef4efbbf97d9ca661771ac8d79eb15fa1905d Author: Stéphane Graber Date: 2016-09-16 (Fri, 16 Sep 2016) Changed paths: M src/lxc/cgroups/cgfs.c M src/lxc/cgroups/cgfsng.c M src/lxc/cgroups/cgmanager.c M src/lxc/cgroups/cgroup.c M src/lxc/cgroups/cgroup.h M src/lxc/criu.c M src/lxc/utils.c M src/lxc/utils.h Log Message: --- Merge pull request #1194 from tych0/cgroup-root-on-dump Cgroup root on dump Compare: https://github.com/lxc/lxc/compare/127a74d7aaad...651ef4efbbf9___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxd/master] network: Move and rename isOnBridge
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2390 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 64e369f817bd9e170761a75466c7cbf33e9ac57e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 6 Sep 2016 23:16:50 -0400 Subject: [PATCH] network: Move and rename isOnBridge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- lxd/networks.go | 54 -- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/lxd/networks.go b/lxd/networks.go index f705f6e..cfd1e72 100644 --- a/lxd/networks.go +++ b/lxd/networks.go @@ -12,6 +12,33 @@ import ( "github.com/lxc/lxd/shared" ) +// Helper functions +func networkIsInUse(c container, name string) bool { + devices := c.ExpandedDevices() + for _, name := range devices.DeviceNames() { + device := devices[name] + + if device["type"] != "nic" { + continue + } + + if !shared.StringInSlice(device["nictype"], []string{"bridged", "macvlan"}) { + continue + } + + if device["parent"] == "" { + continue + } + + if device["parent"] == name { + return true + } + } + + return false +} + +// API endpoints func networksGet(d *Daemon, r *http.Request) Response { recursionStr := r.FormValue("recursion") recursion, err := strconv.Atoi(recursionStr) @@ -54,31 +81,6 @@ type network struct { UsedBy []string `json:"used_by"` } -func isOnBridge(c container, bridge string) bool { - devices := c.ExpandedDevices() - for _, name := range devices.DeviceNames() { - device := devices[name] - - if device["type"] != "nic" { - continue - } - - if !shared.StringInSlice(device["nictype"], []string{"bridged", "macvlan"}) { - continue - } - - if device["parent"] == "" { - continue - } - - if device["parent"] == bridge { - return true - } - } - - return false -} - func networkGet(d *Daemon, r *http.Request) Response { name := mux.Vars(r)["name"] @@ -113,7 +115,7 @@ func doNetworkGet(d *Daemon, name string) (network, error) { return network{}, err } - if isOnBridge(c, n.Name) { + if networkIsInUse(c, n.Name) { n.UsedBy = append(n.UsedBy, fmt.Sprintf("/%s/containers/%s", shared.APIVersion, ct)) } } ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxd/master] LVM mount options
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2389 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 81cafeba51a73d3b920c9e418dbb9389e5b40771 Mon Sep 17 00:00:00 2001 From: Nobuto Murata Date: Wed, 14 Sep 2016 20:07:33 +0900 Subject: [PATCH 1/2] new config option, storage.lvm_mount_options Signed-off-by: Nobuto Murata --- config/bash/lxd-client | 2 +- doc/configuration.md | 1 + lxd/daemon_config.go | 1 + lxd/storage_lvm.go | 12 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/config/bash/lxd-client b/config/bash/lxd-client index c475c7f..b7fe02a 100644 --- a/config/bash/lxd-client +++ b/config/bash/lxd-client @@ -42,7 +42,7 @@ _have lxc && { core.https_allowed_credentials core.proxy_https \ core.proxy_http core.proxy_ignore_host core.trust_password \ storage.lvm_vg_name storage.lvm_thinpool_name storage.lvm_fstype \ - storage.lvm_volume_size storage.zfs_pool_name \ + storage.lvm_volume_size storage.lvm_mount_options storage.zfs_pool_name \ storage.zfs_remove_snapshots storage.zfs_use_refquota \ images.compression_algorithm \ images.remote_cache_expiry images.auto_update_interval \ diff --git a/doc/configuration.md b/doc/configuration.md index d705a29..109ad18 100644 --- a/doc/configuration.md +++ b/doc/configuration.md @@ -31,6 +31,7 @@ core.trust\_password| string| - | - storage.lvm\_vg\_name | string| - | - | LVM Volume Group name to be used for container and image storage. A default Thin Pool is created using 100% of the free space in the Volume Group, unless `storage.lvm_thinpool_name` is set. storage.lvm\_thinpool\_name | string| "LXDPool" | - | LVM Thin Pool to use within the Volume Group specified in `storage.lvm_vg_name`, if the default pool parameters are undesirable. storage.lvm\_fstype | string| ext4 | - | Format LV with filesystem, for now it's value can be only ext4 (default) or xfs. +storage.lvm\_mount\_options | string| discard | - | Mount options for LV. storage.lvm\_volume\_size | string| 10GiB | - | Size of the logical volume storage.zfs\_pool\_name | string| - | - | ZFS pool name storage.zfs\_remove\_snapshots | boolean | false | storage\_zfs\_remove\_snapshots | Automatically remove any needed snapshot when attempting a container restore diff --git a/lxd/daemon_config.go b/lxd/daemon_config.go index ccc30d9..5af70ad 100644 --- a/lxd/daemon_config.go +++ b/lxd/daemon_config.go @@ -180,6 +180,7 @@ func daemonConfigInit(db *sql.DB) error { "images.remote_cache_expiry": &daemonConfigKey{valueType: "int", defaultValue: "10", trigger: daemonConfigTriggerExpiry}, "storage.lvm_fstype": &daemonConfigKey{valueType: "string", defaultValue: "ext4", validValues: []string{"ext4", "xfs"}}, + "storage.lvm_mount_options":&daemonConfigKey{valueType: "string", defaultValue: "discard"}, "storage.lvm_thinpool_name":&daemonConfigKey{valueType: "string", defaultValue: "LXDPool", validator: storageLVMValidateThinPoolName}, "storage.lvm_vg_name": &daemonConfigKey{valueType: "string", validator: storageLVMValidateVolumeGroupName, setter: daemonConfigSetStorage}, "storage.lvm_volume_size": &daemonConfigKey{valueType: "string", defaultValue: "10GiB"}, diff --git a/lxd/storage_lvm.go b/lxd/storage_lvm.go index 3f8fc5d..fe9fc1e 100644 --- a/lxd/storage_lvm.go +++ b/lxd/storage_lvm.go @@ -322,7 +322,8 @@ func (s *storageLvm) ContainerCreateFromImage( } } - err = tryMount(lvpath, destPath, fstype, 0, "discard") + mountOptions := daemonConfig["storage.lvm_mount_options"].Get() + err = tryMount(lvpath, destPath, fstype, 0, mountOptions) if err != nil { s.ContainerDelete(container) return fmt.Errorf("Error mounting snapshot LV: %v", err) @@ -430,7 +431,8 @@ func (s *storageLvm) ContainerStart(container container) error { lvpath := fmt.Sprintf("/dev/%s/%s", s.vgName, lvName) fstype := daemonConfig["storage.lvm_fstype"].Get() - err := tryMount(lvpath, container.Path(), fstype, 0, "discard") + mountOptions := daemonConfig["storage.lvm_mount_options"].Get() + err := tryMount(lvpath, container.Path(), fstype, 0, mountOptions) if err != nil { return fmt.Errorf( "Error mounting snapshot LV path='%s
[lxc-devel] [lxc/master] Cgroup root on dump
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1194 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 a fix for one of the issues mentioned in #1156; see the 4th patch in the series for the bulk of the fix. The CRIU commit in question went into criu-dev today, and should be in 2.7. From 5f178bc983a7050205b0ba374163646e9e378cf6 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Mon, 12 Sep 2016 18:04:18 + Subject: [PATCH 1/6] c/r: fix typo in comment Signed-off-by: Tycho Andersen --- 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 71c9b9c..2799102 100644 --- a/src/lxc/criu.c +++ b/src/lxc/criu.c @@ -140,7 +140,7 @@ static void exec_criu(struct criu_opts *opts) /* The command line always looks like: * criu $(action) --tcp-established --file-locks --link-remap \ -* --manage-cgroups=full action-script foo.sh -D $(directory) \ +* --manage-cgroups=full --action-script foo.sh -D $(directory) \ * -o $(directory)/$(action).log --ext-mount-map auto * --enable-external-sharing --enable-external-masters * --enable-fs hugetlbfs --enable-fs tracefs --ext-mount-map console:/dev/pts/n From 36662416441b051bf9d3bb0e1b5d08a61b3a6420 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Wed, 14 Sep 2016 14:38:46 + Subject: [PATCH 2/6] cgroup: add new functions for interacting with hierachies N.B. that these are only implemented in cgfsng, but, 15:28:28tych0 | do we still use cgfs anywhere? or the cgm backend? 15:29:19 stgraber | not anywhere we care about ...I think that's okay. Signed-off-by: Tycho Andersen --- src/lxc/cgroups/cgfs.c | 14 ++ src/lxc/cgroups/cgfsng.c| 27 +++ src/lxc/cgroups/cgmanager.c | 14 ++ src/lxc/cgroups/cgroup.c| 16 src/lxc/cgroups/cgroup.h| 4 5 files changed, 75 insertions(+) diff --git a/src/lxc/cgroups/cgfs.c b/src/lxc/cgroups/cgfs.c index 2d0de0c..80a336d 100644 --- a/src/lxc/cgroups/cgfs.c +++ b/src/lxc/cgroups/cgfs.c @@ -2434,6 +2434,18 @@ static bool cgfs_escape(void *hdata) return ret; } +static int cgfs_num_hierarchies(void) +{ + /* not implemented */ + return -1; +} + +static bool cgfs_get_hierarchies(int i, char ***out) +{ + /* not implemented */ + return false; +} + static bool cgfs_unfreeze(void *hdata) { struct cgfs_data *d = hdata; @@ -2627,6 +2639,8 @@ static struct cgroup_ops cgfs_ops = { .get_cgroup = cgfs_get_cgroup, .canonical_path = cgfs_canonical_path, .escape = cgfs_escape, + .num_hierarchies = cgfs_num_hierarchies, + .get_hierarchies = cgfs_get_hierarchies, .get = lxc_cgroupfs_get, .set = lxc_cgroupfs_set, .unfreeze = cgfs_unfreeze, diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 95f29ca..5b61554 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -1457,6 +1457,31 @@ static bool cgfsng_escape() return ret; } +static int cgfsng_num_hierarchies(void) +{ + int i; + + for (i = 0; hierarchies[i]; i++) + ; + + return i; +} + +static bool cgfsng_get_hierarchies(int n, char ***out) +{ + int i; + + /* sanity check n */ + for (i = 0; i < n; i++) { + if (!hierarchies[i]) + return false; + } + + *out = hierarchies[i]->controllers; + + return true; +} + #define THAWED "THAWED" #define THAWED_LEN (strlen(THAWED)) @@ -1674,6 +1699,8 @@ static struct cgroup_ops cgfsng_ops = { .enter = cgfsng_enter, .canonical_path = cgfsng_canonical_path, .escape = cgfsng_escape, + .num_hierarchies = cgfsng_num_hierarchies, + .get_hierarchies = cgfsng_get_hierarchies, .get_cgroup = cgfsng_get_cgroup, .get = cgfsng_get, .set = cgfsng_set, diff --git a/src/lxc/cgroups/cgmanager.c b/src/lxc/cgroups/cgmanager.c index 4da891d..f14eb17 100644 --- a/src/lxc/cgroups/cgmanager.c +++ b/src/lxc/cgroups/cgmanager.c @@ -337,6 +337,18 @@ static bool cgm_escape(void *hdata) return ret; } +static int cgm_num_hierarchies(void) +{ + /* not implemented */ + return -1; +} + +static bool cgm_get_hierarchies(int i, char ***out) +{ + /* not implemented */ + return false; +} + struct chown_data { const char *cgroup_path; uid_t origuid; @@ -1657,6 +1669,8 @@ static struct cgroup_ops cgmanager_ops = { .get_cgroup = cgm_get_cgroup, .canonical_path = cgm_canonical_path, .escape = cgm_escape, + .num_hierarchies = cgm_num_hierarchies, + .get_hierarchies = cgm_get_hierarchies,
[lxc-devel] [pylxd/master] Make ws4py an optional library.
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/pylxd/pull/181 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) === Tests that require ws4py are skipped in environments that don't have ws4py available. Fixes #180 From f58d24ed199f38b1e40ba0bc8c26b54b06ef9068 Mon Sep 17 00:00:00 2001 From: Paul Hummer Date: Fri, 16 Sep 2016 14:12:23 -0600 Subject: [PATCH] Make ws4py an optional library. Tests that require ws4py are skipped in environments that don't have ws4py available. Fixes #180 --- pylxd/client.py | 10 - pylxd/deprecated/connection.py | 83 +++- pylxd/models/container.py| 12 +- pylxd/tests/models/test_container.py | 2 + pylxd/tests/test_client.py | 7 +++ pylxd/tests/testing.py | 14 ++ 6 files changed, 87 insertions(+), 41 deletions(-) diff --git a/pylxd/client.py b/pylxd/client.py index e18028c..a4ee4f0 100644 --- a/pylxd/client.py +++ b/pylxd/client.py @@ -18,7 +18,12 @@ import requests import requests_unixsocket from six.moves.urllib import parse -from ws4py.client import WebSocketBaseClient +try: +from ws4py.client import WebSocketBaseClient +_ws4py_installed = True +except ImportError: +WebSocketBaseClient = object +_ws4py_installed = True from pylxd import exceptions, managers @@ -238,6 +243,9 @@ def events(self, websocket_client=None): specified for implementation-specific handling of events as they occur. """ +if not _ws4py_installed: +raise ValueError( +'This feature requires the optional ws4py library.') if websocket_client is None: websocket_client = _WebsocketClient diff --git a/pylxd/deprecated/connection.py b/pylxd/deprecated/connection.py index 65adbf0..b86ad94 100644 --- a/pylxd/deprecated/connection.py +++ b/pylxd/deprecated/connection.py @@ -24,7 +24,10 @@ from six.moves import http_client from six.moves import queue -from ws4py import client as websocket +try: +from ws4py import client as websocket +except ImportError: +websocket = None from pylxd.deprecated import exceptions from pylxd.deprecated import utils @@ -88,43 +91,44 @@ def _get_ssl_certs(): _LXDResponse = namedtuple('LXDResponse', ['status', 'body', 'json']) -class WebSocketClient(websocket.WebSocketBaseClient): -def __init__(self, url, protocols=None, extensions=None, ssl_options=None, - headers=None): -"""WebSocket client that executes into a eventlet green thread.""" -websocket.WebSocketBaseClient.__init__(self, url, protocols, - extensions, - ssl_options=ssl_options, - headers=headers) -self._th = threading.Thread(target=self.run, name='WebSocketClient') -self._th.daemon = True - -self.messages = queue.Queue() - -def handshake_ok(self): -"""Starts the client's thread.""" -self._th.start() - -def received_message(self, message): -"""Override the base class to store the incoming message.""" -self.messages.put(copy.deepcopy(message)) - -def closed(self, code, reason=None): -# When the connection is closed, put a StopIteration -# on the message queue to signal there's nothing left -# to wait for -self.messages.put(StopIteration) - -def receive(self): -# If the websocket was terminated and there are no messages -# left in the queue, return None immediately otherwise the client -# will block forever -if self.terminated and self.messages.empty(): -return None -message = self.messages.get() -if message is StopIteration: -return None -return message +if websocket is not None: +class WebSocketClient(websocket.WebSocketBaseClient): +def __init__(self, url, protocols=None, extensions=None, ssl_options=None, + headers=None): +"""WebSocket client that executes into a eventlet green thread.""" +websocket.WebSocketBaseClient.__init__(self, url, protocols, + extensions, + ssl_options=ssl_options, + headers=headers) +self._th = threading.Thread(target=self.run, name='WebSocketClient') +self._th.daemon = True + +self.messages = queue.Queue() + +def handshake_ok(self): +"""Starts the client's thread.""" +self._th.start() + +def received_message(self, message): +"""Overri
[lxc-devel] [lxd/master] init: Change validation functions for consistency
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2388 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 7afa69be324efd06781ff7fbb5f03518934b5b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Fri, 16 Sep 2016 00:13:03 -0400 Subject: [PATCH] init: Change validation functions for consistency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- lxd/main.go | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lxd/main.go b/lxd/main.go index d464cfe..6673b99 100644 --- a/lxd/main.go +++ b/lxd/main.go @@ -673,7 +673,7 @@ func cmdInit() error { } } - askString := func(question string, default_ string, validate func(string) string) string { + askString := func(question string, default_ string, validate func(string) error) string { for { fmt.Printf(question) input, _ := reader.ReadString('\n') @@ -683,7 +683,7 @@ func cmdInit() error { } if validate != nil { result := validate(input) - if result != "" { + if result != nil { fmt.Printf("Invalid input: %s\n\n", result) continue } @@ -818,11 +818,11 @@ func cmdInit() error { if askBool("Create a new ZFS pool (yes/no) [default=yes]? ", "yes") { storagePool = askString("Name of the new ZFS pool [default=lxd]: ", "lxd", nil) if askBool("Would you like to use an existing block device (yes/no) [default=no]? ", "no") { - deviceExists := func(path string) string { + deviceExists := func(path string) error { if !shared.IsBlockdevPath(path) { - return fmt.Sprintf("'%s' is not a block device", path) + return fmt.Errorf("'%s' is not a block device", path) } - return "" + return nil } storageDevice = askString("Path to the existing block device: ", "", deviceExists) storageMode = "device" @@ -872,11 +872,11 @@ they otherwise would. } if askBool("Would you like LXD to be available over the network (yes/no) [default=no]? ", "no") { - isIPAddress := func(s string) string { + isIPAddress := func(s string) error { if s != "all" && net.ParseIP(s) == nil { - return fmt.Sprintf("'%s' is not an IP address", s) + return fmt.Errorf("'%s' is not an IP address", s) } - return "" + return nil } networkAddress = askString("Address to bind LXD to (not including port) [default=all]: ", "all", isIPAddress) ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/lxc] bfbf79: lxc-create -t debian fails on ppc64el arch
Branch: refs/heads/master Home: https://github.com/lxc/lxc Commit: bfbf793616ce36ec63bac2cf582474c14cecb712 https://github.com/lxc/lxc/commit/bfbf793616ce36ec63bac2cf582474c14cecb712 Author: Thierry Fauck Date: 2016-09-16 (Fri, 16 Sep 2016) Changed paths: M templates/lxc-debian.in Log Message: --- lxc-create -t debian fails on ppc64el arch Template catches arch from uname -m, but for ppc64el system, arch reports ppc64le which doesn't match image repo. Signed-off-by: Thierry Fauck Signed-off-by: Serge Hallyn Commit: 127a74d7aaad2b0e239dd7b3c500449e6ccc1fcf https://github.com/lxc/lxc/commit/127a74d7aaad2b0e239dd7b3c500449e6ccc1fcf Author: Stéphane Graber Date: 2016-09-16 (Fri, 16 Sep 2016) Changed paths: M templates/lxc-debian.in Log Message: --- Merge pull request #1193 from hallyn/2016-09-16/thierry lxc-create -t debian fails on ppc64el arch Compare: https://github.com/lxc/lxc/compare/2ca213832294...127a74d7aaad___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [pylxd/master] Don't allow local connection clients to migrate
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/pylxd/pull/179 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) === If a connection to LXD is a local connection, it should not be used to migrate, because it won't have a routable connection. Originally, I had the idea that we could iterate through all the addresses in `metadata.environment.addresses` until we found a valid one, and while that made me laugh at the stupidity and possible genius of the hack, I think it's better to explicitly put the burden on the user to have a routable connection. From c943a07b79d42aa72574a9c1c4c70bbce3441817 Mon Sep 17 00:00:00 2001 From: Paul Hummer Date: Fri, 16 Sep 2016 09:17:33 -0600 Subject: [PATCH 1/2] Don't allow local connection clients to attempt a migration. Fixes #162 --- pylxd/models/container.py| 3 +++ pylxd/tests/models/test_container.py | 17 + 2 files changed, 20 insertions(+) diff --git a/pylxd/models/container.py b/pylxd/models/container.py index f7ef5d3..8acc243 100644 --- a/pylxd/models/container.py +++ b/pylxd/models/container.py @@ -231,6 +231,9 @@ def migrate(self, new_client, wait=False): first or criu must be installed on the source and destination machines. """ +if self.api._api_endpoint.startswith('http+unix'): +raise ValueError('Cannot migrate from a local client connection') + self.sync() # Make sure the object isn't stale response = self.api.post(json={'migration': True}) operation = self.client.operations.get(response.json()['operation']) diff --git a/pylxd/tests/models/test_container.py b/pylxd/tests/models/test_container.py index e2044a5..1cb12c0 100644 --- a/pylxd/tests/models/test_container.py +++ b/pylxd/tests/models/test_container.py @@ -191,6 +191,23 @@ def test_migrate(self): self.assertEqual('an-container', an_migrated_container.name) self.assertEqual(client2, an_migrated_container.client) +@mock.patch('pylxd.client._APINode.get') +def test_migrate_local_client(self, get): +"""Migration from local clients is not supported.""" +# Mock out the _APINode for the local instance. +response = mock.Mock() +response.json.return_value = {'metadata': {'fake': 'response'}} +response.status_code = 200 +get.return_value = response + +from pylxd.client import Client + +client2 = Client(endpoint='http+unix://pylxd2.test') +an_container = models.Container( +client2, name='an-container') + +self.assertRaises(ValueError, an_container.migrate, self.client) + def test_publish(self): """Containers can be published.""" self.add_rule({ From 85095e8374f0be8acdd4f600fb3eed375a7be0ff Mon Sep 17 00:00:00 2001 From: Paul Hummer Date: Fri, 16 Sep 2016 09:37:46 -0600 Subject: [PATCH 2/2] Update _APINode to have a cleaner interface. Stop reaching into private attributes. --- pylxd/client.py | 17 - pylxd/models/container.py | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pylxd/client.py b/pylxd/client.py index e18028c..675e4a2 100644 --- a/pylxd/client.py +++ b/pylxd/client.py @@ -75,6 +75,14 @@ def _assert_response(self, response, allowed_status_codes=(200,)): # Missing 'type' in response raise exceptions.LXDAPIException(response) +@property +def scheme(self): +return parse.urlparse(self.api._api_endpoint).scheme + +@property +def netloc(self): +return parse.urlparse(self.api._api_endpoint).netloc + def get(self, *args, **kwargs): """Perform an HTTP GET.""" response = self.session.get(self._api_endpoint, *args, **kwargs) @@ -213,16 +221,15 @@ def authenticate(self, password): @property def websocket_url(self): -parsed = parse.urlparse(self.api._api_endpoint) -if parsed.scheme in ('http', 'https'): -host = parsed.netloc -if parsed.scheme == 'http': +if self.api.scheme in ('http', 'https'): +host = self.api.netloc +if self.api.scheme == 'http': scheme = 'ws' else: scheme = 'wss' else: scheme = 'ws+unix' -host = parse.unquote(parsed.netloc) +host = parse.unquote(self.api.netloc) url = parse.urlunparse((scheme, host, '', '', '', '')) return url diff --git a/pylxd/models/container.py b/pylxd/models/container.py index 8acc243..3bbf5d2 100644 --- a/pylxd/models/container.py +++ b/pylxd/models/container.py @@ -231,7 +231,7 @@ def migrate(self, new_client, wait=False): first or criu must be installed on the source and destination machines
[lxc-devel] [lxd/master] shared/log: fix LogDebug()
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2387 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 From 3a147bda04e8f5a43ac6a7a83c8925e37bd5e3c9 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Fri, 16 Sep 2016 16:17:52 +0200 Subject: [PATCH] shared/log: fix LogDebug() Signed-off-by: Christian Brauner --- shared/log.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/log.go b/shared/log.go index 4300803..bfaa8f0 100644 --- a/shared/log.go +++ b/shared/log.go @@ -31,7 +31,7 @@ func init() { // General wrappers around Logger interface functions. func LogDebug(msg string, ctx map[string]interface{}) { if Log != nil { - Log.Warn(msg, log.Ctx(ctx)) + Log.Debug(msg, log.Ctx(ctx)) } } ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/master] lxc-create -t debian fails on ppc64el arch
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1193 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) === Template catches arch from uname -m, but for ppc64el system, arch reports ppc64le which doesn't match image repo. Signed-off-by: Thierry Fauck Signed-off-by: Serge Hallyn From bfbf793616ce36ec63bac2cf582474c14cecb712 Mon Sep 17 00:00:00 2001 From: Thierry Fauck Date: Fri, 16 Sep 2016 08:34:41 -0500 Subject: [PATCH] lxc-create -t debian fails on ppc64el arch Template catches arch from uname -m, but for ppc64el system, arch reports ppc64le which doesn't match image repo. Signed-off-by: Thierry Fauck Signed-off-by: Serge Hallyn --- templates/lxc-debian.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in index 6420b39..b45180d 100644 --- a/templates/lxc-debian.in +++ b/templates/lxc-debian.in @@ -654,6 +654,8 @@ elif [ "$arch" = "x86_64" ]; then arch="amd64" elif [ "$arch" = "armv7l" ]; then arch="armhf" +elif [ "$arch" = "ppc64le" ]; then +arch="ppc64el" elif [ "$arch" = "mips" -a "$littleendian" = "yes" ]; then arch="mipsel" elif [ "$arch" = "mips64" -a "$littleendian" = "yes" ]; then ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxd/master] 2016 09 16/logging issue 1928
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2386 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) === Switch to new logging functions. From 2f5a1d04c8d30ce6d667b00de4f373c9d41cd93c Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Fri, 16 Sep 2016 09:51:07 +0200 Subject: [PATCH 01/16] lxd/container_lxc: switch to new logging functions Signed-off-by: Christian Brauner --- lxd/container_lxc.go | 38 +++--- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go index 63c86c2..99e7d40 100644 --- a/lxd/container_lxc.go +++ b/lxd/container_lxc.go @@ -1233,7 +1233,7 @@ func (c *containerLXC) startCommon() (string, error) { /* it's ok to fail, the device might be hot plugged later */ _, err := c.createUnixDevice(temp) if err != nil { - shared.Log.Debug("failed to create usb device", log.Ctx{"err": err, "device": k}) + shared.LogDebug("failed to create usb device", log.Ctx{"err": err, "device": k}) continue } @@ -1504,7 +1504,7 @@ func (c *containerLXC) OnStart() error { c.fromHook = false err := c.setNetworkPriority() if err != nil { - shared.Log.Error("Failed to apply network priority", log.Ctx{"container": c.name, "err": err}) + shared.LogError("Failed to apply network priority", log.Ctx{"container": c.name, "err": err}) } }(c) } @@ -1524,7 +1524,7 @@ func (c *containerLXC) OnStart() error { c.fromHook = false err = c.setNetworkLimits(name, m) if err != nil { - shared.Log.Error("Failed to apply network limits", log.Ctx{"container": c.name, "err": err}) + shared.LogError("Failed to apply network limits", log.Ctx{"container": c.name, "err": err}) } }(c, name, m) } @@ -1666,13 +1666,13 @@ func (c *containerLXC) OnStop(target string) error { // Clean all the unix devices err = c.removeUnixDevices() if err != nil { - shared.Log.Error("Unable to remove unix devices", log.Ctx{"err": err}) + shared.LogError("Unable to remove unix devices", log.Ctx{"err": err}) } // Clean all the disk devices err = c.removeDiskDevices() if err != nil { - shared.Log.Error("Unable to remove disk devices", log.Ctx{"err": err}) + shared.LogError("Unable to remove disk devices", log.Ctx{"err": err}) } // Reboot the container @@ -1879,7 +1879,7 @@ func (c *containerLXC) Restore(sourceContainer container) error { if c.IsRunning() { wasRunning = true if err := c.Stop(false); err != nil { - shared.Log.Error( + shared.LogError( "Could not stop container", log.Ctx{ "container": c.Name(), @@ -1891,7 +1891,7 @@ func (c *containerLXC) Restore(sourceContainer container) error { // Restore the rootfs err = c.storage.ContainerRestore(c, sourceContainer) if err != nil { - shared.Log.Error("Restoring the filesystem failed", + shared.LogError("Restoring the filesystem failed", log.Ctx{ "source": sourceContainer.Name(), "destination": c.Name()}) @@ -1909,7 +1909,7 @@ func (c *containerLXC) Restore(sourceContainer container) error { err = c.Update(args, false) if err != nil { - shared.Log.Error("Restoring the configuration failed", + shared.LogError("Restoring the configuration failed", log.Ctx{ "source": sourceContainer.Name(), "destination": c.Name()}) @@ -1928,7 +1928,7 @@ func (c *containerLXC) Restore(sourceContainer container) error { // this in snapshots. err2 := os.RemoveAll(c.StatePath()) if err2 != nil { - shared.Log.Error("failed to delete snapshot state", "path", c.StatePath(), "err", err
[lxc-devel] [linuxcontainers.org/master] Update Japanese contents
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/linuxcontainers.org/pull/211 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) === * LXC 1.1 EOL * LXD 2.2 From 00228effcdec4915face7e4a6174f51f8812fbef Mon Sep 17 00:00:00 2001 From: KATOH Yasufumi Date: Fri, 16 Sep 2016 16:38:02 +0900 Subject: [PATCH 1/3] Add Japanese announcement that LXC 1.1 is EOL Signed-off-by: KATOH Yasufumi --- content/lxc/downloads.ja.md | 2 +- content/lxc/news.ja.md | 27 ++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/content/lxc/downloads.ja.md b/content/lxc/downloads.ja.md index 76c7dd3..c3ec2bc 100644 --- a/content/lxc/downloads.ja.md +++ b/content/lxc/downloads.ja.md @@ -36,7 +36,7 @@ And for those who want development snapshots: * [lxc-git-master](https://launchpad.net/~ubuntu-lxc/+archive/lxc-git-master): "master" ブランチ * [lxc-git-stable-1.0](https://launchpad.net/~ubuntu-lxc/+archive/lxc-git-stable-1.0): "stable-1.0" ブランチ - * [lxc-git-stable-1.1](https://launchpad.net/~ubuntu-lxc/+archive/lxc-git-stable-1.1): "stable-1.1" ブランチ + * [lxc-git-stable-2.0](https://launchpad.net/~ubuntu-lxc/+archive/lxc-git-stable-2.0): "stable-2.0" ブランチ # 現時点の開発バージョン diff --git a/content/lxc/news.ja.md b/content/lxc/news.ja.md index 9cac76f..fb0789e 100644 --- a/content/lxc/news.ja.md +++ b/content/lxc/news.ja.md @@ -1,5 +1,30 @@ # News -## LXC 2.0.4 release announcement 15th of August 2016 +## LXC 1.1 EOL のお知らせ 2016 年 9 月 1 日 + +LXC 1.1 は EOL となりました。 + + +stable-1.1 ブランチはクローズされ、今後このブランチに対するバグ修正やセキュリティ対策のリリースは行われません。 + + +今でも LXC 1.1 をお使いの場合、なるべく早く 2.0 へアップグレードしてください。 + + +現在、以下のリリースがサポート中です: + + * LXC 1.0.x が 2019 年 6 月 1 日まで + * LXC 2.0.x が 2021 年 6 月 1 日まで + +## LXC 2.0.4 リリースのお知らせ 2016 年 8 月 15 日 From 5b418cad9973d8db4728a2a4e1b67a9e6eb2fb32 Mon Sep 17 00:00:00 2001 From: KATOH Yasufumi Date: Fri, 16 Sep 2016 18:09:29 +0900 Subject: [PATCH 2/3] Add Japanese release announcement of LXD 2.2 Signed-off-by: KATOH Yasufumi --- content/lxd/news.ja.md | 71 ++ 1 file changed, 71 insertions(+) diff --git a/content/lxd/news.ja.md b/content/lxd/news.ja.md index 7b298d9..13ba9a1 100644 --- a/content/lxd/news.ja.md +++ b/content/lxd/news.ja.md @@ -1,6 +1,77 @@ ![Logo](/static/img/containers.png) # News +## LXD 2.2 リリースのお知らせ 2016 年 9 月 14 日 + +### このリリースに含まれる変更点 + + +新機能: + + * client: "manpage" コマンドを追加しました (Issue #2280) + * client: エイリアスとして "rename" を追加しました (Issue #2320) + * client/file: 再帰的なファイルの push/pull を実装しました (-r) (Issue #1218) + * client/file: 再帰的なディレクトリ作成をサポートしました (-p) (Issue #2290) + * client/info: CPU 使用率が表示されるようになりました (Issue #1867) + * client/publish: 圧縮アルゴリズムをオーバーライドできるようになりました (Issue #2296) + * daemon: スキーマのアップデート時にデータベースのバックアップを取得するようになりました (Issue #2299) + * daemon/container: CPU の使用率情報が提供できるようになりました (Issue #1867) + * daemon/container: 再帰的なファイルの push/pull (Issue #1218) + * daemon/image: 圧縮アルゴリズムをオーバーライドできるようになりました (Issue #2296) + * daemon/init: キャッシュされた古いイメージを自動的に更新するかどうかを尋ねるようになりました (Issue #2167) + * daemon/storage: 新たに storage.zfs\_use\_refquota オプションを追加しました (Issue #2354) + + +バグ修正: + + * client/exec: 環境変数を取得する際、go 1.5 で導入された os.LookupEnv を使用するようになりました + * client/help: lxc help を標準出力に出力するように変更しました (Issue #2301) + * daemon: 名前の衝突を一貫性を持って処理するようになりました + * daemon/container: あらゆる設定キーを削除できるようになりました + * daemon/container: USB デバイス番号の major/minor が入れ替わっていたので修正しました + * daemon/container: publish の際、xattrs を扱うようになりました + * daemon/container: コンフリクトの際、petname の生成をリトライするようになりました + * daemon/container: pause されたコンテナに対して "restart" を実行するとエラーを返すようになりました (Issue #2311) + * daemon/container: コンテナ操作のロック処理を見直しました (Issue #2297) + * daemon/container: デバイスの接続が切断されたあと、USB バスディレクトリの削除を試みるようになりました (Issue #2306) + * daemon/container: USB ホットプラグに関する様々なバグ修正を行いました (Issue #2312) + * daemon/dir: コンテナのコピーの際、すべてをコピーするようになりました (Issue #2371) + * daemon: ソケットのアクティベーションを自身で行うようにしました (Issue #2333) + * daemon/image: lzma alone ファイルフォーマットのサポートに関する修正を行いました (Issue #2360) + * daemon/init: LXD がバインドするアドレスのデフォルトを all (::) に変更しました + * daemon/init: "zfs" が使用できない場合のデフォルトを "dir" にしました (Issue #2340) + * daemon/init: ZFS プールのデフォルト値として表示していた値を修正しました (Issue #2339) + * daemon/init: パーティションのサイズ決めをよりインテリジェントなロジックを使うようにしました + * daemon/profile: プロファイル名が存在する場合のエラーをわかりやすくしました + * daemon/profile: プロファイルの消去の際、適切にクリーンアップするようにしました (Issue #2347) + * doc: txqueuelen の調整について追加しました + * doc: btrfs のネストの際は user\_subvol\_rm\_allowed オプション付きでマウントする必要があることを追記しました (Issue #2338) + * doc: production-setup.md の typo の修正 + * doc: api_extensions を api-extensions にリネームしました + * i18n: 各国語の翻訳リソースファイルを更新し、日本語の翻訳を更新しました + * lxd-bridge: lxd-bridge-proxy でクラッシュする問題を修正しました + * tests: エイリアスのテスト内の競合を修正しました + * tests: TestReaderToChannel の転送を小さくしました + * tests: 現在の LXD の残り物だけをチェックするようにしました + +
[lxc-devel] [lxc/lxc] 16e58f: doc: Add lxc.no_new_privs to Japanese lxc.containe...
Branch: refs/heads/master Home: https://github.com/lxc/lxc Commit: 16e58f07bdd4b79ba7d15f58fc7f4664adb38059 https://github.com/lxc/lxc/commit/16e58f07bdd4b79ba7d15f58fc7f4664adb38059 Author: KATOH Yasufumi Date: 2016-09-16 (Fri, 16 Sep 2016) Changed paths: M doc/ja/lxc.container.conf.sgml.in Log Message: --- doc: Add lxc.no_new_privs to Japanese lxc.container.conf(5) Update for commit 222ddc Signed-off-by: KATOH Yasufumi Commit: 2ca213832294d756594585a5a92e7a57fd002905 https://github.com/lxc/lxc/commit/2ca213832294d756594585a5a92e7a57fd002905 Author: Christian Brauner Date: 2016-09-16 (Fri, 16 Sep 2016) Changed paths: M doc/ja/lxc.container.conf.sgml.in Log Message: --- Merge pull request #1192 from tenforward/japanese doc: Add lxc.no_new_privs to Japanese lxc.container.conf(5) Compare: https://github.com/lxc/lxc/compare/a307c271461c...2ca213832294___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel