[lxc-devel] [lxd/master] Bugfixes

stgraber on Github lxc-bot at linuxcontainers.org
Tue Jan 24 01:05:39 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170124/081e3e3e/attachment.bin>
-------------- next part --------------
From 98056cc534ccf120c6d054a54a86cbd6e08e3c9e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 23 Jan 2017 00:56:06 -0500
Subject: [PATCH 1/6] api: Add more API extension tags
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 shared/api/container_state.go | 2 ++
 shared/api/network.go         | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/shared/api/container_state.go b/shared/api/container_state.go
index f9aa765..9d38f4c 100644
--- a/shared/api/container_state.go
+++ b/shared/api/container_state.go
@@ -28,6 +28,8 @@ type ContainerStateDisk struct {
 }
 
 // ContainerStateCPU represents the cpu information section of a LXD container's state
+//
+// API extension: container_cpu_time
 type ContainerStateCPU struct {
 	Usage int64 `json:"usage"`
 }
diff --git a/shared/api/network.go b/shared/api/network.go
index 6c616ab..7773196 100644
--- a/shared/api/network.go
+++ b/shared/api/network.go
@@ -1,6 +1,8 @@
 package api
 
 // NetworksPost represents the fields of a new LXD network
+//
+// API extension: network
 type NetworksPost struct {
 	NetworkPut `yaml:",inline"`
 

From dc2e136f6c8664a7ad754667220503d198a9650e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 23 Jan 2017 16:22:54 -0500
Subject: [PATCH 2/6] Fix typo
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 test/suites/database_update.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/suites/database_update.sh b/test/suites/database_update.sh
index 4856470..577abb3 100644
--- a/test/suites/database_update.sh
+++ b/test/suites/database_update.sh
@@ -15,7 +15,7 @@ test_database_update(){
   tables=$(sqlite3 "${MIGRATE_DB}" ".dump" | grep -c "CREATE TABLE")
   [ "${tables}" -eq "${expected_tables}" ] || { echo "FAIL: Wrong number of tables after database migration. Found: ${tables}, expected ${expected_tables}"; false; }
 
-  # There should be 13 "ON DELETE CASCADE" occurences
+  # There should be 13 "ON DELETE CASCADE" occurrences
   expected_cascades=12
   cascades=$(sqlite3 "${MIGRATE_DB}" ".dump" | grep -c "ON DELETE CASCADE")
   [ "${cascades}" -eq "${expected_cascades}" ] || { echo "FAIL: Wrong number of ON DELETE CASCADE foreign keys. Found: ${cascades}, exected: ${expected_cascades}"; false; }

From b8d2cc5d750aa84fe4aaf4c273d0a7d6679518e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 23 Jan 2017 17:52:20 -0500
Subject: [PATCH 3/6] network: Properly detect vlans
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #2809

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/networks.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lxd/networks.go b/lxd/networks.go
index 237a883..ce12c42 100644
--- a/lxd/networks.go
+++ b/lxd/networks.go
@@ -205,6 +205,8 @@ func doNetworkGet(d *Daemon, name string) (api.Network, error) {
 		}
 
 		n.Type = "bridge"
+	} else if shared.PathExists(fmt.Sprintf("/proc/net/vlan/%s", n.Name)) {
+		n.Type = "vlan"
 	} else if shared.PathExists(fmt.Sprintf("/sys/class/net/%s/device", n.Name)) {
 		n.Type = "physical"
 	} else if shared.PathExists(fmt.Sprintf("/sys/class/net/%s/bonding", n.Name)) {

From e7f31632ba7f0ebf970826b539ec3e553977eee7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 23 Jan 2017 17:57:20 -0500
Subject: [PATCH 4/6] network: Handle empty dnsmasq pid file
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #2767

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/networks_utils.go | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lxd/networks_utils.go b/lxd/networks_utils.go
index f632121..6122d9d 100644
--- a/lxd/networks_utils.go
+++ b/lxd/networks_utils.go
@@ -617,6 +617,17 @@ func networkKillDnsmasq(name string, reload bool) error {
 	}
 	pid := strings.TrimSpace(string(content))
 
+	// Check for empty string
+	if pid == "" {
+		os.Remove(pidPath)
+
+		if reload {
+			return fmt.Errorf("dnsmasq isn't running")
+		}
+
+		return nil
+	}
+
 	// Check if the process still exists
 	if !shared.PathExists(fmt.Sprintf("/proc/%s", pid)) {
 		os.Remove(pidPath)

From cd0e39e12e5e43c8992119fecdd12b2ae95933c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 23 Jan 2017 18:03:06 -0500
Subject: [PATCH 5/6] patches: Mark all patches as applied on create
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/db.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lxd/db.go b/lxd/db.go
index 2473958..1c655b6 100644
--- a/lxd/db.go
+++ b/lxd/db.go
@@ -201,6 +201,11 @@ func createDb(db *sql.DB) (err error) {
 		return err
 	}
 
+	// Mark all existing patches as applied
+	for _, p := range patches {
+		dbPatchesMarkApplied(db, p.name)
+	}
+
 	err = dbProfileCreateDefault(db)
 	if err != nil {
 		return err

From b4f9fbc60f2bf7440fefebe13bc40a1bfa4b0247 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 23 Jan 2017 20:03:18 -0500
Subject: [PATCH 6/6] btrfs: Don't assume a path is a subvolume
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Don't assume that any directory that's stored on a btrfs partition is
going to be a subvolume.

This fixes problems when creating containers on a btrfs-backed system
that doesn't have the btrfs tools installed.

Closes #2748

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/storage.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lxd/storage.go b/lxd/storage.go
index 774366c..d9e0e7c 100644
--- a/lxd/storage.go
+++ b/lxd/storage.go
@@ -257,6 +257,12 @@ func storageForFilename(d *Daemon, filename string) (storage, error) {
 		if err != nil {
 			return nil, fmt.Errorf("couldn't detect filesystem for '%s': %v", filename, err)
 		}
+
+		if filesystem == "btrfs" {
+			if !(*storageBtrfs).isSubvolume(nil, filename) {
+				filesystem = ""
+			}
+		}
 	}
 
 	if shared.PathExists(filename + ".lv") {


More information about the lxc-devel mailing list