self.assertTrue(mock_find_domains.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
- expected = {'access_mode': 'rw',
- 'target_discovered': False,
+ expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
self.assertTrue(mock_find_domains.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
- expected = {'access_mode': 'rw',
- 'target_discovered': False,
+ expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
self.assertTrue(mock_find_domains.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_ctrl.called)
- expected = {'access_mode': 'rw',
- 'target_discovered': False,
+ expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
self.assertTrue(mock_find_domains.called)
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
- expected = {'access_mode': 'ro',
- 'target_discovered': False,
+ expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
self.assertTrue(mock_is_virtualport_mode.called)
- expected = {'access_mode': 'rw',
- 'target_discovered': False,
+ expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_controller_port_iscsi_config.called)
self.assertTrue(mock_find_active_controller.called)
- expected = {'access_mode': 'rw',
- 'target_discovered': False,
+ expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
self.assertTrue(mock_find_controller_port_iscsi_config.called)
- expected = {'access_mode': 'rw',
- 'target_discovered': False,
+ expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_ctrl.called)
self.assertTrue(mock_find_controller_port_iscsi_config.called)
- expected = {'access_mode': 'rw',
- 'target_discovered': False,
+ expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
self.assertTrue(mock_find_ctrl_port.called)
self.assertTrue(mock_find_active_controller.called)
self.assertTrue(mock_find_iscsi_config.called)
- expected = {'access_mode': 'ro',
- 'target_discovered': False,
+ expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
self.assertTrue(mock_find_controller_port_iscsi_config.called)
# Since we're feeding the same info back multiple times the information
# will be duped.
- expected = {'access_mode': 'rw',
- 'target_discovered': False,
+ expected = {'target_discovered': False,
'target_iqn':
u'iqn.2002-03.com.compellent:5000d31000fcbe43',
'target_iqns':
'target_discovered': True,
'target_lun': fake_lun_map[0],
'target_wwn': fake_target_wwpns[0:2],
- 'access_mode': 'rw',
'initiator_target_map': test_initiator_target_map,
},
}
'target_discovered': True,
'target_lun': fake_lun_map[0],
'target_wwn': [fake_target_wwpns[1]],
- 'access_mode': 'rw',
'initiator_target_map': test_initiator_target_map_specific_channel,
},
}
'target_discovered': True,
'target_lun': fake_lun_map[0],
'target_wwn': test_target_wwpns_map_multipath_r_model[:],
- 'access_mode': 'rw',
'initiator_target_map':
test_initiator_target_map_multipath_r_model,
},
'target_discovered': True,
'target_lun': fake_lun_map[0],
'target_wwn': [x.lower() for x in fake_target_wwpns[0:2]],
- 'access_mode': 'rw',
'initiator_target_map': test_initiator_target_map_zoning,
},
}
'target_discovered': True,
'target_lun': fake_lun_map[0],
'target_wwn': [x.lower() for x in fake_target_wwpns[1:3]],
- 'access_mode': 'rw',
'initiator_target_map': test_initiator_target_map_zoning_r_model,
},
}
"driver_volume_type": "iscsi",
"data": {
"target_discovered": False,
- "access_mode": "rw",
"discard": True,
"target_luns": [1, 1, 1, 1],
"target_iqns": [TARGET_IQN, TARGET_IQN, TARGET_IQN, TARGET_IQN],
"target_wwn": FC_WWNS,
"target_lun": 1,
"target_discovered": True,
- "access_mode": "rw",
"initiator_target_map": INITIATOR_TARGET_MAP,
"discard": True,
},
'_api_executor',
fake_tegile_backend):
self.assertEqual(
- {'data': {'access_mode': 'rw',
- 'auth_method': 'CHAP',
+ {'data': {'auth_method': 'CHAP',
'discard': False,
'target_discovered': (False,),
'auth_password': 'test',
with mock.patch.object(tegile_driver,
'_api_executor',
fake_tegile_backend):
- self.assertEqual({'data': {'access_mode': 'rw',
- 'encrypted': False,
+ self.assertEqual({'data': {'encrypted': False,
'initiator_target_map': {
'21000024ff59bb6e':
['21000024ff578701'],
exp_result = {"driver_volume_type": "iscsi",
"data": {"target_lun": '1',
"volume_id": '1',
- "access_mode": 'rw',
"target_discovered": False,
"target_iqn": ISE_IQN,
"target_portal": ISE_ISCSI_IP1 + ":3260"}}
exp_result = {"driver_volume_type": "fibre_channel",
"data": {"target_lun": '1',
"volume_id": '1',
- "access_mode": 'rw',
"target_discovered": True,
"initiator_target_map": ISE_INIT_TARGET_MAP,
"target_wwn": ISE_TARGETS}}
exp_result = {"driver_volume_type": "iscsi",
"data": {"target_lun": '1',
"volume_id": '1',
- "access_mode": 'rw',
"target_discovered": False,
"target_iqn": ISE_IQN,
"target_portal": ISE_ISCSI_IP1 + ":3260"}}
exp_result = {"driver_volume_type": "fibre_channel",
"data": {"target_lun": '1',
"volume_id": '1',
- "access_mode": 'rw',
"target_discovered": True,
"initiator_target_map": ISE_INIT_TARGET_MAP,
"target_wwn": ISE_TARGETS}}
exp_result = {"driver_volume_type": "iscsi",
"data": {"target_lun": '1',
"volume_id": '2',
- "access_mode": 'rw',
"target_discovered": False,
"target_iqn": ISE_IQN,
"target_portal": ISE_ISCSI_IP1 + ":3260",
exp_result = {"driver_volume_type": "fibre_channel",
"data": {"target_lun": '1',
"volume_id": '2',
- "access_mode": 'rw',
"target_discovered": True,
"initiator_target_map": ISE_INIT_TARGET_MAP,
"target_wwn": ISE_TARGETS}}
present meaning no authentication, or auth_method == `CHAP`
meaning use CHAP with the specified credentials.
- :access_mode: the volume access mode allow client used
- ('rw' or 'ro' currently supported)
-
:discard: boolean indicating if discard is supported
In some of drivers that support multiple connections (for multipath
'target_iqn': 'iqn.2010-10.org.openstack:volume-00000001',
'target_portal': '127.0.0.0.1:3260',
'volume_id': 1,
- 'access_mode': 'rw',
'discard': False,
}
}
'target_lun': 1,
'target_luns': [1, 1],
'volume_id': 1,
- 'access_mode': 'rw',
'discard': False,
}
}
def initialize_connection(self, volume, connector):
return {
'driver_volume_type': 'iscsi',
- 'data': {'access_mode': 'rw'},
'discard': False,
}
def initialize_connection_snapshot(self, snapshot, connector):
return {
'driver_volume_type': 'iscsi',
- 'data': {'access_mode': 'rw'}
}
def terminate_connection(self, volume, connector, **kwargs):
'target_discovered': True,
'target_lun': 1,
'target_wwn': '1234567890123',
- 'access_mode': 'rw',
'discard': False,
}
}
'target_discovered': True,
'target_lun': 1,
'target_wwn': ['1234567890123', '0987654321321'],
- 'access_mode': 'rw',
'discard': False,
}
}
# Our mutable process object.
pdata = {'active': -1,
'up': -1,
- 'access_mode': 'rw',
'ip': ip,
'port': port}
# Our output lists.
iqns = []
# Process just looks for the best port to return.
- def process(lun, iqn, address, port, readonly, status, active):
+ def process(lun, iqn, address, port, status, active):
"""Process this mapping information.
:param lun: SCSI Lun.
# but we don't actually need the state to be
# up at this point.
if pdata['up'] == -1:
- pdata['access_mode'] = 'rw' if readonly is False else 'ro'
if active:
pdata['active'] = len(iqns) - 1
if status == 'Up':
# The lun, ro mode and status are in the mapping.
LOG.debug('mapping: %s', mapping)
lun = mapping.get('lun')
- ro = mapping.get('readOnly', False)
status = mapping.get('status')
# Get our IQN from our mapping.
iqn = self._get_iqn(mapping)
portnumber = dom.get('portNumber')
# We have all our information. Process this portal.
process(lun, iqn, ipaddress, portnumber,
- ro, status, isactive)
+ status, isactive)
# Else we are in legacy mode.
elif iqn:
# Need to get individual ports
portnumber = cpconfig.get('portNumber')
# We have all our information. Process this portal.
process(lun, iqn, ipaddress, portnumber,
- ro, status, isactive)
+ status, isactive)
# We've gone through all our mappings.
# Make sure we found something to return.
'target_portals': portals,
'target_lun': luns[pdata['active']],
'target_luns': luns,
- 'access_mode': pdata['access_mode']
}
LOG.debug('find_iscsi_properties return: %s',
data)
# 'target_portals': all portals,
# 'target_lun': preferred lun,
# 'target_luns': all luns,
- # 'access_mode': access_mode
# }
# We use id to name the volume name as it is a
'target_discovered': True,
'target_lun': 1,
'target_wwn': '1234567890123',
- 'access_mode': 'rw'
'initiator_target_map': {
'1122334455667788': ['1234567890123']
}
'target_discovered': True,
'target_lun': 1,
'target_wwn': ['1234567890123', '0987654321321'],
- 'access_mode': 'rw'
'initiator_target_map': {
'1122334455667788': ['1234567890123',
'0987654321321']
'target_iqn': 'iqn.2010-10.org.openstack:volume-00000001',
'target_portal': '127.0.0.0.1:3260',
'target_lun': 1,
- 'access_mode': 'rw'
}
}
'iqn.2010-10.org.openstack:volume-00002'],
'target_portals': ['127.0.0.1:3260', '127.0.1.1:3260'],
'target_luns': [1, 1],
- 'access_mode': 'rw'
}
}
the authentication details. Right now, either auth_method is not
present meaning no authentication, or auth_method == `CHAP`
meaning use CHAP with the specified credentials.
- :access_mode: the volume access mode allow client used
- ('rw' or 'ro' currently supported)
multiple connection return
:target_iqns, :target_portals, :target_luns, which contain lists of
multiple values. The main portal information is also returned in
'target_discovered': True,
'target_lun': int(lun_id),
'target_wwn': target_wwpns,
- 'access_mode': 'rw',
'initiator_target_map': initiator_target_map,
},
}
'target_discovered': True,
'target_lun': 1,
'target_wwn': '1234567890123',
- 'access_mode': 'rw'
'initiator_target_map': {
'1122334455667788': ['1234567890123']
}
'target_discovered': True,
'target_lun': 1,
'target_wwn': ['1234567890123', '0987654321321'],
- 'access_mode': 'rw'
'initiator_target_map': {
'1122334455667788': ['1234567890123',
'0987654321321']
'target_iqn': 'iqn.2010-10.org.openstack:volume-00000001',
'target_portal': '127.0.0.0.1:3260',
'volume_id': 1,
- 'access_mode': 'rw'
}
}
"""
properties['target_portal'] = ''
properties['target_iqn'] = None
properties['volume_id'] = volume['id']
- properties['access_mode'] = 'rw'
dpl_server = self.configuration.san_ip
dpl_iscsi_port = self.configuration.iscsi_port
"driver_volume_type": "iscsi",
"data": {
"target_discovered": False,
- "access_mode": "rw",
"discard": True,
},
}
'target_discovered': True,
"target_lun": connection["lun"],
"target_wwn": target_wwns,
- 'access_mode': 'rw',
'initiator_target_map': init_targ_map,
"discard": True,
}
connection_data['target_lun'] = target_lun
connection_data['target_discovered'] = False,
connection_data['volume_id'] = volume['id'],
- connection_data['access_mode'] = 'rw'
connection_data['discard'] = False
if getattr(self.configuration, 'use_chap_auth', False):
connection_data['auth_method'] = 'CHAP'
'data': {
'encrypted': False,
'target_discovered': False,
- 'access_mode': 'rw',
'target_lun': target_info['target_lun'],
'target_wwn': ast.literal_eval(target_info['target_wwn']),
'initiator_target_map': ast.literal_eval(initiator_target_map)
properties['target_discovered'] = True
properties['target_wwn'] = target_wwns
properties['target_lun'] = lun_id
- properties['access_mode'] = 'rw'
properties['initiator_target_map'] = init_targ_map
LOG.debug("Return FC data for zone addition: %(properties)s.",
data = {}
data['target_lun'] = target_lun
data['volume_id'] = volume['id']
- data['access_mode'] = 'rw'
return data
def ise_unpresent(self, volume, endpoints):
# Add access_mode to connection info
volume_metadata = self.db.volume_admin_metadata_get(context.elevated(),
volume_id)
- if conn_info['data'].get('access_mode') is None:
- access_mode = volume_metadata.get('attached_mode')
- if access_mode is None:
- # NOTE(zhiyan): client didn't call 'os-attach' before
- access_mode = ('ro'
- if volume_metadata.get('readonly') == 'True'
- else 'rw')
- conn_info['data']['access_mode'] = access_mode
+ access_mode = volume_metadata.get('attached_mode')
+ if access_mode is None:
+ # NOTE(zhiyan): client didn't call 'os-attach' before
+ access_mode = ('ro'
+ if volume_metadata.get('readonly') == 'True'
+ else 'rw')
+ conn_info['data']['access_mode'] = access_mode
# Add encrypted flag to connection_info if not set in the driver.
if conn_info['data'].get('encrypted') is None:
present meaning no authentication, or auth_method == `CHAP`
meaning use CHAP with the specified credentials.
- :access_mode: the volume access mode allow client used
- ('rw' or 'ro' currently supported)
-
:discard: boolean indicating if discard is supported
In some of drivers that support multiple connections (for multipath
'target_iqn': 'iqn.2010-10.org.openstack:volume-00000001',
'target_portal': '127.0.0.0.1:3260',
'volume_id': '9a0d35d0-175a-11e4-8c21-0800200c9a66',
- 'access_mode': 'rw',
'discard': False,
}
}