[lxc-devel] [lxd/master] Network: Don't fail when resetting SRIOV VF MAC to 00:00:00:00:00:00

tomponline on Github lxc-bot at linuxcontainers.org
Tue Nov 17 16:51:49 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 426 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201117/9a568e99/attachment.bin>
-------------- next part --------------
From f41c8ef7f40497e2ccdbcc8b8e1e8a8e7964dc56 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 17 Nov 2020 16:50:34 +0000
Subject: [PATCH] lxd/device/nic/sriov: Don't fail when resetting VF MAC to
 00:00:00:00:00:00

Apparently the bnx2x devices don't allow this.

Fixes #8162

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/device/nic_sriov.go | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lxd/device/nic_sriov.go b/lxd/device/nic_sriov.go
index fe358a3252..5e7a447401 100644
--- a/lxd/device/nic_sriov.go
+++ b/lxd/device/nic_sriov.go
@@ -461,11 +461,9 @@ func (d *nicSRIOV) setupSriovParent(vfDevice string, vfID int, volatile map[stri
 			return vfPCIDev, err
 		}
 	} else {
-		// Reset VF to ensure no previous MAC restriction exists.
-		_, err := shared.TryRunCommand("ip", "link", "set", "dev", d.config["parent"], "vf", volatile["last_state.vf.id"], "mac", "00:00:00:00:00:00")
-		if err != nil {
-			return vfPCIDev, err
-		}
+		// Try to reset VF to ensure no previous MAC restriction exists, as some devices require this
+		// before being able to set a new VF MAC. However some devices don't allow it so ignore failures.
+		shared.TryRunCommand("ip", "link", "set", "dev", d.config["parent"], "vf", volatile["last_state.vf.id"], "mac", "00:00:00:00:00:00")
 
 		// Ensure spoof checking is disabled if not enabled in instance.
 		_, err = shared.TryRunCommand("ip", "link", "set", "dev", d.config["parent"], "vf", volatile["last_state.vf.id"], "spoofchk", "off")


More information about the lxc-devel mailing list