[lxc-devel] [lxd/master] allow nil network config

2016-09-29 Thread tych0 on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2437

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 8f856e40d65f3c3e2f60c7d945e11fcf27e7cbc3 Mon Sep 17 00:00:00 2001
From: Tycho Andersen 
Date: Thu, 29 Sep 2016 22:13:22 +
Subject: [PATCH] allow nil network config

Signed-off-by: Tycho Andersen 
---
 lxd/networks.go | 4 
 1 file changed, 4 insertions(+)

diff --git a/lxd/networks.go b/lxd/networks.go
index c27b12d..a85a0dd 100644
--- a/lxd/networks.go
+++ b/lxd/networks.go
@@ -84,6 +84,10 @@ func networksPost(d *Daemon, r *http.Request) Response {
return BadRequest(fmt.Errorf("The network already exists"))
}
 
+   if req.Config == nil {
+   req.Config = map[string]string{}
+   }
+
err = networkValidateConfig(req.Name, req.Config)
if err != nil {
return BadRequest(err)
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxcfs/master] Fix wrong scanning of memory.stat

2016-09-29 Thread albatross0 on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxcfs/pull/147

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) ===
/proc/meminfo displays wrong value.

```
# lxc-attach -n lxc02 -- mount | grep meminfo
lxcfs on /proc/meminfo type fuse.lxcfs (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other)
# lxc-attach -n lxc02 -- grep ^cache /sys/fs/cgroup/memory/lxc/lxc02/memory.stat
cache 8593408
# lxc-attach -n lxc02 -- grep -i ^cache /proc/meminfo
Cached:0 kB
```

Signed-off-by: KUWAZAWA Takuya 

From 3f5ba3a0c50fd94a4cb0cceaa19ddb3171bc0697 Mon Sep 17 00:00:00 2001
From: albatross0 
Date: Thu, 29 Sep 2016 20:23:27 +0900
Subject: [PATCH] Fix wrong scanning of memory.stat

Signed-off-by: KUWAZAWA Takuya 
---
 bindings.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bindings.c b/bindings.c
index 2f78ab5..f1044e7 100644
--- a/bindings.c
+++ b/bindings.c
@@ -2958,19 +2958,19 @@ static void parse_memstat(char *memstat, unsigned long 
*cached,
 
while (*memstat) {
if (startswith(memstat, "cache")) {
-   sscanf(memstat + 11, "%lu", cached);
+   sscanf(memstat + 5, "%lu", cached);
*cached /= 1024;
} else if (startswith(memstat, "active_anon")) {
sscanf(memstat + 11, "%lu", active_anon);
*active_anon /= 1024;
} else if (startswith(memstat, "inactive_anon")) {
-   sscanf(memstat + 11, "%lu", inactive_anon);
+   sscanf(memstat + 13, "%lu", inactive_anon);
*inactive_anon /= 1024;
} else if (startswith(memstat, "active_file")) {
sscanf(memstat + 11, "%lu", active_file);
*active_file /= 1024;
} else if (startswith(memstat, "inactive_file")) {
-   sscanf(memstat + 11, "%lu", inactive_file);
+   sscanf(memstat + 13, "%lu", inactive_file);
*inactive_file /= 1024;
} else if (startswith(memstat, "unevictable")) {
sscanf(memstat + 11, "%lu", unevictable);
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxc/master] tools: lxc-checkconfig conditionalize devpts check

2016-09-29 Thread brauner on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1217

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) ===
Only check for DEVPTS_MULTIPLE_INSTANCES on kernels < 4.7.

Signed-off-by: Christian Brauner 

Closes #1215.
From 873d48ce9334326b490a6ffdb1ae9e7b71869042 Mon Sep 17 00:00:00 2001
From: Christian Brauner 
Date: Thu, 29 Sep 2016 10:44:09 +0200
Subject: [PATCH] tools: lxc-checkconfig conditionalize devpts check

Only check for DEVPTS_MULTIPLE_INSTANCES on kernels < 4.7.

Signed-off-by: Christian Brauner 
---
 src/lxc/tools/lxc-checkconfig.in | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/lxc/tools/lxc-checkconfig.in b/src/lxc/tools/lxc-checkconfig.in
index 29586f8..61627e0 100644
--- a/src/lxc/tools/lxc-checkconfig.in
+++ b/src/lxc/tools/lxc-checkconfig.in
@@ -72,6 +72,16 @@ if gunzip -tq < $CONFIG 2>/dev/null; then
 CAT="zcat"
 fi
 
+KVER_MAJOR=$($CAT $CONFIG | grep '^# Linux.*Kernel Configuration' | \
+sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/')
+if [ "$KVER_MAJOR" = "2" ]; then
+KVER_MINOR=$($CAT $CONFIG | grep '^# Linux.*Kernel Configuration' | \
+sed -r 's/.* 2.6.([0-9]{2}).*/\1/')
+else
+KVER_MINOR=$($CAT $CONFIG | grep '^# Linux.*Kernel Configuration' | \
+sed -r 's/.* [0-9]\.([0-9]{1,3})\.[0-9]{1,3}.*/\1/')
+fi
+
 echo "--- Namespaces ---"
 echo -n "Namespaces: " && is_enabled CONFIG_NAMESPACES yes
 echo -n "Utsname namespace: " && is_enabled CONFIG_UTS_NS
@@ -79,7 +89,9 @@ echo -n "Ipc namespace: " && is_enabled CONFIG_IPC_NS yes
 echo -n "Pid namespace: " && is_enabled CONFIG_PID_NS yes
 echo -n "User namespace: " && is_enabled CONFIG_USER_NS
 echo -n "Network namespace: " && is_enabled CONFIG_NET_NS
-echo -n "Multiple /dev/pts instances: " && is_enabled DEVPTS_MULTIPLE_INSTANCES
+if ([ $KVER_MAJOR -lt 4 ]) || ([ $KVER_MAJOR -eq 4 ] && [ $KVER_MINOR -lt 7 
]); then
+   echo -n "Multiple /dev/pts instances: " && is_enabled 
DEVPTS_MULTIPLE_INSTANCES
+fi
 echo
 echo "--- Control groups ---"
 
@@ -89,15 +101,6 @@ print_cgroups() {
 }
 
 CGROUP_MNT_PATH=`print_cgroups cgroup /proc/self/mounts | head -n 1`
-KVER_MAJOR=$($CAT $CONFIG | grep '^# Linux.*Kernel Configuration' | \
-sed -r 's/.* ([0-9])\.[0-9]{1,2}\.[0-9]{1,3}.*/\1/')
-if [ "$KVER_MAJOR" = "2" ]; then
-KVER_MINOR=$($CAT $CONFIG | grep '^# Linux.*Kernel Configuration' | \
-sed -r 's/.* 2.6.([0-9]{2}).*/\1/')
-else
-KVER_MINOR=$($CAT $CONFIG | grep '^# Linux.*Kernel Configuration' | \
-sed -r 's/.* [0-9]\.([0-9]{1,3})\.[0-9]{1,3}.*/\1/')
-fi
 
 echo -n "Cgroup: " && is_enabled CONFIG_CGROUPS yes
 
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel