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
This commit is contained in:
Lucio Seki 2018-04-09 11:19:51 -03:00
parent 4158fb44bc
commit 029cadbf40
3 changed files with 13 additions and 11 deletions

View File

@ -733,9 +733,9 @@ class NetAppCmodeClientTestCase(test.TestCase):
def test_clone_lun_multiple_zapi_calls(self): def test_clone_lun_multiple_zapi_calls(self):
"""Test for when lun clone requires more than one zapi call.""" """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 # Force 2 calls
bc = 2 ** 24 * 32 * 2 bc = 2 ** 18 * 2
self.client.clone_lun('volume', 'fakeLUN', 'newFakeLUN', self.client.clone_lun('volume', 'fakeLUN', 'newFakeLUN',
block_count=bc) block_count=bc)
self.assertEqual(2, self.connection.invoke_successfully.call_count) self.assertEqual(2, self.connection.invoke_successfully.call_count)

View File

@ -452,19 +452,16 @@ class Client(client_base.Client):
def clone_lun(self, volume, name, new_name, space_reserved='true', def clone_lun(self, volume, name, new_name, space_reserved='true',
qos_policy_group_name=None, src_block=0, dest_block=0, qos_policy_group_name=None, src_block=0, dest_block=0,
block_count=0, source_snapshot=None, is_snapshot=False): block_count=0, source_snapshot=None, is_snapshot=False):
# zAPI can only handle 2^24 blocks per range # ONTAP handles only 128 MB per call as of v9.1
bc_limit = 2 ** 24 # 8GB bc_limit = 2 ** 18 # 2^18 blocks * 512 bytes/block = 128 MB
# zAPI can only handle 32 block ranges per call z_calls = int(math.ceil(block_count / float(bc_limit)))
br_limit = 32
z_limit = br_limit * bc_limit # 256 GB
z_calls = int(math.ceil(block_count / float(z_limit)))
zbc = block_count zbc = block_count
if z_calls == 0: if z_calls == 0:
z_calls = 1 z_calls = 1
for _call in range(0, z_calls): for _call in range(0, z_calls):
if zbc > z_limit: if zbc > bc_limit:
block_count = z_limit block_count = bc_limit
zbc -= z_limit zbc -= bc_limit
else: else:
block_count = zbc block_count = zbc

View File

@ -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.