fix issue in swap handling in /instance/resources
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
f43e9e50d7
commit
478a25c9e0
8
main.js
8
main.js
@ -466,7 +466,7 @@ app.post("/api/instance/resources", async (req, res) => {
|
||||
cores: Number(req.body.cores) - Number(currentConfig.data.data.cores),
|
||||
memory: Number(req.body.memory) - Number(currentConfig.data.data.memory)
|
||||
};
|
||||
if (type === "lxc") {
|
||||
if (req.body.type === "lxc") {
|
||||
request.swap = Number(req.body.swap) - Number(currentConfig.data.data.swap);
|
||||
}
|
||||
// check resource approval
|
||||
@ -476,7 +476,11 @@ app.post("/api/instance/resources", async (req, res) => {
|
||||
return;
|
||||
}
|
||||
// setup action
|
||||
let action = JSON.stringify({ cores: req.body.cores, memory: req.body.memory });
|
||||
let action = { cores: req.body.cores, memory: req.body.memory };
|
||||
if (req.body.type === "lxc") {
|
||||
action.swap = Number(req.body.swap);
|
||||
}
|
||||
action = JSON.stringify(action);
|
||||
let method = req.body.type === "qemu" ? "POST" : "PUT";
|
||||
// commit action
|
||||
let result = await requestPVE(`${vmpath}/config`, method, req.cookies, action, pveAPIToken);
|
||||
|
Loading…
Reference in New Issue
Block a user