check storage on disk create only when disk is not ide
This commit is contained in:
parent
5014e1d10c
commit
7719911d5a
@ -409,6 +409,7 @@ app.delete("/api/instance/disk/delete", async (req, res) => {
|
||||
* - disk: String - disk id (sata0, ide0)
|
||||
* - storage: String - storage to hold disk
|
||||
* - size: Number - size of disk in GiB
|
||||
* - iso: String - file name to mount as cdrom
|
||||
* responses:
|
||||
* - 200: PVE Task Object
|
||||
* - 401: {auth: false, path: String}
|
||||
@ -431,14 +432,14 @@ app.post("/api/instance/disk/create", async (req, res) => {
|
||||
// setup request
|
||||
let request = {};
|
||||
if (!req.body.disk.includes("ide")) {
|
||||
request[req.body.storage] = Number(req.body.size * 1024 ** 3); // setup request object
|
||||
// setup request
|
||||
request[req.body.storage] = Number(req.body.size * 1024 ** 3);
|
||||
// check request approval
|
||||
if (!await approveResources(req, req.cookies.username, request)) {
|
||||
res.status(500).send({ request: request, error: `Storage ${req.body.storage} could not fulfill request of size ${req.body.size}G.` });
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// target disk must be allowed according to storage options
|
||||
let resourceConfig = db.getResourceConfig();
|
||||
if (!resourceConfig[req.body.storage].disks.some(diskPrefix => req.body.disk.startsWith(diskPrefix))) {
|
||||
@ -446,6 +447,7 @@ app.post("/api/instance/disk/create", async (req, res) => {
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// setup action
|
||||
let action = {};
|
||||
if (req.body.disk.includes("ide") && req.body.iso) {
|
||||
|
Loading…
Reference in New Issue
Block a user