735d9b3392
Replace iteritems with items Replace iterkeys with keys Replace itervalues with values Special Note: In Python 2 those are copies of the elements. In Python3 those are references to the dictionary elements. The openstack python2to3 documents suggests wrapping the calls with a list if the dict is expected to change while iterating. nfv_scenario_tests (non guest) all pass. Story: 2004241 Task: 28070 Change-Id: Iddb69b83f0be2f8ec240f7708d2c6d0dc675848c Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
45 lines
1.2 KiB
Python
Executable File
45 lines
1.2 KiB
Python
Executable File
#
|
|
# Copyright (c) 2016 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
from nfv_common import timers
|
|
from nfv_common import debug
|
|
|
|
from nfv_vim import alarm
|
|
from nfv_vim import tables
|
|
|
|
DLOG = debug.debug_get_logger('nfv_vim.vim_alarm_audits')
|
|
|
|
|
|
@timers.interval_timer('audit_alarms', initial_delay_secs=60,
|
|
interval_secs=10)
|
|
def _audit_alarms():
|
|
"""
|
|
Audit Alarms. This is being done to allow hold off times to be supported
|
|
for instance alarms. By auditing the instance alarms every 10 seconds, it
|
|
allows a held off alarm to be raised within 10 seconds of the hold off
|
|
time expiring.
|
|
"""
|
|
while True:
|
|
timer_id = (yield)
|
|
DLOG.verbose("Audit alarms called, timer_id=%s." % timer_id)
|
|
instance_table = tables.tables_get_instance_table()
|
|
for instance in instance_table.values():
|
|
if not instance.is_deleted():
|
|
alarm.instance_manage_alarms(instance)
|
|
|
|
|
|
def vim_alarm_audits_initialize():
|
|
"""
|
|
Initialize alarm audits
|
|
"""
|
|
timers.timers_register_interval_timers([_audit_alarms])
|
|
|
|
|
|
def vim_alarm_audits_finalize():
|
|
"""
|
|
Finalize alarm audits
|
|
"""
|
|
pass
|