more robust volume deletion logic for luns
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
parent
f849cfae09
commit
f42ae49098
|
|
@ -348,6 +348,19 @@ class SynologyHttpClient {
|
||||||
await this.do_request("GET", "entry.cgi", iscsi_lun_delete);
|
await this.do_request("GET", "entry.cgi", iscsi_lun_delete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async DeleteAllLuns() {
|
||||||
|
const lun_list = {
|
||||||
|
api: "SYNO.Core.ISCSI.LUN",
|
||||||
|
version: "1",
|
||||||
|
method: "list",
|
||||||
|
};
|
||||||
|
|
||||||
|
let response = await this.do_request("GET", "entry.cgi", lun_list);
|
||||||
|
for (let lun of response.body.data.luns) {
|
||||||
|
await this.DeleteLun(lun.uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async CreateSnapshot(data) {
|
async CreateSnapshot(data) {
|
||||||
data = Object.assign({}, data, {
|
data = Object.assign({}, data, {
|
||||||
api: "SYNO.Core.ISCSI.LUN",
|
api: "SYNO.Core.ISCSI.LUN",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
const { CsiBaseDriver } = require("../index");
|
const { CsiBaseDriver } = require("../index");
|
||||||
const { GrpcError, grpc } = require("../../utils/grpc");
|
const { GrpcError, grpc } = require("../../utils/grpc");
|
||||||
const SynologyHttpClient = require("./http").SynologyHttpClient;
|
const SynologyHttpClient = require("./http").SynologyHttpClient;
|
||||||
|
const sleep = require("../../utils/general").sleep;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -420,7 +421,29 @@ class ControllerSynologyDriver extends CsiBaseDriver {
|
||||||
|
|
||||||
let lun_uuid = await httpClient.GetLunUUIDByName(iscsiName);
|
let lun_uuid = await httpClient.GetLunUUIDByName(iscsiName);
|
||||||
if (lun_uuid) {
|
if (lun_uuid) {
|
||||||
|
// this is an async process where a success is returned but delete is happening still behind the scenes
|
||||||
|
// therefore we continue to search for the lun after delete success call to ensure full deletion
|
||||||
await httpClient.DeleteLun(lun_uuid);
|
await httpClient.DeleteLun(lun_uuid);
|
||||||
|
|
||||||
|
let currentCheck = 0;
|
||||||
|
let maxChecks = 6;
|
||||||
|
let waitTimeBetweenChecks = 5 * 1000;
|
||||||
|
|
||||||
|
await sleep(waitTimeBetweenChecks);
|
||||||
|
lun_uuid = await httpClient.GetLunUUIDByName(iscsiName);
|
||||||
|
|
||||||
|
while (currentCheck <= maxChecks && lun_uuid) {
|
||||||
|
currentCheck++;
|
||||||
|
await sleep(waitTimeBetweenChecks);
|
||||||
|
lun_uuid = await httpClient.GetLunUUIDByName(iscsiName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lun_uuid) {
|
||||||
|
throw new GrpcError(
|
||||||
|
grpc.status.UNKNOWN,
|
||||||
|
`failed to remove lun: ${lun_uuid}`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue