summaryrefslogtreecommitdiffstats
path: root/nova/exception.py
diff options
context:
space:
mode:
authorMichael Still <mikal@stillhq.com>2012-12-24 15:00:52 +1100
committerMichael Still <mikal@stillhq.com>2013-01-05 10:21:37 +1100
commit9fb647ec100133b1ee5903535507c74d408f4790 (patch)
tree3c740d8203b544a270d5aabd83d1f0e9d784f013 /nova/exception.py
parent1be4d7b6be3c482d8d8b6e23c610f71e004760df (diff)
downloadnova-9fb647ec100133b1ee5903535507c74d408f4790.tar.gz
nova-9fb647ec100133b1ee5903535507c74d408f4790.tar.xz
nova-9fb647ec100133b1ee5903535507c74d408f4790.zip
Refactor periodic tasks.
This review allows periodic tasks to be enabled or disabled in the decorator, as well as by specifying an interval which is negative. The spacing between runs of a periodic task is now specified in seconds, with zero meaning the default spacing which is currently 60 seconds. There is also a new argument to the decorator which indicates if a periodic task _needs_ to be run in the nova-compute process. There is also a flag (run_external_periodic_tasks) which can be used to move these periodic tasks out of the nova-compute process. I also remove the periodic_interval flag to services, as the interval between runs is now dynamic based on the number of seconds that a periodic task wants to wait for its next run. For callers who want to twiddle the sleep period (for example unit tests), there is a create() argument periodic_interval_max which lets the period periodic_tasks() specifies be overridden. This is not exposed as a flag because I cannot see a use case for that. It is needed for unit testing however. DocImpact. Resolves bug 939087. Change-Id: I7f245a88b8d229a481c1b65a4c0f1e2769bf3901
Diffstat (limited to 'nova/exception.py')
-rw-r--r--nova/exception.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/nova/exception.py b/nova/exception.py
index c484b5120..9507a0088 100644
--- a/nova/exception.py
+++ b/nova/exception.py
@@ -410,6 +410,10 @@ class InvalidUUID(Invalid):
message = _("Expected a uuid but received %(uuid)s.")
+class InvalidPeriodicTaskArg(Invalid):
+ message = _("Unexpected argument for periodic task creation: %(arg)s.")
+
+
class ConstraintNotMet(NovaException):
message = _("Constraint not met.")
code = 412