better delete race-condition handling, resize capacity for zvols
This commit is contained in:
parent
8cde1a1979
commit
001301d53e
|
|
@ -1012,7 +1012,11 @@ class ControllerZfsSshBaseDriver extends CsiBaseDriver {
|
||||||
await this.expandVolume(call, datasetName);
|
await this.expandVolume(call, datasetName);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
capacity_bytes: this.options.zfs.datasetEnableQuotas ? capacity_bytes : 0,
|
capacity_bytes:
|
||||||
|
this.options.zfs.datasetEnableQuotas ||
|
||||||
|
driverZfsResourceType == "volume"
|
||||||
|
? capacity_bytes
|
||||||
|
: 0,
|
||||||
node_expansion_required: driverZfsResourceType == "volume" ? true : false,
|
node_expansion_required: driverZfsResourceType == "volume" ? true : false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1066,12 +1066,9 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
|
||||||
|
|
||||||
shareId = properties[FREENAS_NFS_SHARE_PROPERTY_NAME].value;
|
shareId = properties[FREENAS_NFS_SHARE_PROPERTY_NAME].value;
|
||||||
|
|
||||||
|
// only remove if the process has not succeeded already
|
||||||
|
if (zb.helpers.isPropertyValueSet(shareId)) {
|
||||||
// remove nfs share
|
// remove nfs share
|
||||||
if (
|
|
||||||
properties &&
|
|
||||||
properties[FREENAS_NFS_SHARE_PROPERTY_NAME] &&
|
|
||||||
properties[FREENAS_NFS_SHARE_PROPERTY_NAME].value != "-"
|
|
||||||
) {
|
|
||||||
switch (apiVersion) {
|
switch (apiVersion) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
|
|
@ -1113,6 +1110,13 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
|
||||||
} body: ${JSON.stringify(response.body)}`
|
} body: ${JSON.stringify(response.body)}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove property to prevent delete race conditions
|
||||||
|
// due to id re-use by FreeNAS/TrueNAS
|
||||||
|
await zb.zfs.inherit(
|
||||||
|
datasetName,
|
||||||
|
FREENAS_NFS_SHARE_PROPERTY_NAME
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1141,12 +1145,9 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
|
||||||
|
|
||||||
shareId = properties[FREENAS_SMB_SHARE_PROPERTY_NAME].value;
|
shareId = properties[FREENAS_SMB_SHARE_PROPERTY_NAME].value;
|
||||||
|
|
||||||
|
// only remove if the process has not succeeded already
|
||||||
|
if (zb.helpers.isPropertyValueSet(shareId)) {
|
||||||
// remove smb share
|
// remove smb share
|
||||||
if (
|
|
||||||
properties &&
|
|
||||||
properties[FREENAS_SMB_SHARE_PROPERTY_NAME] &&
|
|
||||||
properties[FREENAS_SMB_SHARE_PROPERTY_NAME].value != "-"
|
|
||||||
) {
|
|
||||||
switch (apiVersion) {
|
switch (apiVersion) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
|
|
@ -1191,6 +1192,13 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
|
||||||
} body: ${JSON.stringify(response.body)}`
|
} body: ${JSON.stringify(response.body)}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove property to prevent delete race conditions
|
||||||
|
// due to id re-use by FreeNAS/TrueNAS
|
||||||
|
await zb.zfs.inherit(
|
||||||
|
datasetName,
|
||||||
|
FREENAS_SMB_SHARE_PROPERTY_NAME
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1233,6 +1241,8 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
|
||||||
switch (apiVersion) {
|
switch (apiVersion) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
|
// only remove if the process has not succeeded already
|
||||||
|
if (zb.helpers.isPropertyValueSet(targetId)) {
|
||||||
// https://jira.ixsystems.com/browse/NAS-103952
|
// https://jira.ixsystems.com/browse/NAS-103952
|
||||||
|
|
||||||
// v1 - /services/iscsi/target/{id}/
|
// v1 - /services/iscsi/target/{id}/
|
||||||
|
|
@ -1280,6 +1290,13 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
|
||||||
} body: ${JSON.stringify(response.body)}`
|
} body: ${JSON.stringify(response.body)}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove property to prevent delete race conditions
|
||||||
|
// due to id re-use by FreeNAS/TrueNAS
|
||||||
|
await zb.zfs.inherit(
|
||||||
|
datasetName,
|
||||||
|
FREENAS_ISCSI_TARGET_ID_PROPERTY_NAME
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
this.ctx.logger.debug(
|
this.ctx.logger.debug(
|
||||||
"not deleting iscsitarget asset as it appears ID %s has been re-used: zfs name - %s, iscsitarget name - %s",
|
"not deleting iscsitarget asset as it appears ID %s has been re-used: zfs name - %s, iscsitarget name - %s",
|
||||||
|
|
@ -1289,7 +1306,10 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// only remove if the process has not succeeded already
|
||||||
|
if (zb.helpers.isPropertyValueSet(extentId)) {
|
||||||
// v1 - /services/iscsi/targettoextent/{id}/
|
// v1 - /services/iscsi/targettoextent/{id}/
|
||||||
// v2 - /iscsi/targetextent/id/{id}
|
// v2 - /iscsi/targetextent/id/{id}
|
||||||
if (apiVersion == 1) {
|
if (apiVersion == 1) {
|
||||||
|
|
@ -1332,6 +1352,13 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
|
||||||
} body: ${JSON.stringify(response.body)}`
|
} body: ${JSON.stringify(response.body)}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// remove property to prevent delete race conditions
|
||||||
|
// due to id re-use by FreeNAS/TrueNAS
|
||||||
|
await zb.zfs.inherit(
|
||||||
|
datasetName,
|
||||||
|
FREENAS_ISCSI_EXTENT_ID_PROPERTY_NAME
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
this.ctx.logger.debug(
|
this.ctx.logger.debug(
|
||||||
"not deleting iscsiextent asset as it appears ID %s has been re-used: zfs name - %s, iscsiextent name - %s",
|
"not deleting iscsiextent asset as it appears ID %s has been re-used: zfs name - %s, iscsiextent name - %s",
|
||||||
|
|
@ -1341,6 +1368,7 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new GrpcError(
|
throw new GrpcError(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue