Allow charms to override db_sync timeout
Override neutron db_sync_timeout as its migration process is expensive and prone to timeout in lower end hardware. Change-Id: Idcc09344feb9450383f88f236db1c7ba8db410ad Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
This commit is contained in:
@@ -174,6 +174,7 @@ class NeutronOperatorCharm(sunbeam_charm.OSBaseOperatorAPICharm):
|
||||
"head",
|
||||
]
|
||||
]
|
||||
db_sync_timeout = 480
|
||||
|
||||
def check_configuration(self, event: ops.EventBase):
|
||||
"""Check a configuration key is correct."""
|
||||
|
@@ -631,6 +631,8 @@ class OSBaseOperatorCharm(
|
||||
class OSBaseOperatorCharmK8S(OSBaseOperatorCharm):
|
||||
"""Base charm class for k8s based charms."""
|
||||
|
||||
db_sync_timeout = 300
|
||||
|
||||
def __post_init__(self):
|
||||
"""Post init hook."""
|
||||
super().__post_init__()
|
||||
@@ -810,7 +812,7 @@ class OSBaseOperatorCharmK8S(OSBaseOperatorCharm):
|
||||
container = self.unit.get_container(self.db_sync_container_name)
|
||||
logging.debug("Running sync: \n%s", cmd)
|
||||
try:
|
||||
process = container.exec(cmd, timeout=5 * 60)
|
||||
process = container.exec(cmd, timeout=self.db_sync_timeout)
|
||||
out, err = process.wait_output()
|
||||
except ops.pebble.TimeoutError as e:
|
||||
logger.warning(f"DB Sync command timed out: {e}")
|
||||
|
Reference in New Issue
Block a user