Skip to content

Commit bd785b5

Browse files
author
lei shi
committed
[DR] OPSAPS-28182 Add new field 'paused' to ApiSnapshotPolicy
The field allows a user to pause a snapshot policy.
1 parent f957e37 commit bd785b5

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

python/src/cm_api/endpoints/types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,7 @@ class ApiSnapshotPolicy(BaseApiObject):
934934
@ivar alert_on_success: whether to generate alerts on successful completion of snapshot creation/deletion activity.
935935
@ivar alert_on_fail: whether to generate alerts on failure of snapshot creation/deletion activity.
936936
@ivar alert_on_abort: whether to generate alerts on abort of snapshot creation/deletion activity.
937+
@ivar paused: whether to run the policy on schedule
937938
@type hbaseArguments: ApiHBaseSnapshotPolicyArguments
938939
@ivar hbaseArguments: HBase specific arguments for the replication job.
939940
@type hdfsArguments: ApiHdfsSnapshotPolicyArguments
@@ -957,6 +958,7 @@ class ApiSnapshotPolicy(BaseApiObject):
957958
'alertOnSuccess' : None,
958959
'alertOnFail' : None,
959960
'alertOnAbort' : None,
961+
'paused' : None,
960962
'hbaseArguments' : Attr(ApiHBaseSnapshotPolicyArguments),
961963
'hdfsArguments' : Attr(ApiHdfsSnapshotPolicyArguments),
962964
'lastCommand' : ROAttr(ApiSnapshotCommand),

python/src/cm_api_tests/test_snapshot.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ def test_snapshot(self):
244244
self._test_policy(return_policy, service.get_snapshot_policy("sn1"))
245245

246246
return_policy.dayOfWeek=5
247+
return_policy.paused=True
247248
self.resource.expect("PUT",
248249
"/clusters/cluster1/services/hdfs1/snapshots/policies/sn1",
249250
data=return_policy,
@@ -264,4 +265,5 @@ def _test_policy(self, exp_policy, policy):
264265
self.assertEqual(exp_policy.hdfsArguments.pathPatterns, policy.hdfsArguments.pathPatterns)
265266
self.assertEqual(exp_policy.weeklySnapshots, policy.weeklySnapshots)
266267
self.assertEqual(exp_policy.dayOfWeek, policy.dayOfWeek)
268+
self.assertEqual(exp_policy.paused, policy.paused)
267269

0 commit comments

Comments
 (0)