Merge 6c6e18a246 into 8193b689ed
This commit is contained in:
commit
21df8c5164
|
|
@ -170,14 +170,31 @@ class ControllerZfsBaseDriver extends CsiBaseDriver {
|
|||
return zb.options.paths.sudo || "/usr/bin/sudo";
|
||||
}
|
||||
|
||||
getDatasetParentName() {
|
||||
let datasetParentName = this.options.zfs.datasetParentName;
|
||||
getDatasetParentName(call = null) {
|
||||
let datasetParentName;
|
||||
|
||||
// First check if datasetParentName is provided in storage class parameters
|
||||
if (call && call.request && call.request.parameters) {
|
||||
const paramDatasetParentName = this.getNormalizedParameterValue(
|
||||
call.request.parameters,
|
||||
"datasetParentName"
|
||||
);
|
||||
if (paramDatasetParentName) {
|
||||
datasetParentName = paramDatasetParentName;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to configuration option
|
||||
if (!datasetParentName) {
|
||||
datasetParentName = this.options.zfs.datasetParentName;
|
||||
}
|
||||
|
||||
datasetParentName = datasetParentName.replace(/\/$/, "");
|
||||
return datasetParentName;
|
||||
}
|
||||
|
||||
getVolumeParentDatasetName() {
|
||||
let datasetParentName = this.getDatasetParentName();
|
||||
getVolumeParentDatasetName(call = null) {
|
||||
let datasetParentName = this.getDatasetParentName(call);
|
||||
//datasetParentName += "/v";
|
||||
datasetParentName = datasetParentName.replace(/\/$/, "");
|
||||
return datasetParentName;
|
||||
|
|
@ -640,7 +657,7 @@ class ControllerZfsBaseDriver extends CsiBaseDriver {
|
|||
const execClient = this.getExecClient();
|
||||
const zb = await this.getZetabyte();
|
||||
|
||||
let datasetParentName = this.getVolumeParentDatasetName();
|
||||
let datasetParentName = this.getVolumeParentDatasetName(call);
|
||||
let snapshotParentDatasetName = this.getDetachedSnapshotParentDatasetName();
|
||||
let zvolBlocksize = this.options.zfs.zvolBlocksize || "16K";
|
||||
let name = call.request.name;
|
||||
|
|
@ -1273,7 +1290,7 @@ class ControllerZfsBaseDriver extends CsiBaseDriver {
|
|||
const driver = this;
|
||||
const zb = await this.getZetabyte();
|
||||
|
||||
let datasetParentName = this.getVolumeParentDatasetName();
|
||||
let datasetParentName = this.getVolumeParentDatasetName(call);
|
||||
let name = call.request.volume_id;
|
||||
|
||||
if (!datasetParentName) {
|
||||
|
|
@ -1406,7 +1423,7 @@ class ControllerZfsBaseDriver extends CsiBaseDriver {
|
|||
const driverZfsResourceType = this.getDriverZfsResourceType();
|
||||
const zb = await this.getZetabyte();
|
||||
|
||||
let datasetParentName = this.getVolumeParentDatasetName();
|
||||
let datasetParentName = this.getVolumeParentDatasetName(call);
|
||||
let name = call.request.volume_id;
|
||||
|
||||
if (!datasetParentName) {
|
||||
|
|
@ -1574,7 +1591,7 @@ class ControllerZfsBaseDriver extends CsiBaseDriver {
|
|||
const driverZfsResourceType = this.getDriverZfsResourceType();
|
||||
const zb = await this.getZetabyte();
|
||||
|
||||
let datasetParentName = this.getVolumeParentDatasetName();
|
||||
let datasetParentName = this.getVolumeParentDatasetName(call);
|
||||
let response;
|
||||
let name = call.request.volume_id;
|
||||
|
||||
|
|
@ -1655,7 +1672,7 @@ class ControllerZfsBaseDriver extends CsiBaseDriver {
|
|||
const driverZfsResourceType = this.getDriverZfsResourceType();
|
||||
const zb = await this.getZetabyte();
|
||||
|
||||
let datasetParentName = this.getVolumeParentDatasetName();
|
||||
let datasetParentName = this.getVolumeParentDatasetName(call);
|
||||
let entries = [];
|
||||
let entries_length = 0;
|
||||
let next_token;
|
||||
|
|
@ -2077,7 +2094,7 @@ class ControllerZfsBaseDriver extends CsiBaseDriver {
|
|||
types.push("volume");
|
||||
}
|
||||
} else {
|
||||
datasetParentName = this.getVolumeParentDatasetName();
|
||||
datasetParentName = this.getVolumeParentDatasetName(call);
|
||||
types.push("snapshot");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1994,14 +1994,31 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
|||
}
|
||||
}
|
||||
|
||||
getDatasetParentName() {
|
||||
let datasetParentName = this.options.zfs.datasetParentName;
|
||||
getDatasetParentName(call = null) {
|
||||
let datasetParentName;
|
||||
|
||||
// First check if datasetParentName is provided in storage class parameters
|
||||
if (call && call.request && call.request.parameters) {
|
||||
const paramDatasetParentName = this.getNormalizedParameterValue(
|
||||
call.request.parameters,
|
||||
"datasetParentName"
|
||||
);
|
||||
if (paramDatasetParentName) {
|
||||
datasetParentName = paramDatasetParentName;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to configuration option
|
||||
if (!datasetParentName) {
|
||||
datasetParentName = this.options.zfs.datasetParentName;
|
||||
}
|
||||
|
||||
datasetParentName = datasetParentName.replace(/\/$/, "");
|
||||
return datasetParentName;
|
||||
}
|
||||
|
||||
getVolumeParentDatasetName() {
|
||||
let datasetParentName = this.getDatasetParentName();
|
||||
getVolumeParentDatasetName(call = null) {
|
||||
let datasetParentName = this.getDatasetParentName(call);
|
||||
//datasetParentName += "/v";
|
||||
datasetParentName = datasetParentName.replace(/\/$/, "");
|
||||
return datasetParentName;
|
||||
|
|
@ -2234,7 +2251,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
|||
const httpApiClient = await this.getTrueNASHttpApiClient();
|
||||
const zb = await this.getZetabyte();
|
||||
|
||||
let datasetParentName = this.getVolumeParentDatasetName();
|
||||
let datasetParentName = this.getVolumeParentDatasetName(call);
|
||||
let snapshotParentDatasetName = this.getDetachedSnapshotParentDatasetName();
|
||||
let zvolBlocksize = this.options.zfs.zvolBlocksize || "16K";
|
||||
let name = call.request.name;
|
||||
|
|
@ -3005,7 +3022,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
|||
const httpApiClient = await this.getTrueNASHttpApiClient();
|
||||
const zb = await this.getZetabyte();
|
||||
|
||||
let datasetParentName = this.getVolumeParentDatasetName();
|
||||
let datasetParentName = this.getVolumeParentDatasetName(call);
|
||||
let name = call.request.volume_id;
|
||||
|
||||
if (!datasetParentName) {
|
||||
|
|
@ -3259,7 +3276,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
|||
const httpApiClient = await this.getTrueNASHttpApiClient();
|
||||
const zb = await this.getZetabyte();
|
||||
|
||||
let datasetParentName = this.getVolumeParentDatasetName();
|
||||
let datasetParentName = this.getVolumeParentDatasetName(call);
|
||||
|
||||
if (!datasetParentName) {
|
||||
throw new GrpcError(
|
||||
|
|
@ -3308,7 +3325,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
|||
const httpApiClient = await this.getTrueNASHttpApiClient();
|
||||
const zb = await this.getZetabyte();
|
||||
|
||||
let datasetParentName = this.getVolumeParentDatasetName();
|
||||
let datasetParentName = this.getVolumeParentDatasetName(call);
|
||||
let response;
|
||||
let name = call.request.volume_id;
|
||||
|
||||
|
|
@ -3383,7 +3400,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
|||
const httpApiClient = await this.getTrueNASHttpApiClient();
|
||||
const zb = await this.getZetabyte();
|
||||
|
||||
let datasetParentName = this.getVolumeParentDatasetName();
|
||||
let datasetParentName = this.getVolumeParentDatasetName(call);
|
||||
let entries = [];
|
||||
let entries_length = 0;
|
||||
let next_token;
|
||||
|
|
@ -4426,7 +4443,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
|||
throw new GrpcError(grpc.status.INVALID_ARGUMENT, `missing capabilities`);
|
||||
}
|
||||
|
||||
let datasetParentName = this.getVolumeParentDatasetName();
|
||||
let datasetParentName = this.getVolumeParentDatasetName(call);
|
||||
let name = volume_id;
|
||||
|
||||
if (!datasetParentName) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue