]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix solidfire accept_transfer
authorZhiteng Huang <zhithuang@ebaysf.com>
Fri, 1 Aug 2014 17:50:47 +0000 (01:50 +0800)
committerZhiteng Huang <zhithuang@ebaysf.com>
Fri, 1 Aug 2014 17:57:58 +0000 (01:57 +0800)
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

cinder/tests/test_solidfire.py
cinder/volume/drivers/solidfire.py

index 189e04b03f03c3a95178fa6f85ab0677d0e3150d..ec5126310ea015ced5c767ea400d996da82b6da3 100644 (file)
@@ -481,6 +481,21 @@ class SolidFireVolumeTestCase(test.TestCase):
                                'maxIOPS': 200,
                                '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):
         sfv = SolidFireDriver(configuration=self.configuration)
         self.stubs.Set(SolidFireDriver, '_issue_api_request',
@@ -500,7 +515,6 @@ class SolidFireVolumeTestCase(test.TestCase):
                    'id': 'a720b3c0-d1f0-11e1-9b23-0800200c9a66',
                    'created_at': timeutils.utcnow()}
 
-        sfv = SolidFireDriver(configuration=self.configuration)
         self.assertTrue(sfv.retype(self.ctxt,
                                    testvol,
                                    type_ref, diff, host))
@@ -520,8 +534,6 @@ class SolidFireVolumeTestCase(test.TestCase):
                                    'maxIOPS': '2000',
                                    'burstIOPS': '3000'}}
 
-        qos_specs
-
         def _fake_get_volume_type(ctxt, type_id):
             return test_type
 
index 64c16e29ec62065299b7dcb8203cd6c707d8fa50..ed21ddf882ffcb3ae4cf82218fca7bbc0137e954 100644 (file)
@@ -770,8 +770,8 @@ class SolidFireDriver(SanISCSIDriver):
         if 'result' not in data:
             raise exception.SolidFireAPIDataException(data=data)
 
-        volume['project_id': new_project]
-        volume['user_id': new_user]
+        volume['project_id'] = new_project
+        volume['user_id'] = new_user
         model_update = self._do_export(volume)
         LOG.debug("Leaving SolidFire transfer volume")
         return model_update