diff --git a/doc/source/devref/huawei_nas_driver.rst b/doc/source/devref/huawei_nas_driver.rst index 124123396a..af016178b4 100644 --- a/doc/source/devref/huawei_nas_driver.rst +++ b/doc/source/devref/huawei_nas_driver.rst @@ -83,7 +83,6 @@ storage systems, the driver configuration file is as follows: xxxxxxxxx - xxxxxxxx 64 3 60 @@ -109,7 +108,6 @@ storage systems, the driver configuration file is as follows: - `UserName` is a user name of an administrator. - `UserPassword` is a password of an administrator. - `StoragePool` is a name of a storage pool to be used. -- `AllocType` is the file system space allocation type, optional value is "Thick" or "Thin". - `SectorSize` is the size of the disk blocks, optional value can be "4", "8", "16", "32" or "64", and the units is KB. If "sectorsize" is configured in both share_type and xml file, the value of sectorsize in the share_type will be used. If "sectorsize" is configured in neither diff --git a/manila/share/drivers/huawei/v3/smartx.py b/manila/share/drivers/huawei/v3/smartx.py index 691a7b12f8..794b3997b5 100644 --- a/manila/share/drivers/huawei/v3/smartx.py +++ b/manila/share/drivers/huawei/v3/smartx.py @@ -124,28 +124,11 @@ class SmartX(object): def get_smartprovisioning_opts(self, opts): thin_provision = opts.get('thin_provisioning') - if thin_provision is None: - root = self.helper._read_xml() - fstype = root.findtext('Filesystem/AllocType') - if fstype: - fstype = fstype.strip().strip('\n') - if fstype == 'Thin': - opts['LUNType'] = constants.ALLOC_TYPE_THIN_FLAG - elif fstype == 'Thick': - opts['LUNType'] = constants.ALLOC_TYPE_THICK_FLAG - else: - err_msg = (_( - 'Huawei config file is wrong. AllocType type must be ' - 'set to "Thin" or "Thick". AllocType:%(fetchtype)s') % - {'fetchtype': fstype}) - raise exception.InvalidShare(reason=err_msg) - else: - opts['LUNType'] = constants.ALLOC_TYPE_THICK_FLAG + if (thin_provision is None or + strutils.bool_from_string(thin_provision)): + opts['LUNType'] = constants.ALLOC_TYPE_THIN_FLAG else: - if strutils.bool_from_string(thin_provision): - opts['LUNType'] = constants.ALLOC_TYPE_THIN_FLAG - else: - opts['LUNType'] = constants.ALLOC_TYPE_THICK_FLAG + opts['LUNType'] = constants.ALLOC_TYPE_THICK_FLAG return opts diff --git a/manila/tests/share/drivers/huawei/test_huawei_nas.py b/manila/tests/share/drivers/huawei/test_huawei_nas.py index 713ac0c566..53d6632a27 100644 --- a/manila/tests/share/drivers/huawei/test_huawei_nas.py +++ b/manila/tests/share/drivers/huawei/test_huawei_nas.py @@ -1406,21 +1406,6 @@ class HuaweiShareDriverTestCase(test.TestCase): self.assertRaises(exception.InvalidInput, self.driver.get_backend_driver) - def test_create_share_alloctype_fail(self): - share_type = self.fake_type_not_extra['test_with_extra'] - self.mock_object(db, - 'share_type_get', - mock.Mock(return_value=share_type)) - self.recreate_fake_conf_file(alloctype_value='alloctype_fail') - self.driver.plugin.configuration.manila_huawei_conf_file = ( - self.fake_conf_file) - self.driver.plugin.helper.login() - self.assertRaises(exception.InvalidShare, - self.driver.create_share, - self._context, - self.share_nfs, - self.share_server) - def test_create_share_storagepool_not_exist(self): self.driver.plugin.helper.login() self.assertRaises(exception.InvalidHost, @@ -1488,54 +1473,17 @@ class HuaweiShareDriverTestCase(test.TestCase): self.assertRaises(exception.InvalidShare, self.driver.check_for_setup_error) - def test_create_share_alloctype_thin_success(self): + def test_create_share_no_extra(self): share_type = self.fake_type_not_extra['test_with_extra'] self.mock_object(db, 'share_type_get', mock.Mock(return_value=share_type)) - self.driver.plugin.helper.login() - self.recreate_fake_conf_file(alloctype_value='Thin') - self.driver.plugin.configuration.manila_huawei_conf_file = ( - self.fake_conf_file) - self.driver.plugin.helper.login() location = self.driver.create_share(self._context, self.share_nfs, self.share_server) self.assertEqual("100.115.10.68:/share_fake_uuid", location) self.assertEqual(constants.ALLOC_TYPE_THIN_FLAG, self.driver.plugin.helper.alloc_type) - def test_create_share_alloctype_thick_success(self): - share_type = self.fake_type_not_extra['test_with_extra'] - self.mock_object(db, - 'share_type_get', - mock.Mock(return_value=share_type)) - self.driver.plugin.helper.login() - self.recreate_fake_conf_file(alloctype_value='Thick') - self.driver.plugin.configuration.manila_huawei_conf_file = ( - self.fake_conf_file) - self.driver.plugin.helper.login() - location = self.driver.create_share(self._context, self.share_nfs, - self.share_server) - self.assertEqual("100.115.10.68:/share_fake_uuid", location) - self.assertEqual(constants.ALLOC_TYPE_THICK_FLAG, - self.driver.plugin.helper.alloc_type) - - def test_create_share_no_alloctype_no_extra(self): - share_type = self.fake_type_not_extra['test_with_extra'] - self.mock_object(db, - 'share_type_get', - mock.Mock(return_value=share_type)) - self.driver.plugin.helper.login() - self.recreate_fake_conf_file(alloctype_value=None) - self.driver.plugin.configuration.manila_huawei_conf_file = ( - self.fake_conf_file) - self.driver.plugin.helper.login() - location = self.driver.create_share(self._context, self.share_nfs, - self.share_server) - self.assertEqual("100.115.10.68:/share_fake_uuid", location) - self.assertEqual(constants.ALLOC_TYPE_THICK_FLAG, - self.driver.plugin.helper.alloc_type) - def test_create_share_with_extra_thin(self): share_type = { 'extra_specs': { @@ -1754,10 +1702,6 @@ class HuaweiShareDriverTestCase(test.TestCase): self.mock_object(db, 'share_type_get', mock.Mock(return_value=share_type)) - self.recreate_fake_conf_file(alloctype_value='Thin') - self.driver.plugin.configuration.manila_huawei_conf_file = ( - self.fake_conf_file) - self.driver.plugin.helper.login() location = self.driver.create_share(self._context, self.share_nfs, self.share_server) self.assertEqual("100.115.10.68:/share_fake_uuid", location) @@ -3905,7 +3849,6 @@ class HuaweiShareDriverTestCase(test.TestCase): product_flag=True, username_flag=True, pool_node_flag=True, timeout_flag=True, wait_interval_flag=True, - alloctype_value='Thick', sectorsize_value='4', multi_url=False, logical_port='100.115.10.68', @@ -4020,12 +3963,6 @@ class HuaweiShareDriverTestCase(test.TestCase): lun.appendChild(waitinterval) lun.appendChild(storagepool) - if alloctype_value: - alloctype = doc.createElement('AllocType') - alloctype_text = doc.createTextNode(alloctype_value) - alloctype.appendChild(alloctype_text) - lun.appendChild(alloctype) - if sectorsize_value: sectorsize = doc.createElement('SectorSize') sectorsize_text = doc.createTextNode(sectorsize_value) @@ -4044,7 +3981,6 @@ class HuaweiShareDriverTestCase(test.TestCase): def recreate_fake_conf_file(self, product_flag=True, username_flag=True, pool_node_flag=True, timeout_flag=True, wait_interval_flag=True, - alloctype_value='Thick', sectorsize_value='4', multi_url=False, logical_port='100.115.10.68', @@ -4056,7 +3992,7 @@ class HuaweiShareDriverTestCase(test.TestCase): self.create_fake_conf_file(self.fake_conf_file, product_flag, username_flag, pool_node_flag, timeout_flag, wait_interval_flag, - alloctype_value, sectorsize_value, + sectorsize_value, multi_url, logical_port, snapshot_support, replication_support) self.addCleanup(os.remove, self.fake_conf_file) diff --git a/releasenotes/notes/remove-AllocType-from-huawei-driver-8b279802f36efb00.yaml b/releasenotes/notes/remove-AllocType-from-huawei-driver-8b279802f36efb00.yaml new file mode 100644 index 0000000000..c11964c4fa --- /dev/null +++ b/releasenotes/notes/remove-AllocType-from-huawei-driver-8b279802f36efb00.yaml @@ -0,0 +1,8 @@ +--- +prelude: > + Manila scheduler checks "thin_provisioning" in extra specs of the share type + and decides whether to use the logic for thin or thick. If "thin_provisioning" + not given in extra specs, default use thin. +upgrade: + - Remove the "AllocType" configuration from huawei driver configuration file. + If "thin_provisioning" not given, default create new share by "thin" type.