fix lun delete issues

Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
Travis Glenn Hansen 2021-07-26 21:19:13 -06:00
parent 5c27e3296d
commit f849cfae09
2 changed files with 14 additions and 23 deletions

View File

@ -315,6 +315,7 @@ class SynologyHttpClient {
method: "map_target", method: "map_target",
version: "1", version: "1",
}); });
iscsi_target_map.uuid = JSON.stringify(iscsi_target_map.uuid);
iscsi_target_map.target_ids = JSON.stringify(iscsi_target_map.target_ids); iscsi_target_map.target_ids = JSON.stringify(iscsi_target_map.target_ids);
// this is mapping from the perspective of the target // this is mapping from the perspective of the target
@ -337,25 +338,14 @@ class SynologyHttpClient {
method: "delete", method: "delete",
version: 1, version: 1,
//uuid: uuid, //uuid: uuid,
uuid: "", uuid: JSON.stringify(""),
uuids: JSON.stringify([uuid]), uuids: JSON.stringify([uuid]),
//is_soft_feas_ignored: false, //is_soft_feas_ignored: false,
is_soft_feas_ignored: true, is_soft_feas_ignored: true,
//feasibility_precheck: true,
}; };
await this.do_request("GET", "entry.cgi", iscsi_lun_delete); await this.do_request("GET", "entry.cgi", iscsi_lun_delete);
// } catch (err) {
// /**
// * 18990710 = already gone
// * LUN_BAD_LUN_UUID = 18990505
// * LUN_NO_SUCH_SNAPSHOT = 18990532
// *//*
// if (![18990505].includes(err.body.error.code)) {
// throw err;
// }
// }
// */
} }
async CreateSnapshot(data) { async CreateSnapshot(data) {

View File

@ -25,6 +25,8 @@ class ControllerSynologyDriver extends CsiBaseDriver {
options.service.node.capabilities = options.service.node.capabilities || {}; options.service.node.capabilities = options.service.node.capabilities || {};
const driverResourceType = this.getDriverResourceType();
if (!("service" in options.service.identity.capabilities)) { if (!("service" in options.service.identity.capabilities)) {
this.ctx.logger.debug("setting default identity service caps"); this.ctx.logger.debug("setting default identity service caps");
@ -69,8 +71,12 @@ class ControllerSynologyDriver extends CsiBaseDriver {
//"UNKNOWN", //"UNKNOWN",
"STAGE_UNSTAGE_VOLUME", "STAGE_UNSTAGE_VOLUME",
"GET_VOLUME_STATS", "GET_VOLUME_STATS",
"EXPAND_VOLUME", //"EXPAND_VOLUME",
]; ];
if (driverResourceType == "volume") {
options.service.node.capabilities.rpc.push("EXPAND_VOLUME");
}
} }
} }
@ -277,7 +283,7 @@ class ControllerSynologyDriver extends CsiBaseDriver {
// create lun // create lun
data = Object.assign({}, driver.options.iscsi.lunAttributes, { data = Object.assign({}, driver.options.iscsi.lunAttributes, {
name: iscsiName, name: iscsiName,
location: driver.options.synology.location, location: driver.options.synology.volume,
size: capacity_bytes, size: capacity_bytes,
}); });
let lun_uuid = await httpClient.CreateLun(data); let lun_uuid = await httpClient.CreateLun(data);
@ -525,18 +531,13 @@ class ControllerSynologyDriver extends CsiBaseDriver {
* @param {*} call * @param {*} call
*/ */
async GetCapacity(call) { async GetCapacity(call) {
// throw new GrpcError(
// grpc.status.UNIMPLEMENTED,
// `operation not supported by driver`
// );
const driver = this; const driver = this;
const httpClient = await driver.getHttpClient(); const httpClient = await driver.getHttpClient();
if (!driver.options.synology.location) { if (!driver.options.synology.volume) {
throw new GrpcError( throw new GrpcError(
grpc.status.FAILED_PRECONDITION, grpc.status.FAILED_PRECONDITION,
`invalid configuration: missing location` `invalid configuration: missing volume`
); );
} }
@ -549,7 +550,7 @@ class ControllerSynologyDriver extends CsiBaseDriver {
} }
let response = await httpClient.GetVolumeInfo( let response = await httpClient.GetVolumeInfo(
driver.options.synology.location driver.options.synology.volume
); );
return { available_capacity: response.body.data.volume.size_free_byte }; return { available_capacity: response.body.data.volume.size_free_byte };
} }