The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2391

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) ===
Variable name re-use was breaking it.

Signed-off-by: St├ęphane Graber <stgra...@ubuntu.com>
From d4efd0f6c770abc9456147bc9e7cfb56e4c99421 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Sat, 17 Sep 2016 02:18:46 -0400
Subject: [PATCH] network: Fix networkIsInUse
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Variable name re-use was breaking it.

Signed-off-by: St├ęphane Graber <stgra...@ubuntu.com>
---
 lxd/networks.go | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/lxd/networks.go b/lxd/networks.go
index cfd1e72..a5b29e3 100644
--- a/lxd/networks.go
+++ b/lxd/networks.go
@@ -14,23 +14,20 @@ import (
 
 // Helper functions
 func networkIsInUse(c container, name string) bool {
-       devices := c.ExpandedDevices()
-       for _, name := range devices.DeviceNames() {
-               device := devices[name]
-
-               if device["type"] != "nic" {
+       for _, d := range c.ExpandedDevices() {
+               if d["type"] != "nic" {
                        continue
                }
 
-               if !shared.StringInSlice(device["nictype"], []string{"bridged", 
"macvlan"}) {
+               if !shared.StringInSlice(d["nictype"], []string{"bridged", 
"macvlan"}) {
                        continue
                }
 
-               if device["parent"] == "" {
+               if d["parent"] == "" {
                        continue
                }
 
-               if device["parent"] == name {
+               if d["parent"] == name {
                        return true
                }
        }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to