Adam Litke has uploaded a new change for review. Change subject: Add start/stop interface to jobs module ......................................................................
Add start/stop interface to jobs module Add interfaces similar to virt.periodic and other subsystems for initializing a module with parameters. In a future patch we want to set the scheduler that the jobs module will use. The stop() interface will clear all jobs. Change-Id: I5e67018fa45bcae9aedf74a9b4587230f6118024 Signed-off-by: Adam Litke <[email protected]> --- M lib/vdsm/jobs.py M tests/jobsTests.py M vdsm/vdsm 3 files changed, 12 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/99/61999/1 diff --git a/lib/vdsm/jobs.py b/lib/vdsm/jobs.py index 232981c..8f44059 100644 --- a/lib/vdsm/jobs.py +++ b/lib/vdsm/jobs.py @@ -132,9 +132,11 @@ return s.format(self=self, id=id(self)) -# This helper should only be called by test code. Everything else should be -# using the public APIs. -def _clear(): +def start(): + pass + + +def stop(): with _lock: _jobs.clear() diff --git a/tests/jobsTests.py b/tests/jobsTests.py index cb1cb89..5665d82 100644 --- a/tests/jobsTests.py +++ b/tests/jobsTests.py @@ -64,7 +64,10 @@ TIMEOUT = 1 def setUp(self): - jobs._clear() + jobs.start() + + def tearDown(self): + jobs.stop() def test_job_initial_state(self): job = TestingJob() diff --git a/vdsm/vdsm b/vdsm/vdsm index a6dc727..9c6367a 100755 --- a/vdsm/vdsm +++ b/vdsm/vdsm @@ -34,6 +34,7 @@ from vdsm import constants from vdsm import dsaversion from vdsm import health +from vdsm import jobs from vdsm import schedule from vdsm import utils from vdsm import libvirtconnection @@ -99,6 +100,7 @@ scheduler = schedule.Scheduler(name="vdsm.Scheduler", clock=utils.monotonic_time) scheduler.start() + jobs.start() from clientIF import clientIF # must import after config is read cif = clientIF.getInstance(irs, log, scheduler) @@ -119,6 +121,7 @@ periodic.stop() cif.prepareForShutdown() scheduler.stop() + jobs.stop() finally: libvirtconnection.stop_event_loop(wait=False) -- To view, visit https://gerrit.ovirt.org/61999 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5e67018fa45bcae9aedf74a9b4587230f6118024 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Adam Litke <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/admin/lists/[email protected]
