From 6e74dbd4c3c4d6a5d6d77998e48b690d23209366 Mon Sep 17 00:00:00 2001 From: zengyingzhe Date: Tue, 28 Mar 2017 17:23:31 +0800 Subject: [PATCH] Remove mirror policy parameter from Huawei driver Mirror policy parameter is not supposed to be exposed to users. This patch removes it. Change-Id: Ifaccbd8ba2939da446144d26299d62c71d2f0249 Closes-Bug: #1676796 --- cinder/volume/drivers/huawei/huawei_conf.py | 6 ------ cinder/volume/drivers/huawei/huawei_driver.py | 2 -- cinder/volume/drivers/huawei/replication.py | 1 - cinder/volume/drivers/huawei/rest_client.py | 2 ++ ...olicy-parameter-from-huawei-driver-d32257a60d32fd90.yaml | 4 ++++ 5 files changed, 6 insertions(+), 9 deletions(-) create mode 100644 releasenotes/notes/remove-mirrorpolicy-parameter-from-huawei-driver-d32257a60d32fd90.yaml diff --git a/cinder/volume/drivers/huawei/huawei_conf.py b/cinder/volume/drivers/huawei/huawei_conf.py index 01d5d337f7e..c89a63f9420 100644 --- a/cinder/volume/drivers/huawei/huawei_conf.py +++ b/cinder/volume/drivers/huawei/huawei_conf.py @@ -73,7 +73,6 @@ class HuaweiConf(object): self._lun_copy_wait_interval, self._lun_timeout, self._lun_write_type, - self._lun_mirror_switch, self._lun_prefetch, self._lun_policy, self._lun_read_cache_policy, @@ -175,11 +174,6 @@ class HuaweiConf(object): write_type = text.strip() if text else '1' setattr(self.conf, 'lun_write_type', write_type) - def _lun_mirror_switch(self, xml_root): - text = xml_root.findtext('LUN/MirrorSwitch') - mirror_switch = text.strip() if text else '1' - setattr(self.conf, 'lun_mirror_switch', mirror_switch) - def _lun_prefetch(self, xml_root): prefetch_type = '3' prefetch_value = '0' diff --git a/cinder/volume/drivers/huawei/huawei_driver.py b/cinder/volume/drivers/huawei/huawei_driver.py index f1f43fa6f91..8bd9cd7cac9 100644 --- a/cinder/volume/drivers/huawei/huawei_driver.py +++ b/cinder/volume/drivers/huawei/huawei_driver.py @@ -321,7 +321,6 @@ class HuaweiBaseDriver(driver.VolumeDriver): 'ALLOCTYPE': opts.get('LUNType', self.configuration.lun_type), 'CAPACITY': huawei_utils.get_volume_size(volume), 'WRITEPOLICY': self.configuration.lun_write_type, - 'MIRRORPOLICY': self.configuration.lun_mirror_switch, 'PREFETCHPOLICY': self.configuration.lun_prefetch_type, 'PREFETCHVALUE': self.configuration.lun_prefetch_value, 'DATATRANSFERPOLICY': @@ -677,7 +676,6 @@ class HuaweiBaseDriver(driver.VolumeDriver): 'ALLOCTYPE': opts.get('LUNType', lun_info['ALLOCTYPE']), 'CAPACITY': lun_info['CAPACITY'], 'WRITEPOLICY': lun_info['WRITEPOLICY'], - 'MIRRORPOLICY': lun_info['MIRRORPOLICY'], 'PREFETCHPOLICY': lun_info['PREFETCHPOLICY'], 'PREFETCHVALUE': lun_info['PREFETCHVALUE'], 'DATATRANSFERPOLICY': policy, diff --git a/cinder/volume/drivers/huawei/replication.py b/cinder/volume/drivers/huawei/replication.py index ec14e5d42ef..87d9e3c0a46 100644 --- a/cinder/volume/drivers/huawei/replication.py +++ b/cinder/volume/drivers/huawei/replication.py @@ -411,7 +411,6 @@ class ReplicaPairManager(object): 'ALLOCTYPE': local_lun_info['ALLOCTYPE'], 'CAPACITY': local_lun_info['CAPACITY'], 'WRITEPOLICY': self.conf.lun_write_type, - 'MIRRORPOLICY': self.conf.lun_mirror_switch, 'PREFETCHPOLICY': self.conf.lun_prefetch_type, 'PREFETCHVALUE': self.conf.lun_prefetch_value, 'DATATRANSFERPOLICY': self.conf.lun_policy, diff --git a/cinder/volume/drivers/huawei/rest_client.py b/cinder/volume/drivers/huawei/rest_client.py index 0a6b631abf1..e4ebeadaaa3 100644 --- a/cinder/volume/drivers/huawei/rest_client.py +++ b/cinder/volume/drivers/huawei/rest_client.py @@ -204,6 +204,8 @@ class RestClient(object): raise exception.VolumeBackendAPIException(data=err_msg) def create_lun(self, lun_params): + # Set the mirror switch always on + lun_params['MIRRORPOLICY'] = '1' url = "/lun" result = self.call(url, lun_params) if result['error']['code'] == constants.ERROR_VOLUME_ALREADY_EXIST: diff --git a/releasenotes/notes/remove-mirrorpolicy-parameter-from-huawei-driver-d32257a60d32fd90.yaml b/releasenotes/notes/remove-mirrorpolicy-parameter-from-huawei-driver-d32257a60d32fd90.yaml new file mode 100644 index 00000000000..6d46f80070b --- /dev/null +++ b/releasenotes/notes/remove-mirrorpolicy-parameter-from-huawei-driver-d32257a60d32fd90.yaml @@ -0,0 +1,4 @@ +--- +deprecations: + - | + Remove mirror policy parameter from huawei driver.