[lxc-devel] [lxd/master] networks/utils: Cleaned up the device bind/unbind functions for SR-IOV
tomponline on Github
lxc-bot at linuxcontainers.org
Thu Jun 20 08:30:44 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 394 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190620/ea789887/attachment.bin>
-------------- next part --------------
From 0d8b7b6b6beedd8fa4cf4974d8b1abe2d8115af2 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Thu, 20 Jun 2019 09:29:48 +0100
Subject: [PATCH] networks/utils: Cleaned up the device bind/unbind functions
for SR-IOV
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/networks_utils.go | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/lxd/networks_utils.go b/lxd/networks_utils.go
index 3403854f0d..ba23759f58 100644
--- a/lxd/networks_utils.go
+++ b/lxd/networks_utils.go
@@ -1531,22 +1531,12 @@ func networkGetVFDeviceDriverPath(parentName string, vfID string) (string, error
// networkDeviceUnbind unbinds a network device from the OS using its PCI Slot Name and driver path.
func networkDeviceUnbind(pciSlotName string, driverPath string) error {
- err := ioutil.WriteFile(fmt.Sprintf("%s/unbind", driverPath), []byte(pciSlotName), 0600)
- if err != nil {
- return err
- }
-
- return nil
+ return ioutil.WriteFile(fmt.Sprintf("%s/unbind", driverPath), []byte(pciSlotName), 0600)
}
// networkDeviceUnbind binds a network device to the OS using its PCI Slot Name and driver path.
func networkDeviceBind(pciSlotName string, driverPath string) error {
- err := ioutil.WriteFile(fmt.Sprintf("%s/bind", driverPath), []byte(pciSlotName), 0600)
- if err != nil {
- return err
- }
-
- return nil
+ return ioutil.WriteFile(fmt.Sprintf("%s/bind", driverPath), []byte(pciSlotName), 0600)
}
// networkDeviceBindWait waits for network interface to appear after being binded.
More information about the lxc-devel
mailing list