From a95a6d926873d55484099262cfb887d8ccf2426d Mon Sep 17 00:00:00 2001 From: xoJIog Date: Thu, 25 Jan 2024 19:07:44 +0200 Subject: [PATCH 1/4] adding possibility to set block attributes --- src/driver/controller-zfs-generic/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/driver/controller-zfs-generic/index.js b/src/driver/controller-zfs-generic/index.js index 6ba5b0b..d3080ae 100644 --- a/src/driver/controller-zfs-generic/index.js +++ b/src/driver/controller-zfs-generic/index.js @@ -219,6 +219,22 @@ class ControllerZfsGenericDriver extends ControllerZfsBaseDriver { basename = this.options.iscsi.shareStrategyTargetCli.basename; let setAttributesText = ""; let setAuthText = ""; + let setBlockAttributesText = ""; + + if (this.options.iscsi.shareStrategyTargetCli.block) { + if (this.options.iscsi.shareStrategyTargetCli.block.attributes) { + for (const attributeName in this.options.iscsi + .shareStrategyTargetCli.block.attributes) { + const attributeValue = + this.options.iscsi.shareStrategyTargetCli.block.attributes[ + attributeName + ]; + setBlockAttributesText += "\n"; + setBlockAttributesText += `set attribute ${attributeName}=${attributeValue}`; + } + } + } + if (this.options.iscsi.shareStrategyTargetCli.tpg) { if (this.options.iscsi.shareStrategyTargetCli.tpg.attributes) { for (const attributeName in this.options.iscsi @@ -263,6 +279,8 @@ ${setAuthText} # create extent cd /backstores/block create ${assetName} /dev/${extentDiskName} +cd /backstores/block/${assetName} +${setBlockAttributesText} # add extent to target/tpg cd /iscsi/${basename}:${assetName}/tpg1/luns From 4ff51a8e0a96591a4b8824b2266c4fde49ecf6b4 Mon Sep 17 00:00:00 2001 From: xoJIog Date: Thu, 25 Jan 2024 19:09:43 +0200 Subject: [PATCH 2/4] adding example of setting block attributes --- examples/zfs-generic-iscsi.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/zfs-generic-iscsi.yaml b/examples/zfs-generic-iscsi.yaml index 2aaf5d0..00deb07 100644 --- a/examples/zfs-generic-iscsi.yaml +++ b/examples/zfs-generic-iscsi.yaml @@ -70,7 +70,11 @@ iscsi: #password: "bar" # mutual CHAP #mutual_userid: "baz" - #mutual_password: "bar" + #mutual_password: "bar" + block: + attributes: + # enable Thin Provisioning Unmap + emulate_tpu: 1 targetPortal: "server[:port]" # for multipath targetPortals: [] # [ "server[:port]", "server[:port]", ... ] From 1aafa064a4f8c37cdf4128966b65379e9229f95c Mon Sep 17 00:00:00 2001 From: xoJIog Date: Mon, 29 Jan 2024 18:01:39 +0200 Subject: [PATCH 3/4] adding example of setting block attributes --- examples/zfs-generic-iscsi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/zfs-generic-iscsi.yaml b/examples/zfs-generic-iscsi.yaml index 00deb07..2a705dd 100644 --- a/examples/zfs-generic-iscsi.yaml +++ b/examples/zfs-generic-iscsi.yaml @@ -74,7 +74,7 @@ iscsi: block: attributes: # enable Thin Provisioning Unmap - emulate_tpu: 1 + emulate_tpu: 0 targetPortal: "server[:port]" # for multipath targetPortals: [] # [ "server[:port]", "server[:port]", ... ] From 5a8ee64957b8c37204e210cdffa9bf2984632185 Mon Sep 17 00:00:00 2001 From: xoJIog Date: Mon, 29 Jan 2024 18:02:32 +0200 Subject: [PATCH 4/4] adding example of setting block attributes --- examples/zfs-generic-iscsi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/zfs-generic-iscsi.yaml b/examples/zfs-generic-iscsi.yaml index 2a705dd..af5df37 100644 --- a/examples/zfs-generic-iscsi.yaml +++ b/examples/zfs-generic-iscsi.yaml @@ -73,7 +73,7 @@ iscsi: #mutual_password: "bar" block: attributes: - # enable Thin Provisioning Unmap + # set to 1 to enable Thin Provisioning Unmap emulate_tpu: 0 targetPortal: "server[:port]" # for multipath