# we have to realize this may incur security issue and we can't make sure the
# device assignment could really work properly even after we do this.
#(pci-passthrough-strict-check yes)
+
+# If we have a very big scsi device configuration, start of xend is slow,
+# because xend scans all the device paths to build its internal PSCSI device
+# list. If we need only a few devices for assigning to a guest, we can reduce
+# the scan to this device. Set list list of device paths in same syntax like in
+# command lsscsi, e.g. ('16:0:0:0' '15:0')
+# (pscsi-device-mask ('*'))
+
return devices
-def vscsi_get_scsidevices():
+def vscsi_get_scsidevices(mask=""):
""" get all scsi devices information """
- devices = _vscsi_get_scsidevices_by_lsscsi("")
- if devices:
+ devices = _vscsi_get_scsidevices_by_lsscsi("[%s]" % mask)
+ if devices or (len(mask) and mask[0] != "*"):
+ # devices found or partial device scan
return devices
return _vscsi_get_scsidevices_by_sysfs()
return _make_scsi_record(scsi_info)
return None
-def get_all_scsi_devices():
+def get_all_scsi_devices(mask=""):
scsi_records = []
- for scsi_info in vscsi_get_scsidevices():
+ for scsi_info in vscsi_get_scsidevices(mask):
scsi_record = _make_scsi_record(scsi_info)
scsi_records.append(scsi_record)
return scsi_records
pscsi_table = {}
pscsi_HBA_table = {}
- for pscsi_record in vscsi_util.get_all_scsi_devices():
+ pscsi_records = []
+ for pscsi_mask in xendoptions().get_pscsi_device_mask():
+ pscsi_records += vscsi_util.get_all_scsi_devices(pscsi_mask)
+ log.debug("pscsi record count: %s" % len(pscsi_records))
+
+ for pscsi_record in pscsi_records:
scsi_id = pscsi_record['scsi_id']
if scsi_id:
saved_HBA_uuid = None
"""
print >>sys.stderr, "xend [ERROR]", fmt % args
+ """Default mask for pscsi device scan."""
+ xend_pscsi_device_mask = ['*']
+
def configure(self):
self.set_config()
return self.get_config_bool("pci-passthrough-strict-check",
self.pci_dev_assign_strict_check_default)
+ def get_pscsi_device_mask(self):
+ return self.get_config_value("pscsi-device-mask",
+ self.xend_pscsi_device_mask)
+
class XendOptionsFile(XendOptions):
"""Default path to the config file."""