def add_fabrics(self, fabrics): res_fabrics = [] for fabric, pf in fabrics: fabric_type = None if pf in ("autoib", "autoeth"): fabric_type = pf.strip("auto") pf = self.pci_utils.get_auto_pf(fabric_type) else: fabric_type = self.pci_utils.get_interface_type(pf) verify_vendor_pf = self.pci_utils.verify_vendor_pf(pf, constants.VENDOR) if ( not verify_vendor_pf or not self.pci_utils.is_sriov_pf(pf) or not self.pci_utils.is_ifc_module(pf, fabric_type) ): LOG.error( "PF %s must have Mellanox Vendor ID" ",SR-IOV and driver module " "enabled. Terminating!" % pf ) sys.exit(1) if fabric_type: self.eswitches[fabric] = eswitch_db.eSwitchDB() self._add_fabric(fabric, pf, fabric_type) res_fabrics.append((fabric, pf, fabric_type)) else: LOG.info("No fabric type for PF:%s.Terminating!" % pf) sys.exit(1) self.sync_devices()
def add_fabrics(self, fabrics): res_fabrics = [] for fabric, pf in fabrics: fabric_type = None if pf in ('autoib', 'autoeth'): fabric_type = pf.strip('auto') pf = self.pci_utils.get_auto_pf(fabric_type) else: fabric_type = self.pci_utils.get_interface_type(pf) if (not self.pci_utils.verify_vendor_pf(pf, constants.VENDOR) or not self.pci_utils.is_sriov_pf(pf) or not self.pci_utils.is_ifc_module(pf, fabric_type)): LOG.error( "PF %s must have Mellanox Vendor ID" ",SR-IOV and driver module enabled.Terminating!" % pf) sys.exit(1) if fabric_type: self.eswitches[fabric] = eswitch_db.eSwitchDB() self._add_fabric(fabric, pf, fabric_type) res_fabrics.append((fabric, pf, fabric_type)) else: LOG.debug("No fabric type for PF:%s.Terminating!" % pf) sys.exit(1) self.sync_devices() if hasattr(self, 'of_handler'): self.of_handler.add_fabrics(res_fabrics)