connector – Connector

connector – Connector

Brick Connector objects for each supported transport protocol.

The connectors here are responsible for discovering and removing volumes for each of the supported transport protocols.

class os_brick.initiator.connector.InitiatorConnector
static factory(protocol, root_helper, driver=None, use_multipath=False, device_scan_attempts=3, arch=None, *args, **kwargs)

Build a Connector object based upon protocol and architecture.

class os_brick.initiator.connector.ISCSIConnector(root_helper: str, driver=None, execute=None, use_multipath: bool = False, device_scan_attempts: int = 3, transport: str = 'default', *args, **kwargs)

Connector class to attach/detach iSCSI volumes.

connect_volume(connection_properties: dict) Optional[dict[str, str]]

Attach the volume to instance_name.

Parameters:

connection_properties (dict) – The valid dictionary that describes all of the target volume attributes.

Returns:

dict

connection_properties for iSCSI must include: target_portal(s) - ip and optional port target_iqn(s) - iSCSI Qualified Name target_lun(s) - LUN id of the volume Note that plural keys may be used when use_multipath=True

disconnect_volume(connection_properties: dict, device_info: dict, force: bool = False, ignore_errors: bool = False) None

Detach the volume from instance_name.

Parameters:
  • connection_properties (dict that must include: target_portal(s) - IP and optional port target_iqn(s) - iSCSI Qualified Name target_lun(s) - LUN id of the volume) – The dictionary that describes all of the target volume attributes.

  • device_info (dict) – historical difference, but same as connection_props

  • force (bool) – Whether to forcefully disconnect even if flush fails.

  • ignore_errors (bool) – When force is True, this will decide whether to ignore errors or raise an exception once finished the operation. Default is False.

class os_brick.initiator.connector.FibreChannelConnector(root_helper: str, driver=None, execute: Optional[str] = None, use_multipath: bool = False, device_scan_attempts: int = 3, *args, **kwargs)

Connector class to attach/detach Fibre Channel volumes.

connect_volume(connection_properties: dict) dict

Attach the volume to instance_name.

Parameters:

connection_properties (dict) – The dictionary that describes all of the target volume attributes.

Returns:

dict

connection_properties for Fibre Channel must include: target_wwn - World Wide Name target_lun - LUN id of the volume

disconnect_volume(connection_properties: dict, device_info: dict, force: bool = False, ignore_errors: bool = False) None

Detach the volume from instance_name.

Parameters:
  • connection_properties (dict) – The dictionary that describes all of the target volume attributes.

  • device_info (dict) – historical difference, but same as connection_props

connection_properties for Fibre Channel must include: target_wwn - World Wide Name target_lun - LUN id of the volume

class os_brick.initiator.connector.LocalConnector(root_helper, driver=None, *args, **kwargs)

“Connector class to attach/detach File System backed volumes.

connect_volume(connection_properties: dict) dict

Connect to a volume.

Parameters:

connection_properties (dict) –

The dictionary that describes all of the target volume attributes. connection_properties must include:

  • device_path - path to the volume to be connected

Returns:

dict

disconnect_volume(connection_properties, device_info, force=False, ignore_errors=False)

Disconnect a volume from the local host.

Parameters:
  • connection_properties (dict) – The dictionary that describes all of the target volume attributes.

  • device_info (dict) – historical difference, but same as connection_props

class os_brick.initiator.connector.HuaweiStorHyperConnector(root_helper, driver=None, *args, **kwargs)

“Connector class to attach/detach SDSHypervisor volumes.

connect_volume(connection_properties)

Connect to a volume.

Parameters:

connection_properties (dict) – The dictionary that describes all of the target volume attributes.

Returns:

dict

disconnect_volume(connection_properties, device_info, force=False, ignore_errors=False)

Disconnect a volume from the local host.

Parameters:
  • connection_properties (dict) – The dictionary that describes all of the target volume attributes.

  • device_info (dict) – historical difference, but same as connection_props

class os_brick.initiator.connectors.nvmeof.NVMeOFConnector(root_helper: str, driver: Optional[HostDriver] = None, use_multipath: bool = False, device_scan_attempts: int = 5, *args, **kwargs)

Connector class to attach/detach NVMe-oF volumes.

connect_volume(connection_properties: NVMeOFConnProps) dict[str, str]

Attach and discover the volume.

disconnect_volume(connection_properties: dict, device_info: dict[str, str], force: bool = False, ignore_errors: bool = False) None

Flush the volume.

Disconnect of volumes happens on storage system side. Here we could remove connections to subsystems if no volumes are left. But new volumes can pop up asynchronously in the meantime. So the only thing left is flushing or disassembly of a correspondng RAID device.

Parameters:
  • connection_properties (dict) – The dictionary that describes all of the target volume attributes as described in connect_volume but also with the “device_path” key containing the path to the volume that was connected (this is added by Nova).

  • device_info (dict) – historical difference, but same as connection_props

extend_volume(connection_properties: dict[str, str]) int

Update an attached volume to reflect the current size after extend

The only way to reflect the new size of an NVMe-oF volume on the host is a rescan, which rescans the whole subsystem. This is a problem on attach_volume and detach_volume, but not here, since we will have at least the namespace we are operating on in the subsystem.

The tricky part is knowing when a rescan has already been completed and the volume size on sysfs is final. The rescan may already have happened before this method is called due to an AER message or we may need to trigger it here.

Scans can be triggered manually with ‘nvme ns-rescan’ or writing 1 in configf’s rescan file, or they can be triggered indirectly when calling the ‘nvme list’, ‘nvme id-ns’, or even using the ‘nvme admin-passthru’ command.

Even after getting the new size with any of the NVMe commands above, we still need to wait until this is reflected on the host device, because we cannot return to the caller until the new size is in effect.

If we don’t see the new size taking effect on the system after 5 seconds, or if we cannot get the new size with nvme, then we rescan in the latter and in both cases we blindly wait 5 seconds and return whatever size is present.

For replicated volumes, the RAID needs to be extended.

get_volume_paths(connection_properties: NVMeOFConnProps, device_info: Optional[dict[str, str]] = None) list[str]

Return paths where the volume is present.

classmethod get_connector_properties(root_helper, *args, **kwargs) dict

The NVMe-oF connector properties (initiator uuid and nqn.)

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.