From 053852f28959c798b4c032906c3b6292af5597b4 Mon Sep 17 00:00:00 2001 From: Mike Perez Date: Sun, 15 Mar 2015 19:59:43 -0700 Subject: [PATCH] Revert "Datera's export to avoid deprecated keys" The changes on the Datera solution have been reverted, so the driver is being updated as well. This reverts commit a754f317a708d9932aea743588468f0bb1cabdbb. Change-Id: I369abca84d224c71b0ea7c55d0ecda8db9a76759 --- cinder/tests/volume/drivers/datera.py | 56 ++++++++++++++++----------- cinder/volume/drivers/datera.py | 10 ++--- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/cinder/tests/volume/drivers/datera.py b/cinder/tests/volume/drivers/datera.py index 8071817ba..b3e47c865 100644 --- a/cinder/tests/volume/drivers/datera.py +++ b/cinder/tests/volume/drivers/datera.py @@ -121,7 +121,7 @@ class DateraVolumeTestCase(test.TestCase): ctxt = context.get_admin_context() expected = { 'provider_location': u'172.28.121.10:3260 iqn.2013-05.com.daterain' - 'c::01:sn:fc372bc0490b2dbe 1' + 'c::01:sn:fc372bc0490b2dbe 0' } self.assertEqual(expected, self.driver.ensure_export(ctxt, self.volume)) @@ -137,7 +137,7 @@ class DateraVolumeTestCase(test.TestCase): ctxt = context.get_admin_context() expected = { 'provider_location': u'172.28.121.10:3260 iqn.2013-05.com.daterain' - 'c::01:sn:fc372bc0490b2dbe 1' + 'c::01:sn:fc372bc0490b2dbe 0' } self.assertEqual(expected, self.driver.create_export(ctxt, self.volume)) @@ -259,24 +259,37 @@ class DateraVolumeTestCase(test.TestCase): self.assertEqual(1, self.mock_api.call_count) stub_export = { - '_ipColl': ['172.28.121.10'], - 'active_servers': {'44454c4c-4d00-1048-8031-b4c04f4d4e31': True}, - 'auth': { - 'atype': 'T_AUTH_NONE', - 'info': { - 'mpassword': '', - 'muserid': '', - 'password': '', - 'userid': '' + 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 + } + }, + 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 } }, - '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'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': { u'4594953e-f97f-e111-ad85-001e6738c0f0': { u'ids': [{ u'dev': None, @@ -284,11 +297,8 @@ stub_export = { }] } }, - '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} + u'typeName': u'TargetIscsiConfig', + u'uuid': u'7071efd7-9f22-4996-8f68-47e9ab19d0fd' } diff --git a/cinder/volume/drivers/datera.py b/cinder/volume/drivers/datera.py index 46fedd9fa..d8bbbfd5d 100644 --- a/cinder/volume/drivers/datera.py +++ b/cinder/volume/drivers/datera.py @@ -80,10 +80,9 @@ class DateraDriver(san.SanISCSIDriver): Version history: 1.0 - Initial driver - 1.1 - When doing an export, look for IQN in endpoint_idents. - 1.2 - Look for lun-0 instead of lun-1. + 1.1 - Look for lun-0 instead of lun-1. """ - VERSION = '1.2' + VERSION = '1.1' def __init__(self, *args, **kwargs): super(DateraDriver, self).__init__(*args, **kwargs) @@ -159,9 +158,10 @@ 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 take the first key, which is an IQN within endpoint_idents. + # like. We're just going to pull the first IP that the Datera cluster + # makes available for the portal. iscsi_portal = export['_ipColl'][0] + ':3260' - iqn = export['endpoint_idents'].iterkeys().next() + iqn = export['targetIds'].itervalues().next()['ids'][0]['id'] provider_location = '%s %s %s' % (iscsi_portal, iqn, 0) model_update = {'provider_location': provider_location} -- 2.45.2