logs: use context logger in freenas-api drivers
This commit is contained in:
parent
f36ea774f4
commit
eb2b357fb7
|
|
@ -174,7 +174,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
*
|
*
|
||||||
* @param {*} datasetName
|
* @param {*} datasetName
|
||||||
*/
|
*/
|
||||||
async createShare(call, datasetName) {
|
async createShare(callContext, call, datasetName) {
|
||||||
const driver = this;
|
const driver = this;
|
||||||
const driverShareType = this.getDriverShareType();
|
const driverShareType = this.getDriverShareType();
|
||||||
const httpClient = await this.getHttpClient();
|
const httpClient = await this.getHttpClient();
|
||||||
|
|
@ -207,7 +207,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
"mountpoint",
|
"mountpoint",
|
||||||
FREENAS_NFS_SHARE_PROPERTY_NAME,
|
FREENAS_NFS_SHARE_PROPERTY_NAME,
|
||||||
]);
|
]);
|
||||||
this.ctx.logger.debug("zfs props data: %j", properties);
|
callContext.logger.debug("zfs props data: %j", properties);
|
||||||
|
|
||||||
// create nfs share
|
// create nfs share
|
||||||
if (
|
if (
|
||||||
|
|
@ -419,7 +419,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
"mountpoint",
|
"mountpoint",
|
||||||
FREENAS_SMB_SHARE_PROPERTY_NAME,
|
FREENAS_SMB_SHARE_PROPERTY_NAME,
|
||||||
]);
|
]);
|
||||||
this.ctx.logger.debug("zfs props data: %j", properties);
|
callContext.logger.debug("zfs props data: %j", properties);
|
||||||
|
|
||||||
let smbName;
|
let smbName;
|
||||||
|
|
||||||
|
|
@ -442,7 +442,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
|
|
||||||
smbName = smbName.toLowerCase();
|
smbName = smbName.toLowerCase();
|
||||||
|
|
||||||
this.ctx.logger.info(
|
callContext.logger.info(
|
||||||
"FreeNAS creating smb share with name: " + smbName
|
"FreeNAS creating smb share with name: " + smbName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -668,7 +668,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
FREENAS_ISCSI_EXTENT_ID_PROPERTY_NAME,
|
FREENAS_ISCSI_EXTENT_ID_PROPERTY_NAME,
|
||||||
FREENAS_ISCSI_TARGETTOEXTENT_ID_PROPERTY_NAME,
|
FREENAS_ISCSI_TARGETTOEXTENT_ID_PROPERTY_NAME,
|
||||||
]);
|
]);
|
||||||
this.ctx.logger.debug("zfs props data: %j", properties);
|
callContext.logger.debug("zfs props data: %j", properties);
|
||||||
|
|
||||||
let basename;
|
let basename;
|
||||||
let iscsiName;
|
let iscsiName;
|
||||||
|
|
@ -698,7 +698,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
|
|
||||||
let extentDiskName = "zvol/" + datasetName;
|
let extentDiskName = "zvol/" + datasetName;
|
||||||
let maxZvolNameLength = await driver.getMaxZvolNameLength();
|
let maxZvolNameLength = await driver.getMaxZvolNameLength();
|
||||||
driver.ctx.logger.debug("max zvol name length: %s", maxZvolNameLength);
|
callContext.logger.debug("max zvol name length: %s", maxZvolNameLength);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* limit is a FreeBSD limitation
|
* limit is a FreeBSD limitation
|
||||||
|
|
@ -719,7 +719,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ctx.logger.info(
|
callContext.logger.info(
|
||||||
"FreeNAS creating iscsi assets with name: " + iscsiName
|
"FreeNAS creating iscsi assets with name: " + iscsiName
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -793,7 +793,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
basename = response.body.iscsi_basename;
|
basename = response.body.iscsi_basename;
|
||||||
this.ctx.logger.verbose("FreeNAS ISCSI BASENAME: " + basename);
|
callContext.logger.verbose("FreeNAS ISCSI BASENAME: " + basename);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
response = await httpClient.get("/iscsi/global");
|
response = await httpClient.get("/iscsi/global");
|
||||||
|
|
@ -806,7 +806,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
basename = response.body.basename;
|
basename = response.body.basename;
|
||||||
this.ctx.logger.verbose("FreeNAS ISCSI BASENAME: " + basename);
|
callContext.logger.verbose("FreeNAS ISCSI BASENAME: " + basename);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new GrpcError(
|
throw new GrpcError(
|
||||||
|
|
@ -876,7 +876,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ctx.logger.verbose("FreeNAS ISCSI TARGET: %j", target);
|
callContext.logger.verbose("FreeNAS ISCSI TARGET: %j", target);
|
||||||
|
|
||||||
// set target.id on zvol
|
// set target.id on zvol
|
||||||
await zb.zfs.set(datasetName, {
|
await zb.zfs.set(datasetName, {
|
||||||
|
|
@ -958,7 +958,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ctx.logger.verbose(
|
callContext.logger.verbose(
|
||||||
"FreeNAS ISCSI TARGET_GROUP: %j",
|
"FreeNAS ISCSI TARGET_GROUP: %j",
|
||||||
targetGroup
|
targetGroup
|
||||||
);
|
);
|
||||||
|
|
@ -1024,7 +1024,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ctx.logger.verbose("FreeNAS ISCSI EXTENT: %j", extent);
|
callContext.logger.verbose("FreeNAS ISCSI EXTENT: %j", extent);
|
||||||
|
|
||||||
await httpApiClient.DatasetSet(datasetName, {
|
await httpApiClient.DatasetSet(datasetName, {
|
||||||
[FREENAS_ISCSI_EXTENT_ID_PROPERTY_NAME]: extent.id,
|
[FREENAS_ISCSI_EXTENT_ID_PROPERTY_NAME]: extent.id,
|
||||||
|
|
@ -1082,7 +1082,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
`unknown error creating iscsi targettoextent`
|
`unknown error creating iscsi targettoextent`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.ctx.logger.verbose(
|
callContext.logger.verbose(
|
||||||
"FreeNAS ISCSI TARGET_TO_EXTENT: %j",
|
"FreeNAS ISCSI TARGET_TO_EXTENT: %j",
|
||||||
targetToExtent
|
targetToExtent
|
||||||
);
|
);
|
||||||
|
|
@ -1208,7 +1208,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ctx.logger.verbose("FreeNAS ISCSI TARGET: %j", target);
|
callContext.logger.verbose("FreeNAS ISCSI TARGET: %j", target);
|
||||||
|
|
||||||
// set target.id on zvol
|
// set target.id on zvol
|
||||||
await httpApiClient.DatasetSet(datasetName, {
|
await httpApiClient.DatasetSet(datasetName, {
|
||||||
|
|
@ -1273,7 +1273,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ctx.logger.verbose("FreeNAS ISCSI EXTENT: %j", extent);
|
callContext.logger.verbose("FreeNAS ISCSI EXTENT: %j", extent);
|
||||||
|
|
||||||
await httpApiClient.DatasetSet(datasetName, {
|
await httpApiClient.DatasetSet(datasetName, {
|
||||||
[FREENAS_ISCSI_EXTENT_ID_PROPERTY_NAME]: extent.id,
|
[FREENAS_ISCSI_EXTENT_ID_PROPERTY_NAME]: extent.id,
|
||||||
|
|
@ -1330,7 +1330,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
`unknown error creating iscsi targetextent`
|
`unknown error creating iscsi targetextent`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.ctx.logger.verbose(
|
callContext.logger.verbose(
|
||||||
"FreeNAS ISCSI TARGET_TO_EXTENT: %j",
|
"FreeNAS ISCSI TARGET_TO_EXTENT: %j",
|
||||||
targetToExtent
|
targetToExtent
|
||||||
);
|
);
|
||||||
|
|
@ -1351,7 +1351,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
|
|
||||||
// iqn = target
|
// iqn = target
|
||||||
let iqn = basename + ":" + iscsiName;
|
let iqn = basename + ":" + iscsiName;
|
||||||
this.ctx.logger.info("FreeNAS iqn: " + iqn);
|
callContext.logger.info("FreeNAS iqn: " + iqn);
|
||||||
|
|
||||||
// store this off to make delete process more bullet proof
|
// store this off to make delete process more bullet proof
|
||||||
await httpApiClient.DatasetSet(datasetName, {
|
await httpApiClient.DatasetSet(datasetName, {
|
||||||
|
|
@ -1378,7 +1378,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteShare(call, datasetName) {
|
async deleteShare(callContext, call, datasetName) {
|
||||||
const driverShareType = this.getDriverShareType();
|
const driverShareType = this.getDriverShareType();
|
||||||
const httpClient = await this.getHttpClient();
|
const httpClient = await this.getHttpClient();
|
||||||
const httpApiClient = await this.getTrueNASHttpApiClient();
|
const httpApiClient = await this.getTrueNASHttpApiClient();
|
||||||
|
|
@ -1405,7 +1405,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
this.ctx.logger.debug("zfs props data: %j", properties);
|
callContext.logger.debug("zfs props data: %j", properties);
|
||||||
|
|
||||||
shareId = properties[FREENAS_NFS_SHARE_PROPERTY_NAME].value;
|
shareId = properties[FREENAS_NFS_SHARE_PROPERTY_NAME].value;
|
||||||
|
|
||||||
|
|
@ -1507,7 +1507,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
this.ctx.logger.debug("zfs props data: %j", properties);
|
callContext.logger.debug("zfs props data: %j", properties);
|
||||||
|
|
||||||
shareId = properties[FREENAS_SMB_SHARE_PROPERTY_NAME].value;
|
shareId = properties[FREENAS_SMB_SHARE_PROPERTY_NAME].value;
|
||||||
|
|
||||||
|
|
@ -1618,7 +1618,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ctx.logger.debug("zfs props data: %j", properties);
|
callContext.logger.debug("zfs props data: %j", properties);
|
||||||
|
|
||||||
let targetId = properties[FREENAS_ISCSI_TARGET_ID_PROPERTY_NAME].value;
|
let targetId = properties[FREENAS_ISCSI_TARGET_ID_PROPERTY_NAME].value;
|
||||||
let extentId = properties[FREENAS_ISCSI_EXTENT_ID_PROPERTY_NAME].value;
|
let extentId = properties[FREENAS_ISCSI_EXTENT_ID_PROPERTY_NAME].value;
|
||||||
|
|
@ -1684,7 +1684,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
_.get(response, "body.errno") == 14
|
_.get(response, "body.errno") == 14
|
||||||
) {
|
) {
|
||||||
retries++;
|
retries++;
|
||||||
this.ctx.logger.debug(
|
callContext.logger.debug(
|
||||||
"target: %s is in use, retry %s shortly",
|
"target: %s is in use, retry %s shortly",
|
||||||
targetId,
|
targetId,
|
||||||
retries
|
retries
|
||||||
|
|
@ -1709,7 +1709,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
FREENAS_ISCSI_TARGET_ID_PROPERTY_NAME
|
FREENAS_ISCSI_TARGET_ID_PROPERTY_NAME
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.ctx.logger.debug(
|
callContext.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",
|
||||||
targetId,
|
targetId,
|
||||||
iscsiName,
|
iscsiName,
|
||||||
|
|
@ -1771,7 +1771,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
FREENAS_ISCSI_EXTENT_ID_PROPERTY_NAME
|
FREENAS_ISCSI_EXTENT_ID_PROPERTY_NAME
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.ctx.logger.debug(
|
callContext.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",
|
||||||
extentId,
|
extentId,
|
||||||
iscsiName,
|
iscsiName,
|
||||||
|
|
@ -1809,7 +1809,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
* @param {*} datasetName
|
* @param {*} datasetName
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
async expandVolume(call, datasetName) {
|
async expandVolume(callContext, call, datasetName) {
|
||||||
// TODO: fix me
|
// TODO: fix me
|
||||||
return;
|
return;
|
||||||
const driverShareType = this.getDriverShareType();
|
const driverShareType = this.getDriverShareType();
|
||||||
|
|
@ -1833,7 +1833,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
command = (await this.getSudoPath()) + " " + command;
|
command = (await this.getSudoPath()) + " " + command;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ctx.logger.verbose(
|
callContext.logger.verbose(
|
||||||
"FreeNAS reloading iscsi daemon: %s",
|
"FreeNAS reloading iscsi daemon: %s",
|
||||||
command
|
command
|
||||||
);
|
);
|
||||||
|
|
@ -1887,7 +1887,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
return volume_status;
|
return volume_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
async populateCsiVolumeFromData(row) {
|
async populateCsiVolumeFromData(callContext, row) {
|
||||||
const driver = this;
|
const driver = this;
|
||||||
const zb = await this.getZetabyte();
|
const zb = await this.getZetabyte();
|
||||||
const driverZfsResourceType = this.getDriverZfsResourceType();
|
const driverZfsResourceType = this.getDriverZfsResourceType();
|
||||||
|
|
@ -1901,7 +1901,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
if (
|
if (
|
||||||
!zb.helpers.isPropertyValueSet(row[SHARE_VOLUME_CONTEXT_PROPERTY_NAME])
|
!zb.helpers.isPropertyValueSet(row[SHARE_VOLUME_CONTEXT_PROPERTY_NAME])
|
||||||
) {
|
) {
|
||||||
driver.ctx.logger.warn(`${row.name} is missing share context`);
|
callContext.logger.warn(`${row.name} is missing share context`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2084,7 +2084,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
|
|
||||||
assertCapabilities(callContext, capabilities) {
|
assertCapabilities(callContext, capabilities) {
|
||||||
const driverZfsResourceType = this.getDriverZfsResourceType();
|
const driverZfsResourceType = this.getDriverZfsResourceType();
|
||||||
this.ctx.logger.verbose("validating capabilities: %j", capabilities);
|
callContext.logger.verbose("validating capabilities: %j", capabilities);
|
||||||
|
|
||||||
let message = null;
|
let message = null;
|
||||||
//[{"access_mode":{"mode":"SINGLE_NODE_WRITER"},"mount":{"mount_flags":["noatime","_netdev"],"fs_type":"nfs"},"access_type":"mount"}]
|
//[{"access_mode":{"mode":"SINGLE_NODE_WRITER"},"mount":{"mount_flags":["noatime","_netdev"],"fs_type":"nfs"},"access_type":"mount"}]
|
||||||
|
|
@ -2403,7 +2403,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
if (driverZfsResourceType == "volume") {
|
if (driverZfsResourceType == "volume") {
|
||||||
let extentDiskName = "zvol/" + datasetName;
|
let extentDiskName = "zvol/" + datasetName;
|
||||||
let maxZvolNameLength = await driver.getMaxZvolNameLength();
|
let maxZvolNameLength = await driver.getMaxZvolNameLength();
|
||||||
driver.ctx.logger.debug("max zvol name length: %s", maxZvolNameLength);
|
callContext.logger.debug("max zvol name length: %s", maxZvolNameLength);
|
||||||
if (extentDiskName.length > maxZvolNameLength) {
|
if (extentDiskName.length > maxZvolNameLength) {
|
||||||
throw new GrpcError(
|
throw new GrpcError(
|
||||||
grpc.status.FAILED_PRECONDITION,
|
grpc.status.FAILED_PRECONDITION,
|
||||||
|
|
@ -2495,7 +2495,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
volume_id;
|
volume_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
driver.ctx.logger.debug("full snapshot name: %s", fullSnapshotName);
|
callContext.logger.debug("full snapshot name: %s", fullSnapshotName);
|
||||||
|
|
||||||
if (!zb.helpers.isZfsSnapshot(volume_content_source_snapshot_id)) {
|
if (!zb.helpers.isZfsSnapshot(volume_content_source_snapshot_id)) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -2656,7 +2656,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
VOLUME_SOURCE_CLONE_SNAPSHOT_PREFIX +
|
VOLUME_SOURCE_CLONE_SNAPSHOT_PREFIX +
|
||||||
volume_id;
|
volume_id;
|
||||||
|
|
||||||
driver.ctx.logger.debug("full snapshot name: %s", fullSnapshotName);
|
callContext.logger.debug("full snapshot name: %s", fullSnapshotName);
|
||||||
|
|
||||||
// create snapshot
|
// create snapshot
|
||||||
try {
|
try {
|
||||||
|
|
@ -2841,7 +2841,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
VOLUME_CONTENT_SOURCE_TYPE_PROPERTY_NAME,
|
VOLUME_CONTENT_SOURCE_TYPE_PROPERTY_NAME,
|
||||||
VOLUME_CONTENT_SOURCE_ID_PROPERTY_NAME,
|
VOLUME_CONTENT_SOURCE_ID_PROPERTY_NAME,
|
||||||
]);
|
]);
|
||||||
driver.ctx.logger.debug("zfs props data: %j", properties);
|
callContext.logger.debug("zfs props data: %j", properties);
|
||||||
|
|
||||||
// set mode
|
// set mode
|
||||||
let perms = {
|
let perms = {
|
||||||
|
|
@ -2957,7 +2957,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
volume_context = await this.createShare(call, datasetName);
|
volume_context = await this.createShare(callContext, call, datasetName);
|
||||||
await httpApiClient.DatasetSet(datasetName, {
|
await httpApiClient.DatasetSet(datasetName, {
|
||||||
[SHARE_VOLUME_CONTEXT_PROPERTY_NAME]: JSON.stringify(volume_context),
|
[SHARE_VOLUME_CONTEXT_PROPERTY_NAME]: JSON.stringify(volume_context),
|
||||||
});
|
});
|
||||||
|
|
@ -3045,7 +3045,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
driver.ctx.logger.debug("dataset properties: %j", properties);
|
callContext.logger.debug("dataset properties: %j", properties);
|
||||||
|
|
||||||
// deleteStrategy
|
// deleteStrategy
|
||||||
const delete_strategy = _.get(
|
const delete_strategy = _.get(
|
||||||
|
|
@ -3059,7 +3059,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove share resources
|
// remove share resources
|
||||||
await this.deleteShare(call, datasetName);
|
await this.deleteShare(callContext, call, datasetName);
|
||||||
|
|
||||||
// remove parent snapshot if appropriate with defer
|
// remove parent snapshot if appropriate with defer
|
||||||
if (
|
if (
|
||||||
|
|
@ -3070,7 +3070,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
.extractSnapshotName(properties.origin.value)
|
.extractSnapshotName(properties.origin.value)
|
||||||
.startsWith(VOLUME_SOURCE_CLONE_SNAPSHOT_PREFIX)
|
.startsWith(VOLUME_SOURCE_CLONE_SNAPSHOT_PREFIX)
|
||||||
) {
|
) {
|
||||||
driver.ctx.logger.debug(
|
callContext.logger.debug(
|
||||||
"removing with defer source snapshot: %s",
|
"removing with defer source snapshot: %s",
|
||||||
properties.origin.value
|
properties.origin.value
|
||||||
);
|
);
|
||||||
|
|
@ -3237,7 +3237,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
await httpApiClient.DatasetSet(datasetName, properties);
|
await httpApiClient.DatasetSet(datasetName, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.expandVolume(call, datasetName);
|
await this.expandVolume(callContext, call, datasetName);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
capacity_bytes:
|
capacity_bytes:
|
||||||
|
|
@ -3358,8 +3358,8 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
row[p] = response[p].rawvalue;
|
row[p] = response[p].rawvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
driver.ctx.logger.debug("list volumes result: %j", row);
|
callContext.logger.debug("list volumes result: %j", row);
|
||||||
let volume = await driver.populateCsiVolumeFromData(row);
|
let volume = await driver.populateCsiVolumeFromData(callContext, row);
|
||||||
let status = await driver.getVolumeStatus(datasetName);
|
let status = await driver.getVolumeStatus(datasetName);
|
||||||
|
|
||||||
let res = { volume };
|
let res = { volume };
|
||||||
|
|
@ -3475,7 +3475,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
driver.ctx.logger.debug("list volumes result: %j", rows);
|
callContext.logger.debug("list volumes result: %j", rows);
|
||||||
|
|
||||||
entries = [];
|
entries = [];
|
||||||
for (let row of rows) {
|
for (let row of rows) {
|
||||||
|
|
@ -3489,7 +3489,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
|
|
||||||
let volume = await driver.populateCsiVolumeFromData(row);
|
let volume = await driver.populateCsiVolumeFromData(callContext, row);
|
||||||
if (volume) {
|
if (volume) {
|
||||||
let status = await driver.getVolumeStatus(volume_id);
|
let status = await driver.getVolumeStatus(volume_id);
|
||||||
entries.push({
|
entries.push({
|
||||||
|
|
@ -4005,7 +4005,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
source_volume_id;
|
source_volume_id;
|
||||||
snapshotProperties[MANAGED_PROPERTY_NAME] = "true";
|
snapshotProperties[MANAGED_PROPERTY_NAME] = "true";
|
||||||
|
|
||||||
driver.ctx.logger.verbose("requested snapshot name: %s", name);
|
callContext.logger.verbose("requested snapshot name: %s", name);
|
||||||
|
|
||||||
let invalid_chars;
|
let invalid_chars;
|
||||||
invalid_chars = name.match(/[^a-z0-9_\-:.+]+/gi);
|
invalid_chars = name.match(/[^a-z0-9_\-:.+]+/gi);
|
||||||
|
|
@ -4022,7 +4022,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
// https://stackoverflow.com/questions/32106243/regex-to-remove-all-non-alpha-numeric-and-replace-spaces-with/32106277
|
// https://stackoverflow.com/questions/32106243/regex-to-remove-all-non-alpha-numeric-and-replace-spaces-with/32106277
|
||||||
name = name.replace(/[^a-z0-9_\-:.+]+/gi, "");
|
name = name.replace(/[^a-z0-9_\-:.+]+/gi, "");
|
||||||
|
|
||||||
driver.ctx.logger.verbose("cleansed snapshot name: %s", name);
|
callContext.logger.verbose("cleansed snapshot name: %s", name);
|
||||||
|
|
||||||
// check for other snapshopts with the same name on other volumes and fail as appropriate
|
// check for other snapshopts with the same name on other volumes and fail as appropriate
|
||||||
{
|
{
|
||||||
|
|
@ -4107,7 +4107,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
fullSnapshotName = datasetName + "@" + name;
|
fullSnapshotName = datasetName + "@" + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
driver.ctx.logger.verbose("full snapshot name: %s", fullSnapshotName);
|
callContext.logger.verbose("full snapshot name: %s", fullSnapshotName);
|
||||||
|
|
||||||
if (detachedSnapshot) {
|
if (detachedSnapshot) {
|
||||||
tmpSnapshotName =
|
tmpSnapshotName =
|
||||||
|
|
@ -4266,7 +4266,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
driver.ctx.logger.verbose("snapshot properties: %j", properties);
|
callContext.logger.verbose("snapshot properties: %j", properties);
|
||||||
|
|
||||||
// TODO: properly handle use-case where datasetEnableQuotas is not turned on
|
// TODO: properly handle use-case where datasetEnableQuotas is not turned on
|
||||||
if (driverZfsResourceType == "filesystem") {
|
if (driverZfsResourceType == "filesystem") {
|
||||||
|
|
@ -4365,7 +4365,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
|
|
||||||
const fullSnapshotName = datasetParentName + "/" + snapshot_id;
|
const fullSnapshotName = datasetParentName + "/" + snapshot_id;
|
||||||
|
|
||||||
driver.ctx.logger.verbose("deleting snapshot: %s", fullSnapshotName);
|
callContext.logger.verbose("deleting snapshot: %s", fullSnapshotName);
|
||||||
|
|
||||||
if (detachedSnapshot) {
|
if (detachedSnapshot) {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue