DEMC: Add support for trim/discard

This patch adds support for trim/discard to 3 Dell EMC drivers:

- PowerStore
- PowerMax
- PowerFlex

Support is added to report this capability to both Nova, via the
'discard' value in connection properties, as well as internally to
Cinder, via the 'sparse_copy_volume' driver capability.

PowerStore and PowerMax only support thin volumes, so they will always
report the trimming capability, but the PowerFlex also supports thick
volumes, so it will only be returned for thin volumes, and following
vendor's recommendation [1] it will not be returned for volumes that
have snapshots.

SysAdmins can force all volumes to return discard capabilities for Nova
with the ``report_discard_supported`` configuration option.

[1]: https://docs.delltechnologies.com/bundle/READY_NODE_AMS_DG/page/GUID-8E6676C1-425A-4D51-8F59-1A92DE4F6638.html

Change-Id: Ib119fd689545bdb636a4844c6125aec7c3c24b96
This commit is contained in:
Gorka Eguileor 2022-07-14 18:43:34 +02:00
parent c12c690271
commit 43d851abba
9 changed files with 41 additions and 6 deletions

View File

@ -108,6 +108,7 @@ class PowerMaxFCTest(test.TestCase):
'data': {'target_lun': self.data.fc_device_info['hostlunid'],
'target_discovered': True,
'target_wwn': [],
'discard': True,
'initiator_target_map': {}}}
data = self.driver.populate_data(self.data.fc_device_info,
self.data.test_volume,

View File

@ -155,6 +155,7 @@ class PowerMaxISCSITest(test.TestCase):
'target_iqn': ip_and_iqn[0]['iqn'].split(',')[0],
'target_portal': ip_and_iqn[0]['ip'] + ':3260',
'target_lun': host_lun_id,
'discard': True,
'volume_id': self.data.test_volume.id}
iscsi_properties = self.driver.vmax_get_iscsi_properties(
self.data.array, vol, ip_and_iqn, True, host_lun_id, [], None)
@ -271,6 +272,7 @@ class PowerMaxISCSITest(test.TestCase):
'target_iqn': ip_and_iqn[0]['iqn'].split(',')[0],
'target_portal': ip_and_iqn[0]['ip'] + ':3260',
'target_lun': host_lun_id,
'discard': True,
'volume_id': self.data.test_volume.id}
iscsi_properties = self.driver.vmax_get_iscsi_properties(
self.data.array, self.data.test_volume, ip_and_iqn, True,

View File

@ -95,9 +95,10 @@ class PowerFlexDriver(driver.VolumeDriver):
3.5.5 - Rebrand VxFlex OS to PowerFlex.
3.5.6 - Fix for Bug #1897598 when volume can be migrated without
conversion of its type.
3.5.7 - Report trim/discard support.
"""
VERSION = "3.5.6"
VERSION = "3.5.7"
# ThirdPartySystems wiki
CI_WIKI_NAME = "DellEMC_PowerFlex_CI"
@ -840,7 +841,14 @@ class PowerFlexDriver(driver.VolumeDriver):
self._get_client().remove_volume(snapshot.provider_id)
def initialize_connection(self, volume, connector, **kwargs):
return self._initialize_connection(volume, connector, volume.size)
res = self._initialize_connection(volume, connector, volume.size)
# TODO: Should probably be enabled for SSDs as well
# It is recommended not to trim volumes that contain snapshots as the
# logical capacity may not shrink.
if self.provisioning_type == 'thin' and not len(volume.snapshots):
res['data']['discard'] = True
return res
def _initialize_connection(self, vol_or_snap, connector, vol_size):
"""Initialize connection and return connection info.
@ -1027,6 +1035,8 @@ class PowerFlexDriver(driver.VolumeDriver):
"prov": backend_provisioned_capacity,
})
stats["pools"] = pools
# TODO: Should probably be enabled for SSDs as well
stats['sparse_copy_volume'] = self.provisioning_type == 'thin'
self._stats = stats
def _query_pool_stats(self, domain_name, pool_name):

View File

@ -1424,6 +1424,7 @@ class PowerMaxCommon(object):
'reserved_percentage': 0,
'replication_enabled': self.replication_enabled,
'replication_targets': self.replication_targets,
'sparse_copy_volume': True,
'pools': pools}
return data

View File

@ -131,9 +131,10 @@ class PowerMaxFCDriver(san.SanDriver, driver.FibreChannelDriver):
- Use of snap id instead of generation (bp powermax-snapset-ids)
- Support for Failover Abilities (bp/powermax-failover-abilities)
4.4.0 - Early check for status of port
4.4.1 - Report trim/discard support
"""
VERSION = "4.4.0"
VERSION = "4.4.1"
# ThirdPartySystems wiki
CI_WIKI_NAME = "DellEMC_PowerMAX_CI"
@ -311,6 +312,7 @@ class PowerMaxFCDriver(san.SanDriver, driver.FibreChannelDriver):
'data': {'target_lun': device_number,
'target_discovered': True,
'target_wwn': target_wwns,
'discard': True,
'initiator_target_map': init_targ_map}}
LOG.debug("Return FC data for zone addition: %(data)s.",

View File

@ -137,9 +137,10 @@ class PowerMaxISCSIDriver(san.SanISCSIDriver):
- Use of snap id instead of generation (bp powermax-snapset-ids)
- Support for Failover Abilities (bp/powermax-failover-abilities)
4.4.0 - Early check for status of port
4.4.1 - Report trim/discard support
"""
VERSION = "4.4.0"
VERSION = "4.4.1"
# ThirdPartySystems wiki
CI_WIKI_NAME = "DellEMC_PowerMAX_CI"
@ -422,6 +423,7 @@ class PowerMaxISCSIDriver(san.SanISCSIDriver):
properties['target_discovered'] = True
properties['target_lun'] = host_lun_id
properties['volume_id'] = volume.id
properties['discard'] = True
if self.configuration.safe_get('use_chap_auth'):
LOG.info("Chap authentication enabled.")

View File

@ -293,6 +293,7 @@ class CommonAdapter(object):
"compression_support": True,
"multiattach": True,
"consistent_group_snapshot_enabled": True,
"sparse_copy_volume": True,
}
backend_stats = self.client.get_metrics()
backend_total_capacity = utils.bytes_to_gib(
@ -1061,6 +1062,7 @@ class FibreChannelAdapter(CommonAdapter):
"target_discovered": False,
"target_lun": volume_identifier,
"target_wwn": target_wwns,
"discard": True,
}
}
@ -1180,6 +1182,7 @@ class NVMEoFAdapter(CommonAdapter):
"nqn": nqn,
"target_port": 4420,
"transport_type": "tcp",
"volume_nguid": volume_identifier
"volume_nguid": volume_identifier,
"discard": True,
},
}

View File

@ -52,9 +52,10 @@ class PowerStoreDriver(driver.VolumeDriver):
targets are used for multiple purposes
(iSCSI target, Replication target, etc.)
1.2.0 - Add NVMe-OF support
1.2.1 - Report trim/discard support
"""
VERSION = "1.2.0"
VERSION = "1.2.1"
VENDOR = "Dell EMC"
# ThirdPartySystems wiki page

View File

@ -0,0 +1,13 @@
---
features:
- |
Dell EMC PowerStore driver: Report trimming/discard support to Nova and
Cinder.
- |
Dell EMC PowerMax driver: Report trimming/discard support to Nova and
Cinder.
- |
Dell EMC PowerFlex driver: Report trimming/discard support to Nova and
Cinder on thin volumes that don't have snapshots. Not doing trim on
volumes with snapshots is the vendor's recommendation, but can be overriden
with the ``report_discard_supported`` configuration option.