xend: pci: show error msg properly if pciback/pci-stub are not loaded

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
This commit is contained in:
Keir Fraser committed 2009-11-23 07:23:07 +00:00
1 parent 8ed87184f7
commit a9c7cc22db
3 files changed
+12 -10

No files matched your search

+7 -10
View File
@@ -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):
+2
View File
@@ -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)
+3
View File
@@ -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:
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.