add error handling in vm-isos and ct-templates when configured node is unreachable,
update disk attach logic for new fabric changes
This commit is contained in:
@@ -97,7 +97,7 @@ router.post("/:disk/attach", async (req, res) => {
|
|||||||
}
|
}
|
||||||
// setup action using source disk info from vm config
|
// setup action using source disk info from vm config
|
||||||
const action = {};
|
const action = {};
|
||||||
action[params.disk] = disk.volid;
|
action[params.disk] = disk.file;
|
||||||
const method = params.type === "qemu" ? "POST" : "PUT";
|
const method = params.type === "qemu" ? "POST" : "PUT";
|
||||||
|
|
||||||
// commit action
|
// commit action
|
||||||
|
@@ -73,7 +73,12 @@ router.get("/vm-isos", async (req, res) => {
|
|||||||
// get user iso config
|
// get user iso config
|
||||||
const userIsoConfig = config.useriso;
|
const userIsoConfig = config.useriso;
|
||||||
// get all isos
|
// get all isos
|
||||||
const isos = (await global.pve.requestPVE(`/nodes/${userIsoConfig.node}/storage/${userIsoConfig.storage}/content?content=iso`, "GET", { token: true })).data.data;
|
const content = await global.pve.requestPVE(`/nodes/${userIsoConfig.node}/storage/${userIsoConfig.storage}/content?content=iso`, "GET", { token: true })
|
||||||
|
if (content.status !== 200) {
|
||||||
|
res.status(content.status).send({error: content.statusText})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const isos = content.data.data;
|
||||||
const userIsos = [];
|
const userIsos = [];
|
||||||
isos.forEach((iso) => {
|
isos.forEach((iso) => {
|
||||||
iso.name = iso.volid.replace(`${userIsoConfig.storage}:iso/`, "");
|
iso.name = iso.volid.replace(`${userIsoConfig.storage}:iso/`, "");
|
||||||
@@ -98,7 +103,12 @@ router.get("/ct-templates", async (req, res) => {
|
|||||||
// get user iso config
|
// get user iso config
|
||||||
const userIsoConfig = config.useriso;
|
const userIsoConfig = config.useriso;
|
||||||
// get all isos
|
// get all isos
|
||||||
const isos = (await global.pve.requestPVE(`/nodes/${userIsoConfig.node}/storage/${userIsoConfig.storage}/content?content=vztmpl`, "GET", { token: true })).data.data;
|
const content = await global.pve.requestPVE(`/nodes/${userIsoConfig.node}/storage/${userIsoConfig.storage}/content?content=iso`, "GET", { token: true })
|
||||||
|
if (content.status !== 200) {
|
||||||
|
res.status(content.status).send({error: content.statusText})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const isos = content.data.data;
|
||||||
const userIsos = [];
|
const userIsos = [];
|
||||||
isos.forEach((iso) => {
|
isos.forEach((iso) => {
|
||||||
iso.name = iso.volid.replace(`${userIsoConfig.storage}:vztmpl/`, "");
|
iso.name = iso.volid.replace(`${userIsoConfig.storage}:vztmpl/`, "");
|
||||||
|
Reference in New Issue
Block a user