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] tools: fix sysfs error path

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] tools: fix sysfs error path
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 21 Jan 2010 03:30:20 -0800
Delivery-date: Thu, 21 Jan 2010 03:30:22 -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 1264073231 0
# Node ID cec57fd4565efd45332440226709182be4336216
# Parent  0bf9e66c5201dcde607a335fd332e4a35ae9e6bc
tools: fix sysfs error path

Attached patch fixes sysfs error path.
NetBSD also has a /proc/mounts file but no sysfs.
On Linux you can test this with sysfs not mounted.

Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
---
 tools/python/xen/util/pci.py        |    2 ++
 tools/python/xen/util/utils.py      |    4 +++-
 tools/python/xen/util/vscsi_util.py |    3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff -r 0bf9e66c5201 -r cec57fd4565e tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py      Thu Jan 21 11:26:26 2010 +0000
+++ b/tools/python/xen/util/pci.py      Thu Jan 21 11:27:11 2010 +0000
@@ -441,6 +441,8 @@ def find_sysfs_mnt():
 
 def get_all_pci_names():
     sysfs_mnt = find_sysfs_mnt()
+    if sysfs_mnt is None:
+        return None
     pci_names = os.popen('ls ' + sysfs_mnt + 
SYSFS_PCI_DEVS_PATH).read().split()
     return pci_names
 
diff -r 0bf9e66c5201 -r cec57fd4565e tools/python/xen/util/utils.py
--- a/tools/python/xen/util/utils.py    Thu Jan 21 11:26:26 2010 +0000
+++ b/tools/python/xen/util/utils.py    Thu Jan 21 11:27:11 2010 +0000
@@ -68,7 +68,9 @@ def find_sysfs_mount():
                 continue
             if sline[2] == 'sysfs':
                 sysfs_mount_point= sline[1]
-                return sysfs_mount_point
+                break
+        mounts_file.close()
+        return sysfs_mount_point
     except IOError, (errno, strerr):
         raise
 
diff -r 0bf9e66c5201 -r cec57fd4565e tools/python/xen/util/vscsi_util.py
--- a/tools/python/xen/util/vscsi_util.py       Thu Jan 21 11:26:26 2010 +0000
+++ b/tools/python/xen/util/vscsi_util.py       Thu Jan 21 11:27:11 2010 +0000
@@ -123,6 +123,9 @@ def _vscsi_get_scsidevices_by_sysfs():
     except:
         return devices
 
+    if sysfs_mnt is None:
+        return devices
+
     for dirpath, dirnames, files in os.walk(sysfs_mnt + SYSFS_SCSI_PATH):
         for hctl in dirnames:
             paths = os.path.join(dirpath, hctl)

_______________________________________________
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] tools: fix sysfs error path, Xen patchbot-unstable <=