Merge "Load-import failed due to lack of space in /scratch"

This commit is contained in:
Zuul 2023-11-01 16:15:52 +00:00 committed by Gerrit Code Review
commit bac49b1840
2 changed files with 11 additions and 6 deletions

View File

@ -586,9 +586,9 @@ class SysinvAPIController(APIController):
os.path.basename(src_filepath)) os.path.basename(src_filepath))
shutil.copyfile(src_filepath, load_file_path) shutil.copyfile(src_filepath, load_file_path)
LOG.info("copied %s to %s" % (src_filepath, load_file_path)) LOG.info("copied %s to %s" % (src_filepath, load_file_path))
except Exception: except Exception as e:
msg = _("Failed to store load in vault. Please check " msg = _("Failed to store load in vault. Please check "
"dcorch log for details.") "dcorch log for more details: %s" % e)
raise webob.exc.HTTPInsufficientStorage(explanation=msg) raise webob.exc.HTTPInsufficientStorage(explanation=msg)
return load_file_path return load_file_path
@ -715,8 +715,8 @@ class SysinvAPIController(APIController):
error = False error = False
except webob.exc.HTTPInternalServerError: except webob.exc.HTTPInternalServerError:
raise raise
except Exception: except Exception as e:
msg = _("Unexpected error copying load to vault") msg = _("Unexpected error copying load to vault: %s" % e)
raise webob.exc.HTTPInternalServerError(explanation=msg) raise webob.exc.HTTPInternalServerError(explanation=msg)
finally: finally:
if error and os.path.exists(proxy_consts.LOAD_FILES_STAGING_DIR): if error and os.path.exists(proxy_consts.LOAD_FILES_STAGING_DIR):

View File

@ -74,8 +74,13 @@ class ApiFiller(Middleware):
# 1 time on internal temporary copy to be shared with sysinv # 1 time on internal temporary copy to be shared with sysinv
if not utils.is_space_available("/scratch", if not utils.is_space_available("/scratch",
3 * req.content_length): 3 * req.content_length):
msg = _("Insufficient space on /scratch for request %s" msg = _(
% req.path) "Insufficient space on /scratch for request %s, "
"/scratch must have at least %d bytes of free space. "
"You can delete unused files from /scratch or increase the size of it "
"with: 'system host-fs-modify <hostname> scratch=<new_size_in_GiB>'"
) % (req.path, 3 * req.content_length)
raise webob.exc.HTTPInternalServerError(explanation=msg) raise webob.exc.HTTPInternalServerError(explanation=msg)
if ('HTTP_USER_HEADER' in req.environ and if ('HTTP_USER_HEADER' in req.environ and