]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Huawei: Creating hypermetro failed in the remote pool
authorliuke2 <liuke2@huawei.com>
Sat, 20 Feb 2016 09:02:50 +0000 (17:02 +0800)
committerliuke2 <liuke2@huawei.com>
Sat, 12 Mar 2016 09:36:41 +0000 (17:36 +0800)
Create the hypermetro failed when use the remote pools on the
huawei driver, the log print get pool id fail. The 'pool_id'
is not exist in the LUN property dictionary, so the 'pool_id'
should be modified to 'PARENTID' to save the remote pool id.

Closes-Bug:#1547798
Change-Id:Ic99531dad4fab5e22e295e19bbfa94c789247d93

cinder/tests/unit/test_huawei_drivers.py
cinder/volume/drivers/huawei/hypermetro.py

index 2fa6cb5e3f9d229e72cafa1add52c7199c38625d..68e428efe75fe18c697e3f2702eb294df08a7731 100644 (file)
@@ -2280,6 +2280,35 @@ class HuaweiISCSIDriverTestCase(test.TestCase):
                           self.driver.metro.create_hypermetro,
                           '2', param)
 
+    @mock.patch.object(rest_client.RestClient, 'get_all_pools',
+                       return_value=FAKE_STORAGE_POOL_RESPONSE)
+    @mock.patch.object(rest_client.RestClient, 'get_pool_info',
+                       return_value=FAKE_FIND_POOL_RESPONSE)
+    @mock.patch.object(rest_client.RestClient, 'create_lun',
+                       return_value={'CAPACITY': '2097152',
+                                     'DESCRIPTION': '2f0635',
+                                     'HEALTHSTATUS': '1',
+                                     'ALLOCTYPE': '1',
+                                     'WWN': '6643e8c1004c5f6723e9f454003',
+                                     'ID': '1',
+                                     'RUNNINGSTATUS': '27',
+                                     'NAME': '5mFHcBv4RkCcD'})
+    @mock.patch.object(rest_client.RestClient, 'get_hyper_domain_id',
+                       return_value='11')
+    @mock.patch.object(hypermetro.HuaweiHyperMetro, '_wait_volume_ready',
+                       return_value=True)
+    def test_create_hypermetro_remote_pool_parentid(self,
+                                                    mock_volume_ready,
+                                                    mock_hyper_domain,
+                                                    mock_create_lun,
+                                                    mock_pool_info,
+                                                    mock_all_pool_info):
+        param = {'TYPE': '11',
+                 'PARENTID': ''}
+        self.driver.metro.create_hypermetro('2', param)
+        lun_PARENTID = mock_create_lun.call_args[0][0]['PARENTID']
+        self.assertEqual(FAKE_FIND_POOL_RESPONSE['ID'], lun_PARENTID)
+
     @mock.patch.object(rest_client.RestClient, 'check_lun_exist',
                        return_value=True)
     @mock.patch.object(rest_client.RestClient, 'check_hypermetro_exist',
index 1109822b9c69dc85822a2e79d50abad2f9e0de20..d752fa6f75533a737e0a0c8e51affd7820f8aa99 100644 (file)
@@ -45,7 +45,7 @@ class HuaweiHyperMetro(object):
                 raise exception.VolumeBackendAPIException(data=err_msg)
 
             # Create remote lun.
-            lun_params['pool_id'] = pool['ID']
+            lun_params['PARENTID'] = pool['ID']
             remotelun_info = self.rmt_client.create_lun(lun_params)
             remote_lun_id = remotelun_info['ID']