ironic.common.cinder.
attach_volumes
(task, volume_list, connector)[source]¶Attach volumes to a node.
Enumerate through the provided list of volumes and attach the volumes to the node defined in the task utilizing the provided connector information.
If an attachment appears to already exist, we will skip attempting to attach the volume. If use of the volume fails, a user may need to remove any lingering pre-existing/unused attachment records since we have no way to validate if the connector profile data differs from what was provided to cinder.
Parameters: |
|
---|---|
Raises: | StorageError If storage subsystem exception is raised. |
Returns: | List of connected volumes, including volumes that were already connected to desired nodes. The returned list can be relatively consistent depending on the end storage driver that the volume is configured for, however the ‘driver_volume_type’ key should not be relied upon as it is a free-form value returned by the driver. The accompanying ‘data’ key contains the actual target details which will indicate either target WWNs and a LUN or a target portal and IQN. It also always contains volume ID in cinder and ironic. Except for these two IDs, each driver may return somewhat different data although the same keys are used if the target is FC or iSCSI, so any logic should be based upon the returned contents. For already attached volumes, the structure contains ‘already_attached’: True key-value pair. In such case, connection info for the node is already in the database, ‘data’ structure contains only basic info of volume ID in cinder and ironic, so any logic based on that should retrieve it from the database. Example: [{
'driver_volume_type': 'fibre_channel'
'data': {
'encrypted': False,
'target_lun': 1,
'target_wwn': ['1234567890123', '1234567890124'],
'volume_id': '00000000-0000-0000-0000-000000000001',
'ironic_volume_id':
'11111111-0000-0000-0000-000000000001'}
},
{
'driver_volume_type': 'iscsi'
'data': {
'target_iqn': 'iqn.2010-10.org.openstack:volume-000002',
'target_portal': '127.0.0.0.1:3260',
'volume_id': '00000000-0000-0000-0000-000000000002',
'ironic_volume_id':
'11111111-0000-0000-0000-000000000002',
'target_lun': 2}
},
{
'already_attached': True
'data': {
'volume_id': '00000000-0000-0000-0000-000000000002',
'ironic_volume_id':
'11111111-0000-0000-0000-000000000002'}
}]
|
ironic.common.cinder.
detach_volumes
(task, volume_list, connector, allow_errors=False)[source]¶Detach a list of volumes from a provided connector detail.
Enumerates through a provided list of volumes and issues detachment requests utilizing the connector information that describes the node.
Parameters: |
|
---|---|
Raises: | StorageError |
ironic.common.cinder.
get_client
(context)[source]¶Get a cinder client connection.
Parameters: | context – request context, instance of ironic.common.context.RequestContext |
---|---|
Returns: | A cinder client. |
ironic.common.cinder.
is_volume_attached
(node, volume)[source]¶Check if a volume is attached to the supplied node.
Parameters: |
|
---|---|
Returns: | Boolean indicating if the volume is attached. Returns True if cinder shows the volume as presently attached, otherwise returns False. |
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.