rename getDiskByConfig to getDiskConfig

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-02-28 23:33:00 +00:00
parent 2b311cd1f1
commit 1e4b72cb8b
2 changed files with 4 additions and 4 deletions

View File

@ -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`}});
} }

View File

@ -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};