mirror of
https://github.com/democratic-csi/democratic-csi.git
synced 2026-10-22 12:26:35 +02:00
allow operator management of running fsck before mount during stage, custom mkfs options
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
@@ -482,8 +482,6 @@ class SynologyHttpClient {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
async CreateClonedVolume(src_lun_uuid, dst_lun_name) {
|
||||
const create_cloned_volume = {
|
||||
api: "SYNO.Core.ISCSI.LUN",
|
||||
@@ -493,7 +491,7 @@ class SynologyHttpClient {
|
||||
dst_lun_name: dst_lun_name, // dst lun name
|
||||
is_same_pool: true, // always true? string?
|
||||
clone_type: "democratic-csi", // check
|
||||
}
|
||||
};
|
||||
return await this.do_request("GET", "entry.cgi", create_cloned_volume);
|
||||
}
|
||||
|
||||
@@ -506,11 +504,13 @@ class SynologyHttpClient {
|
||||
snapshot_uuid: JSON.stringify(snapshot_uuid), // shaptop uuid
|
||||
cloned_lun_name: cloned_lun_name, // cloned lun name
|
||||
clone_type: "democratic-csi", // check
|
||||
}
|
||||
return await this.do_request("GET", "entry.cgi", create_volume_from_snapshot);
|
||||
};
|
||||
return await this.do_request(
|
||||
"GET",
|
||||
"entry.cgi",
|
||||
create_volume_from_snapshot
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
module.exports.SynologyHttpClient = SynologyHttpClient;
|
||||
|
||||
@@ -59,7 +59,7 @@ class ControllerSynologyDriver extends CsiBaseDriver {
|
||||
"GET_CAPACITY",
|
||||
"CREATE_DELETE_SNAPSHOT",
|
||||
//"LIST_SNAPSHOTS",
|
||||
//"CLONE_VOLUME",
|
||||
"CLONE_VOLUME",
|
||||
//"PUBLISH_READONLY",
|
||||
"EXPAND_VOLUME",
|
||||
];
|
||||
@@ -478,13 +478,21 @@ class ControllerSynologyDriver extends CsiBaseDriver {
|
||||
// therefore we continue to search for the lun after delete success call to ensure full deletion
|
||||
await httpClient.DeleteLun(lun_uuid);
|
||||
|
||||
let settleEnabled = driver.options.api.lunDelete.settleEnabled;
|
||||
//let settleEnabled = driver.options.api.lunDelete.settleEnabled;
|
||||
let settleEnabled = true;
|
||||
|
||||
if (settleEnabled) {
|
||||
let currentCheck = 0;
|
||||
|
||||
/*
|
||||
let settleMaxRetries =
|
||||
driver.options.api.lunDelete.settleMaxRetries || 6;
|
||||
let settleSeconds = driver.options.api.lunDelete.settleSeconds || 5;
|
||||
*/
|
||||
|
||||
let settleMaxRetries = 6;
|
||||
let settleSeconds = 5;
|
||||
|
||||
let waitTimeBetweenChecks = settleSeconds * 1000;
|
||||
|
||||
await sleep(waitTimeBetweenChecks);
|
||||
|
||||
+37
-4
@@ -1,3 +1,4 @@
|
||||
const _ = require("lodash");
|
||||
const os = require("os");
|
||||
const fs = require("fs");
|
||||
const { GrpcError, grpc } = require("../utils/grpc");
|
||||
@@ -17,7 +18,23 @@ const sleep = require("../utils/general").sleep;
|
||||
class CsiBaseDriver {
|
||||
constructor(ctx, options) {
|
||||
this.ctx = ctx;
|
||||
this.options = options;
|
||||
this.options = options || {};
|
||||
|
||||
if (!this.options.hasOwnProperty("node")) {
|
||||
this.options.node = {};
|
||||
}
|
||||
|
||||
if (!this.options.node.hasOwnProperty("format")) {
|
||||
this.options.node.format = {};
|
||||
}
|
||||
|
||||
if (!this.options.node.hasOwnProperty("mount")) {
|
||||
this.options.node.mount = {};
|
||||
}
|
||||
|
||||
if (!this.options.node.mount.hasOwnProperty("checkFilesystem")) {
|
||||
this.options.node.mount.checkFilesystem = {};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -490,7 +507,15 @@ class CsiBaseDriver {
|
||||
// format
|
||||
result = await filesystem.deviceIsFormatted(device);
|
||||
if (!result) {
|
||||
await filesystem.formatDevice(device, fs_type);
|
||||
let formatOptions = _.get(
|
||||
driver.options.node.format,
|
||||
[fs_type, "customOptions"],
|
||||
[]
|
||||
);
|
||||
if (!Array.isArray(formatOptions)) {
|
||||
formatOptions = [];
|
||||
}
|
||||
await filesystem.formatDevice(device, fs_type, formatOptions);
|
||||
}
|
||||
|
||||
let fs_info = await filesystem.getDeviceFilesystemInfo(device);
|
||||
@@ -502,9 +527,17 @@ class CsiBaseDriver {
|
||||
staging_target_path
|
||||
);
|
||||
if (!result) {
|
||||
// TODO: add a parameter to control this behavior
|
||||
// https://github.com/democratic-csi/democratic-csi/issues/52#issuecomment-768463401
|
||||
//await filesystem.checkFilesystem(device, fs_type);
|
||||
let checkFilesystem =
|
||||
driver.options.node.mount.checkFilesystem[fs_type] || {};
|
||||
if (checkFilesystem.enabled) {
|
||||
await filesystem.checkFilesystem(
|
||||
device,
|
||||
fs_type,
|
||||
checkFilesystem.customOptions || [],
|
||||
checkFilesystem.customFilesystemOptions || []
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user