WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xend: pci: show error msg properly if pci

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xend: pci: show error msg properly if pciback/pci-stub are not loaded
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sun, 22 Nov 2009 23:36:06 -0800
Delivery-date: Sun, 22 Nov 2009 23:39:12 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1258960987 0
# Node ID 2864f194279092b827e4dd1eeea949a48010b142
# Parent  005bd672d3af540c19e5c6dc9215556953aa8771
xend: pci: show error msg properly if pciback/pci-stub are not loaded

Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>
---
 tools/python/xen/util/pci.py      |   17 +++++++----------
 tools/python/xen/xend/XendNode.py |    2 ++
 tools/python/xen/xm/main.py       |    3 +++
 3 files changed, 12 insertions(+), 10 deletions(-)

diff -r 005bd672d3af -r 2864f1942790 tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py      Mon Nov 23 07:22:28 2009 +0000
+++ b/tools/python/xen/util/pci.py      Mon Nov 23 07:23:07 2009 +0000
@@ -517,20 +517,17 @@ def find_all_assignable_devices():
     '''
     sysfs_mnt = find_sysfs_mnt()
     pciback_path = sysfs_mnt + SYSFS_PCIBACK_PATH
-    pci_names = os.popen('ls ' + pciback_path).read()
-    pci_list = extract_the_exact_pci_names(pci_names)
+    pcistub_path = sysfs_mnt + SYSFS_PCISTUB_PATH
+    pci_names1 = os.popen('ls %s 2>/dev/null' % pciback_path).read()
+    pci_names2 = os.popen('ls %s 2>/dev/null' % pcistub_path).read()
+    if len(pci_names1) + len(pci_names2) == 0 :
+        return None
+    pci_list = extract_the_exact_pci_names(pci_names1)
+    pci_list = pci_list + extract_the_exact_pci_names(pci_names2)
     dev_list = []
     for pci in pci_list:
         dev = PciDevice(parse_pci_name(pci))
         dev_list = dev_list + [dev]
-
-    pcistub_path = sysfs_mnt + SYSFS_PCISTUB_PATH
-    pci_names = os.popen('ls ' + pcistub_path).read()
-    pci_list = extract_the_exact_pci_names(pci_names)
-    for pci in pci_list:
-        dev = PciDevice(parse_pci_name(pci))
-        dev_list = dev_list + [dev]
-
     return dev_list
 
 def transform_list(target, src):
diff -r 005bd672d3af -r 2864f1942790 tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Mon Nov 23 07:22:28 2009 +0000
+++ b/tools/python/xen/xend/XendNode.py Mon Nov 23 07:23:07 2009 +0000
@@ -924,6 +924,8 @@ class XendNode:
 
         # Each element of dev_list is a PciDevice
         dev_list = PciUtil.find_all_assignable_devices()
+        if dev_list is None:
+            return None
  
         # Each element of devs_list is a list of PciDevice
         devs_list = PciUtil.check_FLR_capability(dev_list)
diff -r 005bd672d3af -r 2864f1942790 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Mon Nov 23 07:22:28 2009 +0000
+++ b/tools/python/xen/xm/main.py       Mon Nov 23 07:23:07 2009 +0000
@@ -2313,6 +2313,9 @@ def xm_pci_list_assignable_devices(args)
     arg_check(args, "pci-list-assignable-devices", 0)
 
     devs =  server.xend.node.pciinfo()
+    if devs is None:
+        print "Error: pciback/pci-stub not loaded?"
+        return
  
     fmt_str = "%(domain)04x:%(bus)02x:%(slot)02x.%(func)01x"
     for x in devs:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xend: pci: show error msg properly if pciback/pci-stub are not loaded, Xen patchbot-unstable <=