[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] tools: fix sysfs error path
# 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |