[lxc-devel] [lxd/master] lxd/resources/net: More flexible PCI detection

stgraber on Github lxc-bot at linuxcontainers.org
Thu Jun 18 16:01:37 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200618/ea63ac35/attachment.bin>
-------------- next part --------------
From 6c2d0d039346d2e2b524e1b9bd207be182abe0a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 18 Jun 2020 11:54:54 -0400
Subject: [PATCH] lxd/resources/net: More flexible PCI detection
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/resources/network.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/resources/network.go b/lxd/resources/network.go
index fb3d6a1a3c..3ab64405be 100644
--- a/lxd/resources/network.go
+++ b/lxd/resources/network.go
@@ -304,7 +304,7 @@ func GetNetwork() (*api.ResourcesNetwork, error) {
 				return nil, errors.Wrapf(err, "Failed to track down \"%s\"", devicePath)
 			}
 
-			if strings.HasPrefix(linkTarget, "/sys/devices/pci") && sysfsExists(filepath.Join(devicePath, "subsystem")) {
+			if strings.Contains(linkTarget, "/pci") && sysfsExists(filepath.Join(devicePath, "subsystem")) {
 				virtio := strings.HasPrefix(filepath.Base(linkTarget), "virtio")
 				if virtio {
 					linkTarget = filepath.Dir(linkTarget)


More information about the lxc-devel mailing list