[prev in list] [next in list] [prev in thread] [next in thread]
List: lxc-devel
Subject: [lxc-devel] [lxd/master] lxd/init: Allow using an existing bridge
From: stgraber on Github <lxc-bot () linuxcontainers ! org>
Date: 2018-03-29 19:36:47
Message-ID: 20180329193647.D1F94523D0 () mailman01 ! srv ! dcmtl ! stgraber ! net
[Download RAW message or body]
[Attachment #2 (text/x-mailbox)]
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4376
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 <stgraber@ubuntu.com>
[Attachment #3 (text/plain)]
From 19f2f6da83eed78c6fac180b6049168487901d26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stéphane Graber?= <stgraber@ubuntu.com>
Date: Thu, 29 Mar 2018 15:33:42 -0400
Subject: [PATCH] lxd/init: Allow using an existing bridge
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
---
lxd/main_init_interactive.go | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/lxd/main_init_interactive.go b/lxd/main_init_interactive.go
index a616e31ef..8094fad65 100644
--- a/lxd/main_init_interactive.go
+++ b/lxd/main_init_interactive.go
@@ -241,6 +241,32 @@ func (c *cmdInit) askClustering(config *initData, d \
lxd.ContainerServer) error {
func (c *cmdInit) askNetworking(config *initData, d lxd.ContainerServer) error {
if !cli.AskBool("Would you like to create a new network bridge (yes/no) \
[default=yes]? ", "yes") { + if cli.AskBool("Would you like to configure LXD to use \
an existing bridge or host interface (yes/no) [default=no]? ", "no") { + for {
+ name := cli.AskString("Name of the existing bridge or host interface: ", "", \
nil) +
+ if !shared.PathExists(fmt.Sprintf("/sys/class/net/%s", name)) {
+ fmt.Println("The requested interface doesn't exist. Please choose another \
one.") + continue
+ }
+
+ nicType := "macvlan"
+ if shared.PathExists(fmt.Sprintf("/sys/class/net/%s/bridge", name)) {
+ nicType = "bridged"
+ }
+
+ // Add to the default profile
+ config.Profiles[0].Devices["eth0"] = map[string]string{
+ "type": "nic",
+ "nictype": nicType,
+ "name": "eth0",
+ "parent": name,
+ }
+
+ break
+ }
+ }
+
return nil
}
[Attachment #4 (text/plain)]
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic