]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Persist volume uuid on VMAX array
authorXing Yang <xing.yang@emc.com>
Wed, 17 Dec 2014 04:58:36 +0000 (23:58 -0500)
committerXing Yang <xing.yang@emc.com>
Fri, 19 Dec 2014 22:20:00 +0000 (17:20 -0500)
This change saves the volume uuid in the ElementName field of
a SMI-S volume object so that it persists on the array.

Closes-Bug: #1395903
Change-Id: I53945f2864e6cfab756afdaeb17d45dfdac38c02

cinder/tests/test_emc_vmax.py
cinder/volume/drivers/emc/emc_vmax_common.py
cinder/volume/drivers/emc/emc_vmax_provision.py

index abd7aa7af4897f843445bad5e745ecb2f3b7646c..dce90919a51147bf068954bd196cbfb780a46e4e 100644 (file)
@@ -20,6 +20,7 @@ import time
 from xml.dom.minidom import Document
 
 import mock
+import six
 
 from cinder import exception
 from cinder.openstack.common import log as logging
@@ -214,19 +215,35 @@ class EMCVMAXCommonData():
                    'size': 1,
                    'volume_name': 'vol1',
                    'id': '1',
+                   'device_id': '1',
                    'provider_auth': None,
                    'project_id': 'project',
                    'display_name': 'vol1',
                    'display_description': 'test volume',
                    'volume_type_id': 'abc',
-                   'provider_location': str(provider_location),
+                   'provider_location': six.text_type(provider_location),
                    'status': 'available',
                    'host': 'fake-host'
                    }
+    test_volume_v2 = {'name': 'vol1',
+                      'size': 1,
+                      'volume_name': 'vol1',
+                      'id': 'vol1',
+                      'device_id': '1',
+                      'provider_auth': None,
+                      'project_id': 'project',
+                      'display_name': 'vol1',
+                      'display_description': 'test volume',
+                      'volume_type_id': 'abc',
+                      'provider_location': six.text_type(provider_location),
+                      'status': 'available',
+                      'host': 'fake-host'
+                      }
     test_failed_volume = {'name': 'failed_vol',
                           'size': 1,
                           'volume_name': 'failed_vol',
                           'id': '4',
+                          'device_id': '4',
                           'provider_auth': None,
                           'project_id': 'project',
                           'display_name': 'failed_vol',
@@ -237,22 +254,26 @@ class EMCVMAXCommonData():
                          'size': '-1',
                          'volume_name': 'failed_delete_vol',
                          'id': '99999',
+                         'device_id': '99999',
                          'provider_auth': None,
                          'project_id': 'project',
                          'display_name': 'failed delete vol',
                          'display_description': 'failed delete volume',
                          'volume_type_id': 'abc',
-                         'provider_location': str(provider_location2)}
+                         'provider_location': six.text_type(provider_location2)
+                         }
 
     test_source_volume = {'size': 1,
                           'volume_type_id': 'sourceid',
                           'display_name': 'sourceVolume',
                           'name': 'sourceVolume',
                           'volume_name': 'vmax-154326',
+                          'id': 'vmax-154326',
                           'provider_auth': None,
                           'project_id':
                           'project', 'id': '2',
-                          'provider_location': str(provider_location),
+                          'provider_location':
+                              six.text_type(provider_location),
                           'display_description': 'snapshot source volume'}
 
     location_info = {'location_info': '000195900551#silver#None',
@@ -548,10 +569,12 @@ class FakeEcomConnection():
             vol = self.data.test_volume
         elif objectpath['type'] == 'failed_vol':
             vol = self.data.test_failed_volume
+        elif objectpath['type'] == 'TargetBaseVol':
+            vol = self.data.test_failed_volume
         else:
             return None
 
-        vol['DeviceID'] = vol['id']
+        vol['DeviceID'] = vol['device_id']
         assoc = self._getinstance_storagevolume(vol)
         assocs.append(assoc)
         return assocs
@@ -1190,7 +1213,7 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase):
         return_value=(None, EMCVMAXCommonData.storage_system))
     def test_create_volume_no_fast_success(
             self, _mock_volume_type, mock_storage_system):
-        self.driver.create_volume(self.data.test_volume)
+        self.driver.create_volume(self.data.test_volume_v2)
 
     @mock.patch.object(
         volume_types,
@@ -1203,7 +1226,7 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase):
         return_value=(None, EMCVMAXCommonData.storage_system))
     def test_create_volume_no_fast_striped_success(
             self, _mock_volume_type, mock_storage_system):
-        self.driver.create_volume(self.data.test_volume)
+        self.driver.create_volume(self.data.test_volume_v2)
 
     @mock.patch.object(
         volume_types,
@@ -1639,7 +1662,7 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase):
         return_value=1)
     def test_create_volume_fast_success(
             self, _mock_volume_type, mock_storage_system, mock_pool_policy):
-        self.driver.create_volume(self.data.test_volume)
+        self.driver.create_volume(self.data.test_volume_v2)
 
     @mock.patch.object(
         volume_types,
@@ -1656,7 +1679,7 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase):
         return_value=1)
     def test_create_volume_fast_striped_success(
             self, _mock_volume_type, mock_storage_system, mock_pool_policy):
-        self.driver.create_volume(self.data.test_volume)
+        self.driver.create_volume(self.data.test_volume_v2)
 
     @mock.patch.object(
         volume_types,
@@ -2150,7 +2173,7 @@ class EMCVMAXFCDriverNoFastTestCase(test.TestCase):
         return_value=(None, EMCVMAXCommonData.storage_system))
     def test_create_volume_no_fast_success(
             self, _mock_volume_type, mock_storage_system):
-        self.driver.create_volume(self.data.test_volume)
+        self.driver.create_volume(self.data.test_volume_v2)
 
     @mock.patch.object(
         volume_types,
@@ -2163,7 +2186,7 @@ class EMCVMAXFCDriverNoFastTestCase(test.TestCase):
         return_value=(None, EMCVMAXCommonData.storage_system))
     def test_create_volume_no_fast_striped_success(
             self, _mock_volume_type, mock_storage_system):
-        self.driver.create_volume(self.data.test_volume)
+        self.driver.create_volume(self.data.test_volume_v2)
 
     @mock.patch.object(
         volume_types,
@@ -2494,7 +2517,7 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase):
         return_value=1)
     def test_create_volume_fast_success(
             self, _mock_volume_type, mock_storage_system, mock_pool_policy):
-        self.driver.create_volume(self.data.test_volume)
+        self.driver.create_volume(self.data.test_volume_v2)
 
     @mock.patch.object(
         volume_types,
@@ -2511,7 +2534,7 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase):
         return_value=1)
     def test_create_volume_fast_striped_success(
             self, _mock_volume_type, mock_storage_system, mock_pool_policy):
-        self.driver.create_volume(self.data.test_volume)
+        self.driver.create_volume(self.data.test_volume_v2)
 
     @mock.patch.object(
         volume_types,
index 101894ee517c808774d52554e9a963f426ea8e07..b7cfefd4cd65d39bc8e71b5281c7d9a36bdc7916 100644 (file)
@@ -113,7 +113,7 @@ class EMCVMAXCommon(object):
         :raises: VolumeBackendAPIException
         """
         volumeSize = int(self.utils.convert_gb_to_bits(volume['size']))
-        volumeName = volume['name']
+        volumeName = volume['id']
 
         extraSpecs = self._initial_setup(volume)
         self.conn = self._get_ecom_connection()
index f305669f87cd69619faa90d09e83334ee2550662..486abe98f15277d75707a2bda0dddf48de43bab7 100644 (file)
@@ -368,6 +368,7 @@ class EMCVMAXProvision(object):
 
         rc, job = conn.InvokeMethod(
             'CreateOrModifyCompositeElement', elementCompositionService,
+            ElementName=volumeName,
             ElementType=self.utils.get_num(THINPROVISIONINGCOMPOSITE, '16'),
             Size=self.utils.get_num(volumeSize, '64'),
             ElementSource=self.utils.get_num(newMembers, '16'),