Skip to content

Commit

Permalink
fix for #718, #714, #711, #710 (#723)
Browse files Browse the repository at this point in the history
* fix for #718,#714,#711

* fixed uts related to message change

* Added fix for #710

* Modified document as per review comment

* fixed pep8 issues

* done review comment
  • Loading branch information
bhagyashree-sarawate authored and sneharai4 committed Sep 3, 2019
1 parent 90d7ae5 commit 1db9c8d
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 24 deletions.
4 changes: 2 additions & 2 deletions docs/active-passive-based-replication.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ replication_device = backend_id:<Target-Array-Hostname>,
1. In case of asynchronous replication mode, *sync_period* field can optionally be
defined as part of *replication_device* entry and it should be between range 300
and 31622400 seconds. If not defined, it defaults to 900 seconds.
2. Both *cpg_map* and *snap_cpg_map* in *replication_device* section are mandatory.
2. *cpg_map* and *snap_cpg_map* in *replication_device* section are mandatory. If *snap_cpg_map* is not mentioned then it will be same as *cpg_map*
3. If password is encrypted for primary array, it must be encrypted for secondary array
as well using the same *pass-phrase*
Expand Down Expand Up @@ -74,7 +74,7 @@ replication_device = backend_id:<Target-Array-Name>,
```
*Note*:
1. Both *cpg_map* and *snap_cpg_map* in *replication_device* section are mandatory.
1. *cpg_map* and *snap_cpg_map* in *replication_device* section are mandatory. If *snap_cpg_map* is not mentioned then it will be same as *cpg_map*
2. *hpe3par_iscsi_ips* MUST be defined upfront for both source and target arrays.
3. *hpe3par_iscsi_ips* can be a single ISCSI IP or a list of ISCSI IPs delimited by
semi-colon. Delimiter for this field is applicable for *replication_device* section ONLY.
Expand Down
4 changes: 2 additions & 2 deletions docs/peer-persistence-based-replication.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ replication_device = backend_id:<Target-Array-Name>,
1. *replication_mode* MUST be set to *synchronous* as a pre-requisite for Peer
Persistence based replication.
2. Both *cpg_map* and *snap_cpg_map* in *replication_device* section are mandatory
2. *cpg_map* and *snap_cpg_map* in *replication_device* section are mandatory. If *snap_cpg_map* is not mentioned then it will be same as *cpg_map*
3. If password is encrypted for primary array, it must be encrypted for secondary array
as well using the same *pass-phrase*
Expand Down Expand Up @@ -87,7 +87,7 @@ replication_device = backend_id:<Target-Array-Name>,
```
*Note*:
1. Both *cpg_map* and *snap_cpg_map* in *replication_device* section are mandatory.
1. *cpg_map* and *snap_cpg_map* in *replication_device* section are mandatory. If *snap_cpg_map* is not mentioned then it will be same as *cpg_map*
2. *hpe3par_iscsi_ips* MUST be defined upfront for both source and target arrays.
3. *hpe3par_iscsi_ips* can be a single ISCSI IP or a list of ISCSI IPs delimited by
semi-colon. Delimiter for this field is applicable for *replication_device* section ONLY.
Expand Down
12 changes: 6 additions & 6 deletions hpedockerplugin/hpe/hpe_3par_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,9 +848,9 @@ def create_volume(self, volume):
extras['compression'] = compression
else:
err = (_("To create compression enabled volume, size of "
"the volume should be atleast 16GB. Fully "
"provisioned volume can not be compressed. "
"Please re enter requested volume size or "
"the volume should be at least 16GB. Fully "
"provisioned volume cannot be compressed. "
"Please re-enter requested volume size or "
"provisioning type. "))
# LOG.error(err)
raise exception.HPEDriverInvalidSizeForCompressedVolume(
Expand Down Expand Up @@ -887,10 +887,10 @@ def create_volume(self, volume):
msg = "For thin volume, 'provisioning' must be specified " \
"as 'thin'. And for deduplicated and compressed " \
"volume, 'provisioning' must be specified as 'dedup' " \
"and 'compression' must be specified to true. " \
"and 'compression' must be specified as true. " \
"If any of " \
"these conditions for a given type of volume" \
"is not met volume creation will fail"
"these conditions for a given type of volume " \
"is not met volume creation will fail."
raise exception.HPEDriverInvalidInput(reason=msg)

raise exception.HPEDriverInvalidInput(reason=ex.get_description())
Expand Down
25 changes: 18 additions & 7 deletions hpedockerplugin/hpe_storage_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,24 +357,35 @@ def volumedriver_create(self, request, opts=None):
if ('size' in contents['Opts'] and
contents['Opts']['size'] != ""):
vol_size = int(contents['Opts']['size'])
if vol_size == 0:
msg = ("Please enter the valid integer value for size \
parameter")
LOG.error(msg)
return json.dumps({u'Err': six.text_type(msg)})

if ('provisioning' in contents['Opts'] and
contents['Opts']['provisioning'] != ""):
vol_prov = str(contents['Opts']['provisioning'])

if ('compression' in contents['Opts'] and
contents['Opts']['compression'] != ""):
compression_val = str(contents['Opts']['compression'])
if 'compression' in contents['Opts']:
compression_val = str(contents['Opts'].get('compression'))
if compression_val is not None:
if compression_val.lower() not in valid_bool_opts:
msg = \
_('create volume failed, error is:'
_('create volume failed, error is: '
'passed compression parameter'
' do not have a valid value. '
' does not have a valid value. '
'Valid values are: %(valid)s') % {
'valid': valid_bool_opts}
LOG.error(msg)
return json.dumps({u'Err': six.text_type(msg)})
else:
msg = \
_('parameter compression passed without a value. '
'Valid values are: %(valid)s') % {
'valid': valid_bool_opts}
LOG.error(msg)
return json.dumps({u'Err': six.text_type(msg)})

if ('flash-cache' in contents['Opts'] and
contents['Opts']['flash-cache'] != ""):
Expand Down Expand Up @@ -709,7 +720,7 @@ def volumedriver_create_snapshot(self, name, mount_conflict_delay,
if exphrs is not None:
if rethrs > exphrs:
msg = ('create schedule failed, error is: '
'expiration hours cannot be greater than '
'expiration hours must be greater than '
'retention hours')
LOG.error(msg)
response = json.dumps({'Err': msg})
Expand Down Expand Up @@ -746,7 +757,7 @@ def volumedriver_create_snapshot(self, name, mount_conflict_delay,
schedNameLength = len(schedName)
snapPrefixLength = len(snapPrefix)
if schedNameLength > 31 or snapPrefixLength > 15:
msg = ('Please provide a schedlueName with max 31 '
msg = ('Please provide a scheduleName with max 31 '
'characters and snapshotPrefix with max '
'length of 15 characters')
LOG.error(msg)
Expand Down
7 changes: 4 additions & 3 deletions hpedockerplugin/volume_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ def _initialize_configuration(self):
"Failed to initialize driver - cpg_map not defined for"
"replication device")

self.tgt_bkend_config.hpe3par_snapcpg = \
self._extract_remote_cpgs(
self.tgt_bkend_config.snap_cpg_map)
if self.tgt_bkend_config.snap_cpg_map:
self.tgt_bkend_config.hpe3par_snapcpg = \
self._extract_remote_cpgs(
self.tgt_bkend_config.snap_cpg_map)
if not self.tgt_bkend_config.hpe3par_snapcpg:
self.tgt_bkend_config.hpe3par_snapcpg = \
self.tgt_bkend_config.hpe3par_cpg
Expand Down
4 changes: 2 additions & 2 deletions test/createsnapshot_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def get_request_params(self):
"retHrs": '2'}}

def check_response(self, resp):
expected = 'Please provide a schedlueName with max 31 characters '\
expected = 'Please provide a scheduleName with max 31 characters '\
'and snapshotPrefix with max length of 15 characters'
self._test_case.assertEqual(resp, {u"Err": expected})

Expand Down Expand Up @@ -283,7 +283,7 @@ def get_request_params(self):

def check_response(self, resp):
expected = 'create schedule failed, error is: expiration hours '\
'cannot be greater than retention hours'
'must be greater than retention hours'
self._test_case.assertEqual(resp, {u"Err": expected})


Expand Down
4 changes: 2 additions & 2 deletions test/createvolume_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,8 @@ class TestCreateCompressedVolumeNegativeSize(CreateVolumeUnitTest):
def check_response(self, resp):
expected_msg = 'Invalid input received: To create compression '\
'enabled volume, size of the volume should be '\
'atleast 16GB. Fully provisioned volume can not be '\
'compressed. Please re enter requested volume size '\
'at least 16GB. Fully provisioned volume cannot be '\
'compressed. Please re-enter requested volume size '\
'or provisioning type. '
self._test_case.assertEqual(resp, {u"Err": expected_msg})

Expand Down

0 comments on commit 1db9c8d

Please sign in to comment.