[lxc-devel] [lxd/master] Bugfixes and minor features

stgraber on Github lxc-bot at linuxcontainers.org
Sun Apr 23 20:58:37 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/20170423/81135c98/attachment.bin>
-------------- next part --------------
From 9e6be3071eb465510c6196ccc3996d0a1a67d992 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sun, 23 Apr 2017 16:53:13 -0400
Subject: [PATCH 1/2] doc: FIx naming of bwlimit api extension
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>
---
 doc/api-extensions.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/api-extensions.md b/doc/api-extensions.md
index 7223ec8..8207a52 100644
--- a/doc/api-extensions.md
+++ b/doc/api-extensions.md
@@ -256,6 +256,6 @@ If "path" is set without "source" and "major/minor" isn't set,
 we should assume that "source" will be the same as "path".
 So at least one of them must be set.
 
-## rsync.bwlimit
+## storage\_rsync\_bwlimit
 When rsync has to be invoked to transfer storage entities setting rsync.bwlimit
 places an upper limit on the amount of socket I/O allowed.

From 5b5484b8ab68423f673bdced9666f97b19523928 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sun, 23 Apr 2017 16:57:29 -0400
Subject: [PATCH 2/2] Allow overriding the VXLAN multicast interface
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>
---
 doc/api-extensions.md  |  5 +++++
 doc/networks.md        |  1 +
 lxd/api_1.0.go         |  1 +
 lxd/networks.go        | 10 +++++++---
 lxd/networks_config.go | 11 ++++++-----
 5 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/doc/api-extensions.md b/doc/api-extensions.md
index 8207a52..8cf17f3 100644
--- a/doc/api-extensions.md
+++ b/doc/api-extensions.md
@@ -259,3 +259,8 @@ So at least one of them must be set.
 ## storage\_rsync\_bwlimit
 When rsync has to be invoked to transfer storage entities setting rsync.bwlimit
 places an upper limit on the amount of socket I/O allowed.
+
+## network\_vxlan\_interface
+This introduces a new tunnel.NAME.interface option for networks.
+
+This key control what host network interface is used for a VXLAN tunnel.
diff --git a/doc/networks.md b/doc/networks.md
index 65aab79..82b846f 100644
--- a/doc/networks.md
+++ b/doc/networks.md
@@ -33,6 +33,7 @@ tunnel.NAME.remote              | string    | gre or vxlan          | -
 tunnel.NAME.group               | string    | vxlan                 | 239.0.0.1                 | Multicast address for vxlan (used if local and remote aren't set)
 tunnel.NAME.port                | integer   | vxlan                 | 0                         | Specific port to use for the vxlan tunnel
 tunnel.NAME.id                  | integer   | vxlan                 | 0                         | Specific tunnel ID to use for the vxlan tunnel
+tunnel.NAME.interface           | string    | vxlan                 | -                         | Specific host interface to use for the tunnel
 ipv4.address                    | string    | standard mode         | random unused subnet      | IPv4 address for the bridge (CIDR notation). Use "none" to turn off IPv4 or "auto" to generate a new one
 ipv4.nat                        | boolean   | ipv4 address          | false                     | Whether to NAT (will default to true if unset and a random ipv4.address is generated)
 ipv4.dhcp                       | boolean   | ipv4 address          | true                      | Whether to allocate addresses using DHCP
diff --git a/lxd/api_1.0.go b/lxd/api_1.0.go
index 7cd7b5b..bdf7c54 100644
--- a/lxd/api_1.0.go
+++ b/lxd/api_1.0.go
@@ -103,6 +103,7 @@ func api10Get(d *Daemon, r *http.Request) Response {
 			"unix_device_rename",
 			"storage_lvm_use_thinpool",
 			"storage_rsync_bwlimit",
+			"network_vxlan_interface",
 		},
 		APIStatus:  "stable",
 		APIVersion: version.APIVersion,
diff --git a/lxd/networks.go b/lxd/networks.go
index 5e2e1b6..1f54977 100644
--- a/lxd/networks.go
+++ b/lxd/networks.go
@@ -1068,6 +1068,7 @@ func (n *network) Start() error {
 			cmd = append(cmd, []string{"type", "gretap", "local", tunLocal, "remote", tunRemote}...)
 		} else if tunProtocol == "vxlan" {
 			tunGroup := getConfig("group")
+			tunInterface := getConfig("interface")
 
 			// Skip partial configs
 			if tunProtocol == "" {
@@ -1083,9 +1084,12 @@ func (n *network) Start() error {
 					tunGroup = "239.0.0.1"
 				}
 
-				_, devName, err := networkDefaultGatewaySubnetV4()
-				if err != nil {
-					return err
+				devName := tunInterface
+				if devName == "" {
+					_, devName, err = networkDefaultGatewaySubnetV4()
+					if err != nil {
+						return err
+					}
 				}
 
 				cmd = append(cmd, []string{"group", tunGroup, "dev", devName}...)
diff --git a/lxd/networks_config.go b/lxd/networks_config.go
index fd6b17f..df3a627 100644
--- a/lxd/networks_config.go
+++ b/lxd/networks_config.go
@@ -46,11 +46,12 @@ var networkConfigKeys = map[string]func(value string) error{
 	"tunnel.TARGET.protocol": func(value string) error {
 		return shared.IsOneOf(value, []string{"gre", "vxlan"})
 	},
-	"tunnel.TARGET.local":  networkValidAddressV4,
-	"tunnel.TARGET.remote": networkValidAddressV4,
-	"tunnel.TARGET.port":   networkValidPort,
-	"tunnel.TARGET.group":  networkValidAddressV4,
-	"tunnel.TARGET.id":     shared.IsInt64,
+	"tunnel.TARGET.local":     networkValidAddressV4,
+	"tunnel.TARGET.remote":    networkValidAddressV4,
+	"tunnel.TARGET.port":      networkValidPort,
+	"tunnel.TARGET.group":     networkValidAddressV4,
+	"tunnel.TARGET.id":        shared.IsInt64,
+	"tunnel.TARGET.interface": networkValidName,
 
 	"ipv4.address": func(value string) error {
 		if shared.IsOneOf(value, []string{"none", "auto"}) == nil {


More information about the lxc-devel mailing list