From a7b23615e38467f977532b53de2317e6d3cbaccb Mon Sep 17 00:00:00 2001 From: albailey Date: Wed, 24 Mar 2021 15:09:33 -0500 Subject: [PATCH] Reset alarm timers back to 30 after orch sets them to 2 The alarm audit is set to 2 seconds by an alarm callback. Once that callback has been processed, need to reset the timer back to its default of 30 seconds. Note: Patch orch did not encounter this issue, because its audit called other code after the alarm callback, which reset the timer. Closes-Bug: 1921127 Change-Id: Iba82c71757c0a9e760926e81a42ba91b14196e0e Signed-off-by: albailey --- nfv/nfv-vim/nfv_vim/objects/_fw_update.py | 4 ++++ nfv/nfv-vim/nfv_vim/objects/_kube_upgrade.py | 4 ++++ nfv/nfv-vim/nfv_vim/objects/_sw_patch.py | 3 +++ nfv/nfv-vim/nfv_vim/objects/_sw_upgrade.py | 5 +++++ 4 files changed, 16 insertions(+) diff --git a/nfv/nfv-vim/nfv_vim/objects/_fw_update.py b/nfv/nfv-vim/nfv_vim/objects/_fw_update.py index 34efbe12..2fe87e95 100644 --- a/nfv/nfv-vim/nfv_vim/objects/_fw_update.py +++ b/nfv/nfv-vim/nfv_vim/objects/_fw_update.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 # from nfv_common import debug +from nfv_common import timers from nfv_common.helpers import coroutine @@ -177,6 +178,9 @@ class FwUpdate(SwUpdate): while self._nfvi_audit_inprogress: timer_id = (yield) + # nfvi_alarms_callback sets timer to 2 seconds. reset back to 30 + timers.timers_reschedule_timer(timer_id, 30) + if not self.nfvi_update(): DLOG.info("Audit no longer needed.") break diff --git a/nfv/nfv-vim/nfv_vim/objects/_kube_upgrade.py b/nfv/nfv-vim/nfv_vim/objects/_kube_upgrade.py index 355b1474..8ec589a8 100644 --- a/nfv/nfv-vim/nfv_vim/objects/_kube_upgrade.py +++ b/nfv/nfv-vim/nfv_vim/objects/_kube_upgrade.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 # from nfv_common import debug +from nfv_common import timers from nfv_common.helpers import coroutine @@ -183,6 +184,9 @@ class KubeUpgrade(SwUpdate): while self._nfvi_audit_inprogress: timer_id = (yield) + # nfvi_alarms_callback sets timer to 2 seconds. reset back to 30 + timers.timers_reschedule_timer(timer_id, 30) + if not self.nfvi_update(): DLOG.info("Audit no longer needed.") break diff --git a/nfv/nfv-vim/nfv_vim/objects/_sw_patch.py b/nfv/nfv-vim/nfv_vim/objects/_sw_patch.py index d18ae3cf..fc9ec171 100755 --- a/nfv/nfv-vim/nfv_vim/objects/_sw_patch.py +++ b/nfv/nfv-vim/nfv_vim/objects/_sw_patch.py @@ -202,6 +202,9 @@ class SwPatch(SwUpdate): while self._nfvi_audit_inprogress: timer_id = (yield) + # nfvi_alarms_callback sets timer to 2 seconds + # nfvi_sw_patch_hosts_callback sets it back to 30 + DLOG.info("Audit software patch hosts, timer_id=%s." % timer_id) nfvi.nfvi_sw_mgmt_query_hosts( self.nfvi_sw_patch_hosts_callback(timer_id)) diff --git a/nfv/nfv-vim/nfv_vim/objects/_sw_upgrade.py b/nfv/nfv-vim/nfv_vim/objects/_sw_upgrade.py index 356e350b..015fc595 100755 --- a/nfv/nfv-vim/nfv_vim/objects/_sw_upgrade.py +++ b/nfv/nfv-vim/nfv_vim/objects/_sw_upgrade.py @@ -4,6 +4,8 @@ # SPDX-License-Identifier: Apache-2.0 # from nfv_common import debug +from nfv_common import timers + from nfv_common.helpers import coroutine from nfv_vim import alarm @@ -163,6 +165,9 @@ class SwUpgrade(SwUpdate): while self._nfvi_audit_inprogress: timer_id = (yield) + # nfvi_alarms_callback sets timer to 2 seconds. reset back to 30 + timers.timers_reschedule_timer(timer_id, 30) + if not self.nfvi_update(): DLOG.info("Audit no longer needed.") break