Update Datera's export to avoid deprecated keys

The export call has been updated in Datera. The old location for the IQN
has moved. This updates the Kilo driver with support of looking in the
new location. The Juno driver will remain using the old location.

Closes-Bug: #1430024
Change-Id: I28a76ef849c2d3a0e4d08c5d0707e28d9617f534
This commit is contained in:
Mike Perez
2015-03-09 14:38:50 -07:00
parent 09225f7583
commit a754f317a7
2 changed files with 25 additions and 35 deletions

View File

@@ -259,37 +259,24 @@ class DateraVolumeTestCase(test.TestCase):
self.assertEqual(1, self.mock_api.call_count)
stub_export = {
u'_ipColl': [u'172.28.121.10', u'172.28.120.10'],
u'acls': {},
u'activeServers': {u'4594953e-f97f-e111-ad85-001e6738c0f0': u'1'},
u'ctype': u'TC_BLOCK_ISCSI',
u'endpointsExt1': {
u'4594953e-f97f-e111-ad85-001e6738c0f0': {
u'ipHigh': 0,
u'ipLow': u'192421036',
u'ipStr': u'172.28.120.11',
u'ipV': 4,
u'name': u'',
u'network': 24
'_ipColl': ['172.28.121.10'],
'active_servers': {'44454c4c-4d00-1048-8031-b4c04f4d4e31': True},
'auth': {
'atype': 'T_AUTH_NONE',
'info': {
'mpassword': '',
'muserid': '',
'password': '',
'userid': ''
}
},
u'endpointsExt2': {
u'4594953e-f97f-e111-ad85-001e6738c0f0': {
u'ipHigh': 0,
u'ipLow': u'192486572',
u'ipStr': u'172.28.121.11',
u'ipV': 4,
u'name': u'',
u'network': 24
}
},
u'inodes': {u'c20aba21-6ef6-446b-b374-45733b4883ba': u'1'},
u'name': u'',
u'networkPort': 0,
u'serverAllocation': u'TS_ALLOC_COMPLETED',
u'servers': {u'4594953e-f97f-e111-ad85-001e6738c0f0': u'1'},
u'targetAllocation': u'TS_ALLOC_COMPLETED',
u'targetIds': {
'endpoint_addrs': {'172.28.121.10': True},
'endpoint_idents': {
'iqn.2013-05.com.daterainc::01:sn:fc372bc0490b2dbe': True},
'name': 'OpenStack-a4e692e8-7f95-4f87-8fe6-cbcbab624012',
'server_allocation': 'TS_ALLOC_COMPLETED',
'servers': {'44454c4c-4d00-1048-8031-b4c04f4d4e31': True},
'targetIds': {
u'4594953e-f97f-e111-ad85-001e6738c0f0': {
u'ids': [{
u'dev': None,
@@ -297,8 +284,11 @@ stub_export = {
}]
}
},
u'typeName': u'TargetIscsiConfig',
u'uuid': u'7071efd7-9f22-4996-8f68-47e9ab19d0fd'
'target_allocation': 'TS_ALLOC_COMPLETED',
'target_ids': {'44454c4c-4d00-1048-8031-b4c04f4d4e31': True},
'type': 'iscsi',
'uuid': 'f11c2386-71d4-4352-a718-71c3e22f5888',
'volumes': {'a4e692e8-7f95-4f87-8fe6-cbcbab624012': True}
}

View File

@@ -80,8 +80,9 @@ class DateraDriver(san.SanISCSIDriver):
Version history:
1.0 - Initial driver
1.1 - When doing an export, look for IQN in endpoint_idents.
"""
VERSION = '1.0'
VERSION = '1.1'
def __init__(self, *args, **kwargs):
super(DateraDriver, self).__init__(*args, **kwargs)
@@ -157,10 +158,9 @@ class DateraDriver(san.SanISCSIDriver):
body={'ctype': 'TC_BLOCK_ISCSI'}, resource=volume['id'])
# NOTE(thingee): Refer to the Datera test for a stub of what this looks
# like. We're just going to pull the first IP that the Datera cluster
# makes available for the portal.
# like. We take the first key, which is an IQN within endpoint_idents.
iscsi_portal = export['_ipColl'][0] + ':3260'
iqn = export['targetIds'].itervalues().next()['ids'][0]['id']
iqn = export['endpoint_idents'].iterkeys().next()
provider_location = '%s %s %s' % (iscsi_portal, iqn, 1)
model_update = {'provider_location': provider_location}