Fix solidfire accept_transfer

Previous fix has a mistake which makes the situation worse.  This change
fix volume['project_id'] and volume['user_id'] and adds unit test for
accept_transfer.

Closes-bug: # 1349475

Change-Id: I7b2bcefa4c8d173689cc63ee5aa9e00397c7f8ca
This commit is contained in:
Zhiteng Huang 2014-08-02 01:50:47 +08:00
parent d189ce467e
commit 5dbdb11e8d
2 changed files with 17 additions and 5 deletions

View File

@ -481,6 +481,21 @@ class SolidFireVolumeTestCase(test.TestCase):
'maxIOPS': 200, 'maxIOPS': 200,
'burstIOPS': 300}) 'burstIOPS': 300})
def test_accept_transfer(self):
sfv = SolidFireDriver(configuration=self.configuration)
self.stubs.Set(SolidFireDriver, '_issue_api_request',
self.fake_issue_api_request)
testvol = {'project_id': 'testprjid',
'name': 'test_volume',
'size': 1,
'id': 'a720b3c0-d1f0-11e1-9b23-0800200c9a66',
'created_at': timeutils.utcnow()}
expected = {'provider_auth': 'CHAP cinder-new_project 123456789012'}
self.assertEqual(sfv.accept_transfer(self.ctxt,
testvol,
'new_user', 'new_project'),
expected)
def test_retype(self): def test_retype(self):
sfv = SolidFireDriver(configuration=self.configuration) sfv = SolidFireDriver(configuration=self.configuration)
self.stubs.Set(SolidFireDriver, '_issue_api_request', self.stubs.Set(SolidFireDriver, '_issue_api_request',
@ -500,7 +515,6 @@ class SolidFireVolumeTestCase(test.TestCase):
'id': 'a720b3c0-d1f0-11e1-9b23-0800200c9a66', 'id': 'a720b3c0-d1f0-11e1-9b23-0800200c9a66',
'created_at': timeutils.utcnow()} 'created_at': timeutils.utcnow()}
sfv = SolidFireDriver(configuration=self.configuration)
self.assertTrue(sfv.retype(self.ctxt, self.assertTrue(sfv.retype(self.ctxt,
testvol, testvol,
type_ref, diff, host)) type_ref, diff, host))
@ -520,8 +534,6 @@ class SolidFireVolumeTestCase(test.TestCase):
'maxIOPS': '2000', 'maxIOPS': '2000',
'burstIOPS': '3000'}} 'burstIOPS': '3000'}}
qos_specs
def _fake_get_volume_type(ctxt, type_id): def _fake_get_volume_type(ctxt, type_id):
return test_type return test_type

View File

@ -770,8 +770,8 @@ class SolidFireDriver(SanISCSIDriver):
if 'result' not in data: if 'result' not in data:
raise exception.SolidFireAPIDataException(data=data) raise exception.SolidFireAPIDataException(data=data)
volume['project_id': new_project] volume['project_id'] = new_project
volume['user_id': new_user] volume['user_id'] = new_user
model_update = self._do_export(volume) model_update = self._do_export(volume)
LOG.debug("Leaving SolidFire transfer volume") LOG.debug("Leaving SolidFire transfer volume")
return model_update return model_update