Allow to configure cache clean up period
Add new option "IRONIC_INSPECTOR_CLEAN_UP_PERIOD" to devstack plugin, which allow to configure clean up time of node cache. The periodics.periodic_task decorator application on main.py:periodic_clean_up and main.py:periodic_update is postponed until after the inspector.conf file is read. Change-Id: Ic6563990c789b1d1c3b72088860a4d13a3d57f29 Closes-Bug: #1639286
This commit is contained in:
parent
cb8db157e4
commit
2401f0cb10
@ -22,6 +22,7 @@ IRONIC_INSPECTOR_COLLECTORS=${IRONIC_INSPECTOR_COLLECTORS:-default,logs,pci-devi
|
|||||||
IRONIC_INSPECTOR_RAMDISK_LOGDIR=${IRONIC_INSPECTOR_RAMDISK_LOGDIR:-$IRONIC_INSPECTOR_DATA_DIR/ramdisk-logs}
|
IRONIC_INSPECTOR_RAMDISK_LOGDIR=${IRONIC_INSPECTOR_RAMDISK_LOGDIR:-$IRONIC_INSPECTOR_DATA_DIR/ramdisk-logs}
|
||||||
IRONIC_INSPECTOR_ALWAYS_STORE_RAMDISK_LOGS=${IRONIC_INSPECTOR_ALWAYS_STORE_RAMDISK_LOGS:-True}
|
IRONIC_INSPECTOR_ALWAYS_STORE_RAMDISK_LOGS=${IRONIC_INSPECTOR_ALWAYS_STORE_RAMDISK_LOGS:-True}
|
||||||
IRONIC_INSPECTOR_TIMEOUT=${IRONIC_INSPECTOR_TIMEOUT:-600}
|
IRONIC_INSPECTOR_TIMEOUT=${IRONIC_INSPECTOR_TIMEOUT:-600}
|
||||||
|
IRONIC_INSPECTOR_CLEAN_UP_PERIOD=${IRONIC_INSPECTOR_CLEAN_UP_PERIOD:-}
|
||||||
# These should not overlap with other ranges/networks
|
# These should not overlap with other ranges/networks
|
||||||
IRONIC_INSPECTOR_INTERNAL_IP=${IRONIC_INSPECTOR_INTERNAL_IP:-172.24.42.254}
|
IRONIC_INSPECTOR_INTERNAL_IP=${IRONIC_INSPECTOR_INTERNAL_IP:-172.24.42.254}
|
||||||
IRONIC_INSPECTOR_INTERNAL_SUBNET_SIZE=${IRONIC_INSPECTOR_INTERNAL_SUBNET_SIZE:-24}
|
IRONIC_INSPECTOR_INTERNAL_SUBNET_SIZE=${IRONIC_INSPECTOR_INTERNAL_SUBNET_SIZE:-24}
|
||||||
@ -207,7 +208,9 @@ function configure_inspector {
|
|||||||
inspector_iniset processing node_not_found_hook "$IRONIC_INSPECTOR_NODE_NOT_FOUND_HOOK"
|
inspector_iniset processing node_not_found_hook "$IRONIC_INSPECTOR_NODE_NOT_FOUND_HOOK"
|
||||||
fi
|
fi
|
||||||
inspector_iniset DEFAULT timeout $IRONIC_INSPECTOR_TIMEOUT
|
inspector_iniset DEFAULT timeout $IRONIC_INSPECTOR_TIMEOUT
|
||||||
|
if [ -n "$IRONIC_INSPECTOR_CLEAN_UP_PERIOD" ]; then
|
||||||
|
inspector_iniset DEFAULT clean_up_period "$IRONIC_INSPECTOR_CLEAN_UP_PERIOD"
|
||||||
|
fi
|
||||||
get_or_create_service "ironic-inspector" "baremetal-introspection" "Ironic Inspector baremetal introspection service"
|
get_or_create_service "ironic-inspector" "baremetal-introspection" "Ironic Inspector baremetal introspection service"
|
||||||
get_or_create_endpoint "baremetal-introspection" "$REGION_NAME" \
|
get_or_create_endpoint "baremetal-introspection" "$REGION_NAME" \
|
||||||
"$IRONIC_INSPECTOR_URI" "$IRONIC_INSPECTOR_URI" "$IRONIC_INSPECTOR_URI"
|
"$IRONIC_INSPECTOR_URI" "$IRONIC_INSPECTOR_URI" "$IRONIC_INSPECTOR_URI"
|
||||||
|
@ -324,8 +324,6 @@ def handle_404(error):
|
|||||||
return error_response(error, code=404)
|
return error_response(error, code=404)
|
||||||
|
|
||||||
|
|
||||||
@periodics.periodic(spacing=CONF.firewall.firewall_update_period,
|
|
||||||
enabled=CONF.firewall.manage_firewall)
|
|
||||||
def periodic_update(): # pragma: no cover
|
def periodic_update(): # pragma: no cover
|
||||||
try:
|
try:
|
||||||
firewall.update_filters()
|
firewall.update_filters()
|
||||||
@ -333,7 +331,6 @@ def periodic_update(): # pragma: no cover
|
|||||||
LOG.exception(_LE('Periodic update of firewall rules failed'))
|
LOG.exception(_LE('Periodic update of firewall rules failed'))
|
||||||
|
|
||||||
|
|
||||||
@periodics.periodic(spacing=CONF.clean_up_period)
|
|
||||||
def periodic_clean_up(): # pragma: no cover
|
def periodic_clean_up(): # pragma: no cover
|
||||||
try:
|
try:
|
||||||
if node_cache.clean_up():
|
if node_cache.clean_up():
|
||||||
@ -438,9 +435,17 @@ class Service(object):
|
|||||||
if CONF.firewall.manage_firewall:
|
if CONF.firewall.manage_firewall:
|
||||||
firewall.init()
|
firewall.init()
|
||||||
|
|
||||||
|
periodic_update_ = periodics.periodic(
|
||||||
|
spacing=CONF.firewall.firewall_update_period,
|
||||||
|
enabled=CONF.firewall.manage_firewall
|
||||||
|
)(periodic_update)
|
||||||
|
periodic_clean_up_ = periodics.periodic(
|
||||||
|
spacing=CONF.clean_up_period
|
||||||
|
)(periodic_clean_up)
|
||||||
|
|
||||||
self._periodics_worker = periodics.PeriodicWorker(
|
self._periodics_worker = periodics.PeriodicWorker(
|
||||||
callables=[(periodic_update, None, None),
|
callables=[(periodic_update_, None, None),
|
||||||
(periodic_clean_up, None, None)],
|
(periodic_clean_up_, None, None)],
|
||||||
executor_factory=periodics.ExistingExecutor(utils.executor()))
|
executor_factory=periodics.ExistingExecutor(utils.executor()))
|
||||||
utils.executor().submit(self._periodics_worker.start)
|
utils.executor().submit(self._periodics_worker.start)
|
||||||
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
The configuration of the ``periodic_clean_up`` and ``periodic_update`` tasks
|
||||||
|
is now applied after the file ``inspector.conf`` is read
|
Loading…
Reference in New Issue
Block a user