diff --git a/nova/cells/manager.py b/nova/cells/manager.py index 32b3c14e08f..344cb22eb48 100644 --- a/nova/cells/manager.py +++ b/nova/cells/manager.py @@ -38,11 +38,13 @@ from nova import objects from nova.objects import base as base_obj from nova.objects import instance as instance_obj +from nova import quota CONF = nova.conf.CONF LOG = logging.getLogger(__name__) +QUOTAS = quota.QUOTAS class CellsManager(manager.Manager): @@ -112,6 +114,11 @@ def _update_our_parents(self, ctxt): self.msg_runner.tell_parents_our_capabilities(ctxt) self.msg_runner.tell_parents_our_capacities(ctxt) + @periodic_task.periodic_task + def _expire_reservations(self, context): + if CONF.cells.expire_reservations: + QUOTAS.expire(context) + @periodic_task.periodic_task def _heal_instances(self, ctxt): """Periodic task to send updates for a number of instances to diff --git a/nova/conf/cells.py b/nova/conf/cells.py index 48d3331c781..b6c0ba43acd 100644 --- a/nova/conf/cells.py +++ b/nova/conf/cells.py @@ -431,7 +431,11 @@ * This value is used with the ``instance_updated_at_threshold`` value in a periodic task run. -""") +"""), + cfg.BoolOpt("expire_reservations", + default=False, + help="If True, enable the periodic task for reservation " + "expiry."), ] cell_messaging_opts = [