Implement a short wait before removing load files
Load import could fail in slow vbox or hardware if the copying of the large iso file by sysinv api proxy takes longer than the time sysinv conductor imports the load. In this commit, the load import thread in sysinv conductor waits 30 seconds before removing the load files from the staging directory. This gives sysinv api proxy ample amount of time to copy the load files to dc-vault. The wait does not apply to requests not going through the proxy. Sysinv api proxy will be refactored in a future commit to enable copying of load files directly from the import request. Closes-Bug: 1884694 Change-Id: I7ba4af8d32707d3c0977b29c93ab89894bce70cd Signed-off-by: Tee Ngo <Tee.Ngo@windriver.com>
This commit is contained in:
parent
cb7b4757e3
commit
24c88658ca
|
@ -761,6 +761,7 @@ LOAD_ISO = 'path_to_iso'
|
|||
LOAD_SIGNATURE = 'path_to_sig'
|
||||
IMPORT_LOAD_FILES = [LOAD_ISO, LOAD_SIGNATURE]
|
||||
LOAD_FILES_STAGING_DIR = '/scratch/tmp_load'
|
||||
STAGING_LOAD_FILES_REMOVAL_WAIT_TIME = 30
|
||||
|
||||
# Ceph
|
||||
CEPH_HEALTH_OK = 'HEALTH_OK'
|
||||
|
|
|
@ -9156,7 +9156,13 @@ class ConductorManager(service.PeriodicService):
|
|||
raise exception.SysinvException(_(
|
||||
"Failure during sw-patch init-release"))
|
||||
|
||||
# Remove load files in staging dir
|
||||
# TODO(tngo): a less efficient but cleaner solution is to let sysinv
|
||||
# api proxy copy the load files directly from the request as opposed
|
||||
# to relying on load files in sysinv staging directory being there.
|
||||
system = self.dbapi.isystem_get_one()
|
||||
if system.distributed_cloud_role == \
|
||||
constants.DISTRIBUTED_CLOUD_ROLE_SYSTEMCONTROLLER:
|
||||
greenthread.sleep(constants.STAGING_LOAD_FILES_REMOVAL_WAIT_TIME)
|
||||
shutil.rmtree(constants.LOAD_FILES_STAGING_DIR)
|
||||
|
||||
LOG.info("Load import completed.")
|
||||
|
@ -9220,7 +9226,7 @@ class ConductorManager(service.PeriodicService):
|
|||
|
||||
def finalize_delete_load(self, context, sw_version):
|
||||
# Clean up the staging directory in case an error occur during the
|
||||
# import and this directoy did not get cleaned up.
|
||||
# import and this directory did not get cleaned up.
|
||||
if os.path.exists(constants.LOAD_FILES_STAGING_DIR):
|
||||
shutil.rmtree(constants.LOAD_FILES_STAGING_DIR)
|
||||
|
||||
|
|
Loading…
Reference in New Issue