]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
rbd: add volume_id to connection_info in initialize_connection
authorMatt Riedemann <mriedem@us.ibm.com>
Sat, 20 Jun 2015 19:43:34 +0000 (12:43 -0700)
committerMatt Riedemann <mriedem@us.ibm.com>
Sat, 20 Jun 2015 19:43:34 +0000 (12:43 -0700)
Most other volume drivers have a 'volume_id' key in the
connection_info['data'] dict returned from initialize_connection, this
adds it to the rbd volume driver.

This is part of a bigger effort to standardize the connection_info dict
so that consumers like Nova can rely on a common set of keys when
processing connection_info.

Change-Id: I7aed56a93c4cc3be5e0e49da6ddc1f009fed3c18

cinder/tests/unit/test_rbd.py
cinder/volume/drivers/rbd.py

index b56758fa77e16f0b0353b8c932c705bc7cec61fe..16614b5f4f6c2937a876b5a74687631f5c8d0f15 100644 (file)
@@ -730,6 +730,7 @@ class RBDTestCase(test.TestCase):
                 mock_get_mon_addrs:
             mock_get_mon_addrs.return_value = (hosts, ports)
 
+            volume_id = '0a83f0a3-ef6e-47b6-a8aa-20436bc9ed01'
             expected = {
                 'driver_volume_type': 'rbd',
                 'data': {
@@ -740,9 +741,11 @@ class RBDTestCase(test.TestCase):
                     'auth_enabled': False,
                     'auth_username': None,
                     'secret_type': 'ceph',
-                    'secret_uuid': None, }
+                    'secret_uuid': None,
+                    'volume_id': volume_id
+                }
             }
-            volume = dict(name=self.volume_name)
+            volume = dict(name=self.volume_name, id=volume_id)
             actual = self.driver.initialize_connection(volume, None)
             self.assertDictMatch(expected, actual)
             self.assertTrue(mock_get_mon_addrs.called)
index 346888f8e9603a96724fc40ff7aa2ede548a4677..ed665751b09956e907be8047dcf75ecc599edd37 100644 (file)
@@ -791,7 +791,9 @@ class RBDDriver(driver.RetypeVD, driver.TransferVD, driver.ExtendVD,
                 'auth_enabled': (self.configuration.rbd_user is not None),
                 'auth_username': self.configuration.rbd_user,
                 'secret_type': 'ceph',
-                'secret_uuid': self.configuration.rbd_secret_uuid, }
+                'secret_uuid': self.configuration.rbd_secret_uuid,
+                'volume_id': volume['id'],
+            }
         }
         LOG.debug('connection data: %s', data)
         return data