Skip to content

test: add snap schedule tests - #34552

Merged
batrick merged 6 commits into
ceph:masterfrom
vshankar:wip-snap-sched-tests
Nov 18, 2020
Merged

batrick merged 6 commits into
ceph:masterfrom
vshankar:wip-snap-sched-tests

Conversation

@vshankar

Copy link
Copy Markdown
Contributor

No description provided.

@vshankar vshankar added cephfs Ceph File System DNM labels Apr 14, 2020
@vshankar
vshankar requested review from a team and jan--f April 14, 2020 13:20
@vshankar

Copy link
Copy Markdown
Contributor Author

@jan--f The following changes would be required to run these tests:

diff --git a/src/pybind/mgr/snap_schedule/module.py b/src/pybind/mgr/snap_schedule/module.py
index 79ea24b8c4..e39fd1e398 100644
--- a/src/pybind/mgr/snap_schedule/module.py
+++ b/src/pybind/mgr/snap_schedule/module.py
@@ -3,6 +3,7 @@ Copyright (C) 2019 SUSE
 
 LGPL2.1.  See file COPYING.
 """
+import json
 import errno
 import sqlite3
 from .fs.schedule import SnapSchedClient, Schedule
@@ -75,7 +76,7 @@ class Module(MgrModule):
             return e.to_tuple()
         if not scheds:
             return -1, '', f'SnapSchedule for {path} not found'
-        return 0, str([str(sched) for sched in scheds]), ''
+        return 0, json.dumps([[sched[1], sched[2]] for sched in scheds]), ''

and

diff --git a/src/pybind/mgr/snap_schedule/fs/schedule.py b/src/pybind/mgr/snap_schedule/fs/schedule.py
index 4f528f21cf..8ac4026c1d 100644
--- a/src/pybind/mgr/snap_schedule/fs/schedule.py
+++ b/src/pybind/mgr/snap_schedule/fs/schedule.py
@@ -71,7 +71,7 @@ class Schedule(object):
         self.last_run = None
 
     def __str__(self):
-        return f'''{self.rel_path}: {self.schedule}; {self.retention}'''
+        return f'''{self.path}: {self.schedule}; {self.retention}'''
 
     def report(self):
         import pprint
@@ -223,7 +223,7 @@ class SnapSchedClient(CephfsClient):
             log.info(f'finally branch')
             self.refresh_snap_timers(fs_name)
             log.info(f'calling prune')
-            self.prune_snapshots(fs_name, path, retention)
+            #self.prune_snapshots(fs_name, path, retention)
 
     def prune_snapshots(self, fs_name, path, retention):
         log.debug('Pruning snapshots')

@vshankar

Copy link
Copy Markdown
Contributor Author

@jan--f Note that in the diffs mentioned previously I had commented out the call to prune_snapshots() -- without this the snaps were getting purged every minute. I suspected the prune-every-minute test code that you had but taking out the purge-every-minute thing in get_prune_set() didn't work -- I think get_prune_set() was returning an empty set thereby deleting a snap that was just created.

Another interesting thing that I saw when running test_snap_schedule -- snippet from the manager log below:

2020-04-14T04:45:22.942-0400 7f5a2e9bc700  0 [snap_schedule DEBUG snap_schedule.fs.schedule] Will snapshot snap_test_dir13 in fs cephfs in 38s
2020-04-14T04:46:01.074-0400 7f5a0d83a700  0 [snap_schedule DEBUG snap_schedule.fs.schedule] Will snapshot snap_test_dir13 in fs cephfs in 119s

The test schedules a snap every 2 minutes, but the first snap is scheduled in 38 odd seconds for some reason (the test expects the snap to show up in about 98 seconds (1m + 38s)). Also, this happens once in a while (I checked if there were any stale snap schedules, but there were none). And similar with multiple snap schedules per path ( test_multi_snap_schedule test) as below:

2020-04-14T04:50:28.320-0400 7fe38b690700  0 [snap_schedule DEBUG snap_schedule.fs.schedule] Will snapshot snap_test_dir14 in fs cephfs in 92s
2020-04-14T04:50:28.808-0400 7fe38b690700  0 [snap_schedule DEBUG snap_schedule.fs.schedule] Will snapshot snap_test_dir14 in fs cephfs in 32s
2020-04-14T04:51:00.923-0400 7fe369ccd700  0 [snap_schedule DEBUG snap_schedule.fs.schedule] Will snapshot snap_test_dir14 in fs cephfs in 60s
2020-04-14T04:52:00.983-0400 7fe3654c4700  0 [snap_schedule DEBUG snap_schedule.fs.schedule] Will snapshot snap_test_dir14 in fs cephfs in 120s

The timings look a bit off to me...

@jan--f

jan--f commented Apr 16, 2020

Copy link
Copy Markdown
Contributor

thanks @vshankar I'll look into these issue. I haven't yet paid to close attention to the timings, mostly cause I still need to add proper support for start argument to delay snapshots till a given start time. Timezones are also still an open question. I'll bring this up on our next standup.

@jan--f

jan--f commented Apr 16, 2020

Copy link
Copy Markdown
Contributor

The mentioned issues should be fixed in #29489

@vshankar

Copy link
Copy Markdown
Contributor Author

The mentioned issues should be fixed in #29489

will take a look

@vshankar

Copy link
Copy Markdown
Contributor Author

@jan--f -- test_multi_snap_schedule still fails with the latest push for PR #29489

The test schedules multiple snaps schedules (2m and 3m) on a directory, but the snaps get scheduled every 2m.

2020-04-23T09:05:44.791-0400 7f205d2ed700  0 [snap_schedule DEBUG snap_schedule.fs.schedule] Will snapshot snap_test_dir1 in fs cephfs in 120s
2020-04-23T09:05:45.259-0400 7f205d2ed700  0 [snap_schedule DEBUG snap_schedule.fs.schedule] Will snapshot snap_test_dir1 in fs cephfs in 119s

@ukernel

ukernel commented Apr 23, 2020

Copy link
Copy Markdown
Contributor

Is 'ceph mgr module enable snap_schedule' supported already in master branch? I tried the command, it return -ENOENT

@jan--f

jan--f commented Apr 23, 2020

Copy link
Copy Markdown
Contributor

@ukernel not yet, the module PR is #29489

Comment thread qa/tasks/cephfs/test_snap_schedules.py Resolved
@ukernel

ukernel commented Apr 23, 2020

Copy link
Copy Markdown
Contributor

does the snap_schedule module remove old snapshots. If yes, it's better to add a test case

@jan--f

jan--f commented Apr 23, 2020

Copy link
Copy Markdown
Contributor

does the snap_schedule module remove old snapshots. If yes, it's better to add a test case

It does indeed and I'll add tests for that. I'm in the final stages for the mgr module and will add more tests once this is stabilized.

@vshankar
vshankar force-pushed the wip-snap-sched-tests branch 2 times, most recently from 3dc0ff0 to 1e99730 Compare April 23, 2020 16:54
Comment thread qa/tasks/cephfs/test_snap_schedules.py Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nit: this routine would not be required w/ @jan--f latest changes to PR #29489

@vshankar

Copy link
Copy Markdown
Contributor Author

@jan--f please use the latest update from this for the tests...

@stale

stale Bot commented Jun 23, 2020

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days.
If you are a maintainer or core committer, please follow-up on this pull request to identify what steps should be taken by the author to move this proposed change forward.
If you are the author of this pull request, thank you for your proposed contribution. If you believe this change is still appropriate, please ensure that any feedback has been addressed and ask for a code review.

@stale stale Bot added the stale label Jun 23, 2020
@vshankar
vshankar force-pushed the wip-snap-sched-tests branch from 1e99730 to 4d1612a Compare August 20, 2020 11:04
@stale stale Bot removed the stale label Aug 20, 2020
@vshankar vshankar changed the title [WIP]: add snap schedule tests test: add snap schedule tests Aug 20, 2020
@vshankar
vshankar marked this pull request as ready for review August 21, 2020 14:03

@batrick batrick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rebase. @vshankar please run this test through teuthology when ready and post the results.

@vshankar

vshankar commented Sep 1, 2020

Copy link
Copy Markdown
Contributor Author

Let's rebase. @vshankar please run this test through teuthology when ready and post the results.

ack

@vshankar
vshankar force-pushed the wip-snap-sched-tests branch from 4d1612a to 0823c15 Compare September 2, 2020 10:46
@vshankar

Copy link
Copy Markdown
Contributor Author

What's the motivation for storing the allow_minute_snaps flag on a per schedule basis in the DB?

Looking at the changes, I don't seem to recall with acuracy for reason to store it in the db.

I think we shouldn't store this in the DB, as that would make for a strange UI. Say a user unsets the option for the mgr module but has schedules in the DB with this option. Keeping this as a runtime module option makes more sense to me. We'd need to add some better error handling for the case of minute granularity snapshots in the DB and the option turned off. But I think just skipping those schedules plus logging it should be least surprising?

Probably. However, I won't be able to get to looking at it (and fixing) this week. Sorry for that! I'll try to get to it next week. In case you want to give it a shot, that'll be great (since this blocks the octopus backport).

@jan--f

jan--f commented Oct 29, 2020

Copy link
Copy Markdown
Contributor

@vshankar I have my proposed changes up at https://github.com/jan--f/ceph/tree/wip-snap-sched-tests

Maybe we can re-use this PR to keep the discussion here?

@vshankar

Copy link
Copy Markdown
Contributor Author

@vshankar I have my proposed changes up at https://github.com/jan--f/ceph/tree/wip-snap-sched-tests

I'll take a look. Thx!

Maybe we can re-use this PR to keep the discussion here?

Sure.

@vshankar

vshankar commented Nov 2, 2020

Copy link
Copy Markdown
Contributor Author

@vshankar I have my proposed changes up at https://github.com/jan--f/ceph/tree/wip-snap-sched-tests

Look OK. I'll test out the changes tomorrow.

@vshankar

vshankar commented Nov 3, 2020

Copy link
Copy Markdown
Contributor Author

Look OK. I'll test out the changes tomorrow.

tests run fine. I will pull your changes in this PR and post the test results.

We should be able to get this merged pretty soon.

@vshankar
vshankar force-pushed the wip-snap-sched-tests branch from 000fccb to 8a9ee82 Compare November 4, 2020 08:35
@vshankar

vshankar commented Nov 4, 2020

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@vshankar

vshankar commented Nov 4, 2020 •

Copy link
Copy Markdown
Contributor Author

@vshankar

vshankar commented Nov 6, 2020

Copy link
Copy Markdown
Contributor Author

jenkins test make check

1 similar comment
@jan--f

jan--f commented Nov 12, 2020

Copy link
Copy Markdown
Contributor

jenkins test make check

@vshankar
vshankar force-pushed the wip-snap-sched-tests branch from 8a9ee82 to 1804a4a Compare November 16, 2020 05:58
@vshankar

Copy link
Copy Markdown
Contributor Author

@batrick @jan--f make check fixed. please take a look

@batrick

batrick commented Nov 17, 2020

Copy link
Copy Markdown
Member

@vshankar this needs rebased. fs:basic_functional no longer exists.

@vshankar

Copy link
Copy Markdown
Contributor Author

@vshankar this needs rebased. fs:basic_functional no longer exists.

ack -- I'll push an update.

@batrick batrick left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also run through testing.

Otherwise LGTM.

Comment thread qa/tasks/cephfs/test_snap_schedules.py Resolved
Comment thread qa/tasks/cephfs/test_snap_schedules.py Resolved
Comment thread qa/tasks/cephfs/test_snap_schedules.py Resolved
vshankar and others added 6 commits November 17, 2020 01:15
Next commit introduces a module option to allow minute granularity
snapshots.

Signed-off-by: Venky Shankar <[email protected]>
Thsi allows setting and scheduling snapshots with minute granularity. If
the option is unset, adding these will fail and scheduling for them will
be skipped.

Signed-off-by: Jan Fajerski <[email protected]>
For easiness in parsing for tests.

Signed-off-by: Venky Shankar <[email protected]>
... mostly as an aid for debugging.

Signed-off-by: Venky Shankar <[email protected]>
Signed-off-by: Venky Shankar <[email protected]>
@vshankar
vshankar force-pushed the wip-snap-sched-tests branch from 1804a4a to a8c8b3a Compare November 17, 2020 13:41
@batrick

batrick commented Nov 17, 2020

Copy link
Copy Markdown
Member

jenkins test api

@batrick

batrick commented Nov 17, 2020

Copy link
Copy Markdown
Member

@vshankar please run through QA for the snap schedule tests whenever you're ready.

@vshankar

Copy link
Copy Markdown
Contributor Author

@vshankar please run through QA for the snap schedule tests whenever you're ready.

sure -- will post the link.

@batrick
batrick merged commit cfabba6 into ceph:master Nov 18, 2020
@vshankar
vshankar deleted the wip-snap-sched-tests branch November 18, 2020 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cephfs Ceph File System needs-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants