better duplicate iscsi targettoextent detection

This commit is contained in:
Travis Glenn Hansen
2020-11-30 16:19:04 -07:00
parent 3924f08ae8
commit 00dcf0b60a
3 changed files with 98 additions and 158 deletions
+11 -12
View File
@@ -746,12 +746,12 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
// Extent is already in this target.
if (
response.statusCode == 409 &&
JSON.stringify(response.body).includes(
(JSON.stringify(response.body).includes(
"Extent is already in this target."
) &&
JSON.stringify(response.body).includes(
"LUN ID is already being used for this target."
)
) ||
JSON.stringify(response.body).includes(
"LUN ID is already being used for this target."
))
) {
targetToExtent = await this.findResourceByProperties(
"/services/iscsi/targettoextent",
@@ -941,12 +941,12 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
// Extent is already in this target.
if (
response.statusCode == 422 &&
JSON.stringify(response.body).includes(
(JSON.stringify(response.body).includes(
"Extent is already in this target."
) &&
JSON.stringify(response.body).includes(
"LUN ID is already being used for this target."
)
) ||
JSON.stringify(response.body).includes(
"LUN ID is already being used for this target."
))
) {
targetToExtent = await this.findResourceByProperties(
"/iscsi/targetextent",
@@ -1388,7 +1388,6 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
async expandVolume(call, datasetName) {
const driverShareType = this.getDriverShareType();
const sshClient = this.getSshClient();
let response;
switch (driverShareType) {
case "iscsi":
@@ -1413,7 +1412,7 @@ class FreeNASDriver extends ControllerZfsSshBaseDriver {
command
);
response = await sshClient.exec(command);
let response = await sshClient.exec(command);
if (response.code != 0) {
throw new GrpcError(
grpc.status.UNKNOWN,