[lxc-devel] [lxd/master] infiniband: name devices inside container ib<idx>
brauner on Github
lxc-bot at linuxcontainers.org
Sat Dec 9 16:11:02 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 381 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171209/1157aaee/attachment.bin>
-------------- next part --------------
From 1978d577f009153d2d049f3a742fb68a2b53dd75 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sat, 9 Dec 2017 17:01:50 +0100
Subject: [PATCH] infiniband: name devices inside container ib<idx>
Closes #4089.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
lxd/container_lxc.go | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 5a1984b93..bc663a7ae 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -6663,10 +6663,16 @@ func (c *containerLXC) fillNetworkDevice(name string, m types.Device) (types.Dev
}
}
- // Find a free ethX device
i := 0
+ name := ""
for {
- name := fmt.Sprintf("eth%d", i)
+ if m["type"] == "infiniband" {
+ name = fmt.Sprintf("ib%d", i)
+ } else {
+ name = fmt.Sprintf("eth%d", i)
+ }
+
+ // Find a free device name
if !shared.StringInSlice(name, devNames) {
return name, nil
}
More information about the lxc-devel
mailing list