rename getDiskByConfig to getDiskConfig
Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
parent
8118a31ef6
commit
e8060bf691
4
main.js
4
main.js
@ -7,7 +7,7 @@ const morgan = require("morgan");
|
|||||||
var api = require("./package.json");
|
var api = require("./package.json");
|
||||||
|
|
||||||
const {pveAPIToken, listenPort, domain} = require("./vars.js");
|
const {pveAPIToken, listenPort, domain} = require("./vars.js");
|
||||||
const {checkAuth, requestPVE, handleResponse, getUnusedDiskData, getDiskByConfig} = require("./pveutils.js");
|
const {checkAuth, requestPVE, handleResponse, getUnusedDiskData, getDiskConfig} = require("./pveutils.js");
|
||||||
const {init, requestResources, allocateResources, releaseResources} = require("./db.js");
|
const {init, requestResources, allocateResources, releaseResources} = require("./db.js");
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
@ -88,7 +88,7 @@ app.post("/api/disk/resize", async (req, res) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let diskConfig = await getDiskByConfig(req.body.node, req.body.type, req.body.vmid, req.body.disk);
|
let diskConfig = await getDiskConfig(req.body.node, req.body.type, req.body.vmid, req.body.disk);
|
||||||
if (!diskConfig) {
|
if (!diskConfig) {
|
||||||
res.status(500).send({auth: auth, data:{error: `requested disk ${req.body.disk} does not exist`}});
|
res.status(500).send({auth: auth, data:{error: `requested disk ${req.body.disk} does not exist`}});
|
||||||
}
|
}
|
||||||
|
@ -77,10 +77,10 @@ async function getUnusedDiskData (node, disk) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getDiskByConfig (node, type, vmid, disk) {
|
async function getDiskConfig (node, type, vmid, disk) {
|
||||||
let config = await requestPVE(`/nodes/${node}/${type}/${vmid}/config`, "GET", null, null, pveAPIToken);
|
let config = await requestPVE(`/nodes/${node}/${type}/${vmid}/config`, "GET", null, null, pveAPIToken);
|
||||||
|
|
||||||
return config.data.data[disk];
|
return config.data.data[disk];
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {checkAuth, requestPVE, handleResponse, getUnusedDiskData, getDiskByConfig};
|
module.exports = {checkAuth, requestPVE, handleResponse, getUnusedDiskData, getDiskConfig};
|
Loading…
Reference in New Issue
Block a user