retry func iconfig_update_file when host personality is None
when we run "system dns-modify" command, the command will response after sysinv-db was updated, and file "/etc/resolv.conf" will be updated asynchronously by another process "sysinv-agent". Once the attr "_ihost_personality" of agent is None(initial value), it will not update file "/etc/resolv.conf" and will not inform sysinv client also, which will lead command dns-modify failed silently. This patch will retry function iconfig_update_file by which sysinv-agent update file "/etc/resolv.conf" when attr "_ihost_personality" is None. Closes-bug: 1812269 Change-Id: I3a0437750a53607c04932c1b9b818e83903bb28b Signed-off-by: SidneyAn <ran1.an@intel.com>
This commit is contained in:
parent
d9edf76bf2
commit
53b9e46615
|
@ -1291,6 +1291,12 @@ class AgentManager(service.PeriodicService):
|
|||
fileinput.close()
|
||||
os.rename(temp_platform_conf_file, tsc.PLATFORM_CONF_FILE)
|
||||
|
||||
def _retry_on_personality_is_none(ex):
|
||||
LOG.info('Caught exception. Retrying... Exception: {}'.format(ex))
|
||||
return isinstance(ex, exception.LocalManagementPersonalityNotFound)
|
||||
|
||||
@retrying.retry(wait_fixed=10 * 1000, stop_max_delay=300 * 1000,
|
||||
retry_on_exception=_retry_on_personality_is_none)
|
||||
@utils.synchronized(LOCK_AGENT_ACTION, external=False)
|
||||
def iconfig_update_file(self, context, iconfig_uuid, iconfig_dict):
|
||||
"""Configure the iiconfig_uuid, by updating file based upon
|
||||
|
@ -1314,6 +1320,11 @@ class AgentManager(service.PeriodicService):
|
|||
if not permissions:
|
||||
permissions = constants.CONFIG_FILE_PERMISSION_DEFAULT
|
||||
|
||||
if not self._ihost_personality:
|
||||
raise exception.LocalManagementPersonalityNotFound(
|
||||
config_uuid=iconfig_uuid, config_dict=iconfig_dict,
|
||||
host_personality=self._ihost_personality)
|
||||
|
||||
if self._ihost_personality in iconfig_dict['personalities']:
|
||||
file_content = iconfig_dict['file_content']
|
||||
|
||||
|
|
|
@ -1298,6 +1298,12 @@ class InvalidHelmNamespace(Invalid):
|
|||
message = _("Invalid helm overrides namespace (%(namespace)s) for chart %(chart)s.")
|
||||
|
||||
|
||||
class LocalManagementPersonalityNotFound(NotFound):
|
||||
message = _("Local management personality is None: "
|
||||
"config_uuid=%(config_uuid)s, config_dict=%(config_dict)s, "
|
||||
"host_personality=%(host_personality)s")
|
||||
|
||||
|
||||
class LocalManagementIpNotFound(NotFound):
|
||||
message = _("Local management IP not found: "
|
||||
"config_uuid=%(config_uuid)s, config_dict=%(config_dict)s, "
|
||||
|
|
Loading…
Reference in New Issue