Merge "NetApp ONTAP: Fix sub-clone zapi call"
This commit is contained in:
commit
61d64fa540
@ -823,6 +823,42 @@ class NetAppCmodeClientTestCase(test.TestCase):
|
|||||||
netapp_api.NaElement.create_node_with_children(
|
netapp_api.NaElement.create_node_with_children(
|
||||||
'clone-create', **clone_create_args), True)
|
'clone-create', **clone_create_args), True)
|
||||||
|
|
||||||
|
@ddt.data(0, 1)
|
||||||
|
def test_clone_lun_is_sub_clone(self, block_count):
|
||||||
|
|
||||||
|
self.client.clone_lun(
|
||||||
|
'volume', 'fakeLUN', 'newFakeLUN', block_count=block_count)
|
||||||
|
|
||||||
|
clone_create_args = {
|
||||||
|
'volume': 'volume',
|
||||||
|
'source-path': 'fakeLUN',
|
||||||
|
'destination-path': 'newFakeLUN',
|
||||||
|
}
|
||||||
|
|
||||||
|
is_sub_clone = block_count > 0
|
||||||
|
if not is_sub_clone:
|
||||||
|
clone_create_args['space-reserve'] = 'true'
|
||||||
|
|
||||||
|
# build the expected request
|
||||||
|
expected_clone_create_request = \
|
||||||
|
netapp_api.NaElement.create_node_with_children(
|
||||||
|
'clone-create', **clone_create_args)
|
||||||
|
|
||||||
|
# add expected fields in the request if it's a sub-clone
|
||||||
|
if is_sub_clone:
|
||||||
|
block_ranges = netapp_api.NaElement("block-ranges")
|
||||||
|
block_range = \
|
||||||
|
netapp_api.NaElement.create_node_with_children(
|
||||||
|
'block-range',
|
||||||
|
**{'source-block-number': '0',
|
||||||
|
'destination-block-number': '0',
|
||||||
|
'block-count': '1'})
|
||||||
|
block_ranges.add_child_elem(block_range)
|
||||||
|
expected_clone_create_request.add_child_elem(block_ranges)
|
||||||
|
|
||||||
|
self.connection.invoke_successfully.assert_called_once_with(
|
||||||
|
expected_clone_create_request, True)
|
||||||
|
|
||||||
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."""
|
||||||
|
|
||||||
|
@ -635,12 +635,14 @@ class Client(client_base.Client):
|
|||||||
else:
|
else:
|
||||||
block_count = zbc
|
block_count = zbc
|
||||||
|
|
||||||
|
is_sub_clone = block_count > 0
|
||||||
zapi_args = {
|
zapi_args = {
|
||||||
'volume': volume,
|
'volume': volume,
|
||||||
'source-path': name,
|
'source-path': name,
|
||||||
'destination-path': new_name,
|
'destination-path': new_name,
|
||||||
'space-reserve': space_reserved,
|
|
||||||
}
|
}
|
||||||
|
if not is_sub_clone:
|
||||||
|
zapi_args['space-reserve'] = space_reserved
|
||||||
if source_snapshot:
|
if source_snapshot:
|
||||||
zapi_args['snapshot-name'] = source_snapshot
|
zapi_args['snapshot-name'] = source_snapshot
|
||||||
if is_snapshot and self.features.BACKUP_CLONE_PARAM:
|
if is_snapshot and self.features.BACKUP_CLONE_PARAM:
|
||||||
@ -651,7 +653,8 @@ class Client(client_base.Client):
|
|||||||
child_name = 'qos-%spolicy-group-name' % (
|
child_name = 'qos-%spolicy-group-name' % (
|
||||||
'adaptive-' if qos_policy_group_is_adaptive else '')
|
'adaptive-' if qos_policy_group_is_adaptive else '')
|
||||||
clone_create.add_new_child(child_name, qos_policy_group_name)
|
clone_create.add_new_child(child_name, qos_policy_group_name)
|
||||||
if block_count > 0:
|
|
||||||
|
if is_sub_clone:
|
||||||
block_ranges = netapp_api.NaElement("block-ranges")
|
block_ranges = netapp_api.NaElement("block-ranges")
|
||||||
segments = int(math.ceil(block_count / float(bc_limit)))
|
segments = int(math.ceil(block_count / float(bc_limit)))
|
||||||
bc = block_count
|
bc = block_count
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
`Bug #1924643 <https://bugs.launchpad.net/cinder/+bug/1924643>`_: Fixed
|
||||||
|
the NetApp cinder driver sub-clone operation that might be used
|
||||||
|
by extend operation in case the extended size is greater than the max
|
||||||
|
LUN geometry.
|
Loading…
Reference in New Issue
Block a user