Skip to content

Commit

Permalink
CellsV1: Expire reservations in cells manager
Browse files Browse the repository at this point in the history
Normally reservations are expired by a periodic task in nova-scheduler.
In a cells deployment quotas are usually enabled only on the api-level
cell. This uses a separate DB from the scheduler, so any reservations
on the top level never get expired.

This change adds the same periodic task to the cells manager so
reservations at all levels have a chance to be expired. The task is
disabled by default and can be turned on with the
CONF.cells.expire_reservations option.

Change-Id: I340e7ff6262a5007e2699217e1012dec9038c03b
  • Loading branch information
sorrison authored and Sam Morrison committed Nov 16, 2016
1 parent 808376a commit 6a5a4e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions nova/cells/manager.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion nova/conf/cells.py
Expand Up @@ -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 = [
Expand Down

0 comments on commit 6a5a4e5

Please sign in to comment.