diff options
author | Jan Fajerski <jfajerski@suse.com> | 2020-09-25 16:16:42 +0200 |
---|---|---|
committer | Jan Fajerski <jfajerski@suse.com> | 2020-10-14 09:22:09 +0200 |
commit | 0c32bfdb766ada1c626108911ec3bacfd3f9af50 (patch) | |
tree | e6c5f99bc9bf3b965e6b11300bc274e20e0121d8 /src/pybind/mgr/snap_schedule/fs/schedule_client.py | |
parent | Merge pull request #37311 from mgariepy/fix-47502 (diff) | |
download | ceph-0c32bfdb766ada1c626108911ec3bacfd3f9af50.tar.xz ceph-0c32bfdb766ada1c626108911ec3bacfd3f9af50.zip |
pybind/mgr/snap-schedule: fix deactivate
This commit adds another argument to get_db_schedules in order to able
to filter not only by the repeat column (schedule period in seconds,
used for snapshotting) but also by the schedule column (the user facing
schedule period, string like 3h).
Fixes: https://tracker.ceph.com/issues/47515
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
Diffstat (limited to 'src/pybind/mgr/snap_schedule/fs/schedule_client.py')
-rw-r--r-- | src/pybind/mgr/snap_schedule/fs/schedule_client.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/pybind/mgr/snap_schedule/fs/schedule_client.py b/src/pybind/mgr/snap_schedule/fs/schedule_client.py index 5c7cb0bd01d..12298c1f97e 100644 --- a/src/pybind/mgr/snap_schedule/fs/schedule_client.py +++ b/src/pybind/mgr/snap_schedule/fs/schedule_client.py @@ -175,8 +175,8 @@ class SnapSchedClient(CephfsClient): sched = Schedule.get_db_schedules(path, db, fs_name, - repeat, - start)[0] + repeat=repeat, + start=start)[0] time = datetime.now(timezone.utc) with open_filesystem(self, fs_name) as fs_handle: snap_ts = time.strftime(SNAPSHOT_TS_FORMAT) @@ -244,9 +244,9 @@ class SnapSchedClient(CephfsClient): self.store_schedule_db(sched.fs) @updates_schedule_db - def rm_snap_schedule(self, fs, path, repeat, start): + def rm_snap_schedule(self, fs, path, schedule, start): db = self.get_schedule_db(fs) - Schedule.rm_schedule(db, path, repeat, start) + Schedule.rm_schedule(db, path, schedule, start) @updates_schedule_db def add_retention_spec(self, @@ -273,13 +273,17 @@ class SnapSchedClient(CephfsClient): Schedule.rm_retention(db, path, retention_spec) @updates_schedule_db - def activate_snap_schedule(self, fs, path, repeat, start): + def activate_snap_schedule(self, fs, path, schedule, start): db = self.get_schedule_db(fs) - schedules = Schedule.get_db_schedules(path, db, fs, repeat, start) + schedules = Schedule.get_db_schedules(path, db, fs, + schedule=schedule, + start=start) [s.set_active(db) for s in schedules] @updates_schedule_db - def deactivate_snap_schedule(self, fs, path, repeat, start): + def deactivate_snap_schedule(self, fs, path, schedule, start): db = self.get_schedule_db(fs) - schedules = Schedule.get_db_schedules(path, db, fs, repeat, start) + schedules = Schedule.get_db_schedules(path, db, fs, + schedule=schedule, + start=start) [s.set_inactive(db) for s in schedules] |