From d76151d47bdc480869820cb7190aaa85a717f504 Mon Sep 17 00:00:00 2001 From: Patrick Callahan Date: Tue, 18 Jun 2013 22:48:05 -0400 Subject: [PATCH] bug fix: modify get_device_facts to handle servers with multiple pci domains On machines with multiple pci domains get_device_facts would fail to find a matching pci device causing setup to fail. Also on some platforms there is additional information between the pci information and 'host'. Modified get_device_facts to call lspci with the -D option and modified the regex to account for the pci domain and to be more selective. --- system/setup | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/system/setup b/system/setup index 9ad6c7edf1a..292496b6d0f 100644 --- a/system/setup +++ b/system/setup @@ -633,7 +633,7 @@ class LinuxHardware(Hardware): self.facts['devices'] = {} lspci = module.get_bin_path('lspci') if lspci: - rc, pcidata, err = module.run_command(lspci) + rc, pcidata, err = module.run_command([lspci, '-D']) else: pcidata = None @@ -704,7 +704,9 @@ class LinuxHardware(Hardware): d['size'] = module.pretty_bytes(float(d['sectors']) * float(d['sectorsize'])) d['host'] = "" - m = re.match(".+/[a-f0-9]+:([a-f0-9]+:[a-f0-9]+\.[a-f0-9]+)/host\d+/", sysdir) + + # domains are numbered (0 to ffff), bus (0 to ff), slot (0 to 1f), and function (0 to 7). + m = re.match(".+/([a-f0-9]{4}:[a-f0-9]{2}:[0|1][a-f0-9]\.[0-7])/", sysdir) if m and pcidata: pciid = m.group(1) did = re.escape(pciid)