1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-09 19:56:48 +00:00

fix(logs): failures name their job, VM and user; the new VM form shows a list it could not load

- A failed cancel hook logged "worker task cancel failed": it now names
  the job, its kind, resource and user, with the traceback for a fault
  of the panel.
- novncd logged "Console connection failed" without the VM or the user.
- django-axes wrote four INFO lines a login ("Reset 0 access
  attempts"...); logins are on the Logs page, so it logs warnings only.
- The new VM form's machine types and disk buses answered 200 with an
  empty object when libvirt failed, and nothing was logged: the list
  stayed empty, the form could not go on and said nothing. They answer
  400 with the error, as the pool's volume list does, the warning is
  logged with the compute, and the form's lists show an error they get
  with the page's messages.
This commit is contained in:
catborise 2026-11-06 23:14:08 +03:00
parent 432b1505b3
commit 6abea495f1
14 changed files with 155 additions and 40 deletions

View file

@ -148,7 +148,7 @@ function volumes_url(pool) {
// older one: an answer for the previous choice never fills it.
function load_list(list, url, fill) {
if (list.request) list.request.abort();
list.request = $.getJSON(url, fill);
list.request = $.getJSON(url, fill).fail(showLoadError);
return list.request;
}

View file

@ -13,7 +13,7 @@ function load_machines(arch) {
list.replaceChildren(...data['machines'].map(
item => new Option(item, item, false, item === list.dataset.default)));
next.disabled = !data['machines'].length;
});
}).fail(showLoadError);
}
// placeholders, not "x86_64"/"pc": an architecture such as ppc64 contains "pc"

View file

@ -18,3 +18,16 @@ function focusFirstError() {
}
window.focusFirstError = focusFirstError;
if (document.body.dataset.errorFocus !== "manual") focusFirstError();
// A list a page loads (jQuery) that the server could not give: its error goes
// with the page's messages. A load a newer one aborted has none.
function showLoadError(xhr) {
const text = (xhr.responseJSON || {}).error;
if (!text) return;
const alert = document.createElement("div");
alert.className = "alert alert-danger";
alert.setAttribute("role", "alert");
alert.textContent = text;
document.querySelector("#messages").append(alert);
}
window.showLoadError = showLoadError;