From e3145a30cf3d904cba05834086039487dddcf714 Mon Sep 17 00:00:00 2001 From: Lucio Seki Date: Mon, 9 Apr 2018 11:19:51 -0300 Subject: [PATCH] NetApp ONTAP: Set new sub-lun clone limit for ONTAP driver Until ONTAP v8.3, the driver used to perform sub-lun clone of up to 64GB per operation, but as of v9.1, ONTAP handles only 128MB per operation. This new limit is causing error on volume extending operations, which triggers sub-lun cloning when resizing exceeds max-resize-geometry. For instance, if a volume is extended from 1GB to 64GB, the operation fails because it triggers a single sub-lun cloning of 1GB. This fix sets the limit used by sub-lun cloning to 128MB, therefore if a volume is extended from 1GB to 64GB, it no longer fails, and instead it will trigger 8 sub-lun cloning operations of 128MB. Change-Id: Ib294cbdbdfe19d34a7702dafec2c8d29136a2f25 Closes-Bug: #1762424 (cherry picked from commit 029cadbf4067ad6f0bf08588cf439587f3c7052c) --- .../netapp/dataontap/client/test_client_cmode.py | 4 ++-- .../netapp/dataontap/client/client_cmode.py | 15 ++++++--------- .../notes/bug-1762424-f76af2f37fe408f1.yaml | 5 +++++ 3 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 releasenotes/notes/bug-1762424-f76af2f37fe408f1.yaml diff --git a/cinder/tests/unit/volume/drivers/netapp/dataontap/client/test_client_cmode.py b/cinder/tests/unit/volume/drivers/netapp/dataontap/client/test_client_cmode.py index 64ac143edf5..8960d8438b9 100644 --- a/cinder/tests/unit/volume/drivers/netapp/dataontap/client/test_client_cmode.py +++ b/cinder/tests/unit/volume/drivers/netapp/dataontap/client/test_client_cmode.py @@ -733,9 +733,9 @@ class NetAppCmodeClientTestCase(test.TestCase): def test_clone_lun_multiple_zapi_calls(self): """Test for when lun clone requires more than one zapi call.""" - # Max block-ranges per call = 32, max blocks per range = 2^24 + # Max clone size per call = 2^18 blocks * 512 bytes/block = 128 MB # Force 2 calls - bc = 2 ** 24 * 32 * 2 + bc = 2 ** 18 * 2 self.client.clone_lun('volume', 'fakeLUN', 'newFakeLUN', block_count=bc) self.assertEqual(2, self.connection.invoke_successfully.call_count) diff --git a/cinder/volume/drivers/netapp/dataontap/client/client_cmode.py b/cinder/volume/drivers/netapp/dataontap/client/client_cmode.py index e35b5edec11..830bd7e5382 100644 --- a/cinder/volume/drivers/netapp/dataontap/client/client_cmode.py +++ b/cinder/volume/drivers/netapp/dataontap/client/client_cmode.py @@ -450,19 +450,16 @@ class Client(client_base.Client): def clone_lun(self, volume, name, new_name, space_reserved='true', qos_policy_group_name=None, src_block=0, dest_block=0, block_count=0, source_snapshot=None, is_snapshot=False): - # zAPI can only handle 2^24 blocks per range - bc_limit = 2 ** 24 # 8GB - # zAPI can only handle 32 block ranges per call - br_limit = 32 - z_limit = br_limit * bc_limit # 256 GB - z_calls = int(math.ceil(block_count / float(z_limit))) + # ONTAP handles only 128 MB per call as of v9.1 + bc_limit = 2 ** 18 # 2^18 blocks * 512 bytes/block = 128 MB + z_calls = int(math.ceil(block_count / float(bc_limit))) zbc = block_count if z_calls == 0: z_calls = 1 for _call in range(0, z_calls): - if zbc > z_limit: - block_count = z_limit - zbc -= z_limit + if zbc > bc_limit: + block_count = bc_limit + zbc -= bc_limit else: block_count = zbc diff --git a/releasenotes/notes/bug-1762424-f76af2f37fe408f1.yaml b/releasenotes/notes/bug-1762424-f76af2f37fe408f1.yaml new file mode 100644 index 00000000000..90c08f0ed35 --- /dev/null +++ b/releasenotes/notes/bug-1762424-f76af2f37fe408f1.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + NetApp ONTAP (bug 1762424): Fix ONTAP NetApp driver not being able to extend + a volume to a size greater than the corresponding LUN max geometry.