def connect_volume(self, connection_properties): volume_paths = self.get_volume_paths(connection_properties) if not volume_paths: raise exception.NoFibreChannelVolumeDeviceFound() device_path = volume_paths[0] device_number = self._diskutils.get_device_number_from_device_name( device_path) scsi_wwn = self._get_scsi_wwn(device_number) device_info = { 'type': 'block', 'path': device_path, 'number': device_number, 'scsi_wwn': scsi_wwn } return device_info
def connect_volume(self, connection_properties, scan_tries): """Attach the volume to instance_name. connection_properties for Fibre Channel must include: target_wwn - Specified port WWNs target_lun - LUN id of the volume """ device_info = {'type': 'block'} target_wwn = connection_properties['target_wwn'] target_lun = connection_properties['target_lun'] wwns = [] if isinstance(target_wwn, list): wwns = target_wwn else: wwns.append(target_wwn) # The scsi_vhci disk node is not always present immediately. # Sometimes we need to reinitialize the connection to trigger # a refresh. for i in range(1, scan_tries): # initiator needs time to refresh the LU list time.sleep(i * 2) host_device = self._get_device_path(wwns[0], target_lun) if host_device is not None and os.path.exists(host_device): break else: self._refresh_connection() else: msg = _("Fibre Channel volume device not found.") LOG.error(msg) raise exception.NoFibreChannelVolumeDeviceFound() # Set the label EFI to the disk on SPARC before it is accessed and # make sure the correct device path with slice 0 # (like '/dev/rdsk/c0t600xxxd0s0'). if platform.processor() == 'sparc': tmp_dev_name = host_device.rsplit('s', 1) disk_name = tmp_dev_name[0].split('/')[-1] (out, _err) = self.execute('/usr/sbin/format', '-L', 'efi', '-d', disk_name) host_device = '%ss0' % tmp_dev_name[0] device_info['path'] = host_device return device_info
def _wait_for_device_discovery(host_devices): for device in host_devices: LOG.debug("Looking for Fibre Channel dev %(device)s", {'device': device}) if os.path.exists(device) and self.check_valid_device(device): self.host_device = device # get the /dev/sdX device. This variable is maintained to # keep the same log output. self.device_name = os.path.realpath(device) raise loopingcall.LoopingCallDone() if self.tries >= self.device_scan_attempts: LOG.error("Fibre Channel volume device not found.") raise exception.NoFibreChannelVolumeDeviceFound() LOG.info("Fibre Channel volume device not yet found. " "Will rescan & retry. Try number: %(tries)s.", {'tries': self.tries}) self._linuxfc.rescan_hosts(hbas, connection_properties) self.tries = self.tries + 1
def _wait_for_device_discovery(host_devices): tries = self.tries for device in host_devices: LOG.debug("Looking for Fibre Channel dev %(device)s", {'device': device}) if os.path.exists(device): self.host_device = device # get the /dev/sdX device. This is used # to find the multipath device. self.device_name = os.path.realpath(device) raise loopingcall.LoopingCallDone() if self.tries >= self.device_scan_attempts: LOG.error(_LE("Fibre Channel volume device not found.")) raise exception.NoFibreChannelVolumeDeviceFound() LOG.info(_LI("Fibre Channel volume device not yet found. " "Will rescan & retry. Try number: %(tries)s."), {'tries': tries}) self._linuxfc.rescan_hosts(hbas, connection_properties['target_lun']) self.tries = self.tries + 1