Add NVMe-TCP driver support

Change-Id: I4d4c987ac66f4d4df456f8eaafe1c1f96f64d716
This commit is contained in:
Simon Dodsley 2024-02-13 13:51:43 -05:00
parent 7df1d81f92
commit 3b1518d306
2 changed files with 26 additions and 12 deletions

View File

@ -53,8 +53,9 @@ options:
type: string
default: iscsi
description: |
SAN protocol to use. Choose between iscsi, fc or nvme-roce.
SAN protocol to use. Choose between iscsi, fc, nvme-roce or nvme-tcp.
nvme-roce is available from Zed.
nvme-tcp is available from 2023.2 (Bobcat)
volume-backend-name:
type: string
description: Service name to present to Cinder
@ -168,14 +169,14 @@ options:
description: |
If protocol is iscsi, this parameter provides the CIDR of FlashArray iSCSI
targets hosts are allowed to connect to. If not specified, defaults to all
IPv4 address. Available from Train.
IPv4 address. Supports IPv6. Available from Train.
default: !!null ""
nvme-cidr:
type: string
description: |
If protocol is nvme-roce, this parameter provides the CIDR of FlashArray
NVMe-RoCE targets hosts are allowed to connect to. If not specified, defaults
to all IPv4 address. Available from Zed.
to all IPv4 address. Supports IPv6. Available from Zed.
default: !!null ""
use-chap:
type: boolean

View File

@ -3,8 +3,7 @@ import charms_openstack.charm
charms_openstack.charm.use_defaults('charm.default-select-release')
class CinderpurestorageCharm(
charms_openstack.charm.CinderStoragePluginCharm):
class CinderpurestorageCharm(charms_openstack.charm.CinderStoragePluginCharm):
name = 'cinder_purestorage'
version_package = 'python-purestorage'
@ -21,19 +20,20 @@ class CinderpurestorageCharm(
'iscsi': 'cinder.volume.drivers.pure.PureISCSIDriver',
'fc': 'cinder.volume.drivers.pure.PureFCDriver',
'nvme-roce': 'cinder.volume.drivers.pure.PureNVMEDriver',
'nvme-tcp': 'cinder.volume.drivers.pure.PureNVMEDriver',
}
service = self.config.get('volume-backend-name')
volumedriver = drivers.get(self.config.get('protocol'))
image_cache = []
iscsi = []
nvme_roce = []
nvme_tcp = []
repl = []
driver_options = [
('san_ip', self.config.get('san-ip')),
('pure_api_token', self.config.get('pure-api-token')),
('use_multipath_for_image_xfer', self.config.get('use-multipath')),
('image_volume_cache_enabled',
self.config.get('use-image-cache')),
('image_volume_cache_enabled', self.config.get('use-image-cache')),
('pure_eradicate_on_delete',
self.config.get('eradicate-on-delete')),
('pure_automatic_max_oversubscription_ratio',
@ -47,10 +47,13 @@ class CinderpurestorageCharm(
driver_options.append(
('backend_availability_zone', backend_az))
if self.config.get('protocol') == 'nvme-roce':
if self.config.get('protocol') in ['nvme-roce', 'nvme-tcp']:
if self.config.get('nvme-cidr'):
nvme_roce.extend([('pure_nvme_cidr',
self.config.get('nvme-cidr'))])
self.config.get('protocol').extend(
[('pure_nvme_cidr', self.config.get('nvme-cidr'))])
if self.config.get('protocol') == 'nvme-tcp':
nvme_tcp.append(('pure_nvme_transport', 'tcp'))
if self.config.get('protocol') == 'iscsi':
if self.config.get('iscsi-cidr'):
@ -70,7 +73,7 @@ class CinderpurestorageCharm(
if max_count is not None:
image_cache.append(('image_volume_cache_max_count', max_count))
if self.config.get('use-replication'):
if self.config.get("use-replication"):
replication_device = 'backend_id:' + \
self.config.get('replication-target-name') + \
',san_ip:' + \
@ -83,6 +86,14 @@ class CinderpurestorageCharm(
replication_device += ',uniform:true'
repl = [('replication_device',
replication_device)]
if self.config.get('replica-interval'):
self.config.get('replication-target-api-token')
if self.config.get('replication-type') == 'sync':
replication_device += ',type:sync'
if self.config.get('replication-sync-uniform', False):
replication_device += ',uniform:true'
repl = [('replication_device',
replication_device)]
if self.config.get('replica-interval'):
repl.extend([('pure_replica_interval_default',
self.config.get('replica-interval'))])
@ -104,7 +115,9 @@ class CinderpurestorageCharm(
repl.extend([('pure_replication_pod_name',
self.config.get('replication-pod'))])
final_options = driver_options + image_cache + repl + iscsi + nvme_roce
final_options = (
driver_options + image_cache + repl + iscsi + nvme_roce + nvme_tcp
)
return final_options