Skip to content

Commit

Permalink
Added snapScheduleParameters in the modify method (#345)
Browse files Browse the repository at this point in the history
Added snapScheduleParameters in the modify method so that snap schedule can 
be edited via playbook

Co-authored-by: Meenakshi Dembi <[email protected]>
  • Loading branch information
meenakshidembi691 and Meenakshi Dembi authored May 14, 2021
1 parent 7ac580d commit d6917ad
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion storops/unity/resource/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def create(cls, cli, pool, nas_server, name, size, proto=None,
def modify(self, size=None, is_thin=None, tiering_policy=None,
user_cap=False, is_compression=None, access_policy=None,
locking_policy=None, description=None,
cifs_fs_parameters=None):
cifs_fs_parameters=None, snap_schedule_parameters=None):
sr = self.storage_resource
if sr is None:
raise ValueError('storage resource for filesystem {} not found.'
Expand All @@ -103,6 +103,8 @@ def modify(self, size=None, is_thin=None, tiering_policy=None,
params['cifsFsParameters'] = cifs_fs_parameters
if description is not None:
params['description'] = description
if snap_schedule_parameters:
params['snapScheduleParameters'] = snap_schedule_parameters

if not params:
return RestResponse('', self._cli)
Expand Down
7 changes: 7 additions & 0 deletions storops_test/unity/resource/test_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,13 @@ def test_modify_success_empty_description(self):
fs.modify(description='')
assert_that(fs.description, equal_to(''))

@patch_rest
def test_modify_success_snap_schedule(self):
fs = UnityFileSystem(cli=t_rest(), _id='fs_22')
snap_schedule_parameters = {'snapSchedule': {'id': 'snapSch_1'}}
resp = fs.modify(snap_schedule_parameters=snap_schedule_parameters)
assert_that(resp.is_ok(), equal_to(True))

@patch_rest
def test_delete_filesystem_async(self):
fs = UnityFileSystem(_id='fs_14', cli=t_rest())
Expand Down
11 changes: 11 additions & 0 deletions storops_test/unity/rest_data/storageResource/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,17 @@
},
"response": "size_too_small.json"
},
{
"url": "/api/instances/storageResource/res_22/action/modifyFilesystem?compact=True",
"body": {
"snapScheduleParameters": {
"snapSchedule": {
"id": "snapSch_1"
}
}
},
"response": "empty.json"
},
{
"url": "/api/types/storageResource/action/createFilesystem?compact=True",
"body": {
Expand Down

0 comments on commit d6917ad

Please sign in to comment.