Fix to allow more parameters for retention_protect

Scheduled operations might take additional parameters/properties due to
addition of new feature 'retention_protect'

This is to allow more parameters like max_backups and retention_duration
in scheduledoperation command without api validation giving an error

Closes-Bug #1818582

Change-Id: Idf520ed0e5b1625448910278da9dbbf711e5f381
Co-Authored-By: Jiao Pengju <jiaopengju@cmss.chinamobile.com>
This commit is contained in:
Mohamed El Gindi 2019-03-05 16:11:17 -08:00 committed by jiaopengju
parent b9420dbdf5
commit 71a7695175
2 changed files with 11 additions and 1 deletions

View File

@ -36,7 +36,7 @@ create = {
'plan_id': parameter_types.uuid,
},
'required': ['provider_id', 'plan_id'],
'additionalProperties': False,
'additionalProperties': True,
},
},

View File

@ -115,6 +115,16 @@ class ScheduledOperationApiTest(base.TestCase):
operation = self.controller.create(self.req, body=body)
self.assertEqual(name, operation['scheduled_operation']['name'])
def test_create_retention_scheduled_operation(self):
name = 'my retention protect'
param = self.default_create_operation_param.copy()
param['name'] = name
param['operation_definition']['retention_duration'] = 100
param['operation_definition']['max_backups'] = 3
body = self._get_create_operation_request_body(param)
operation = self.controller.create(self.req, body=body)
self.assertEqual(name, operation['scheduled_operation']['name'])
def test_delete_operation_receive_NotFound_except(self):
self.remote_operation_api._delete_operation_exception =\
exception.ScheduledOperationStateNotFound(op_id=None)