Fix cacheable capability

When using the LVM cinder driver the cacheable capability is not being
reported by the backend to the scheduler when the transport protocol is
NVMe-oF (nvmet target driver), but it is properly reported if it's the
LIO target driver.

This also happens with other drivers that should be reporting that they
are cacheable.

This happens because even if the volume manager correctly uses the
"storage_protocol" reported by the drivers on their stats to add the
"cacheable" capability for iSCSI, FC, and NVMe-oF protocols, it isn't
taking into account all the variants these have:

- FC, fc, fibre_channel
- iSCSI, iscsi
- NVMe-oF, nvmeof, NVMeOF

Same thing happens for the shared_targets of the volumes, which are not
missing an iSCSI variant.

This patch creates constants for the different storge protocols to try
to avoid these variants (as agreed on the PTG) and also makes the
cacheable and shared_targets check against all the existing variants.

This change facilitates identifying NVMe-oF drivers (for bug 1961102)
for the shared_targets part.

Closes-Bug: #1969366
Related-Bug: #1961102
Change-Id: I1333b0471974e94eb2b3b79ea70a06e0afe28cd9
This commit is contained in:
Gorka Eguileor 2022-04-18 17:37:34 +02:00
parent 6d4a6aa978
commit 68311a0794
66 changed files with 200 additions and 103 deletions

View File

@ -29,3 +29,33 @@ LOG_BINARIES = (SCHEDULER_BINARY, VOLUME_BINARY, BACKUP_BINARY, API_BINARY)
# The encryption key ID used by the legacy fixed-key ConfKeyMgr # The encryption key ID used by the legacy fixed-key ConfKeyMgr
FIXED_KEY_ID = '00000000-0000-0000-0000-000000000000' FIXED_KEY_ID = '00000000-0000-0000-0000-000000000000'
# Storage protocol constants
CEPH = 'ceph'
DRBD = 'DRBD'
FC = 'FC'
FC_VARIANT_1 = 'fibre_channel'
FC_VARIANT_2 = 'fc'
FILE = 'file'
ISCSI = 'iSCSI'
ISCSI_VARIANT = 'iscsi'
ISER = 'iSER'
LIGHTOS = 'lightos'
NFS = 'NFS'
NFS_VARIANT = 'nfs'
NVMEOF = 'NVMe-oF'
NVMEOF_VARIANT_1 = 'NVMeOF'
NVMEOF_VARIANT_2 = 'nvmeof'
SCALEIO = 'scaleio'
SCSI = 'SCSI'
STORPOOL = 'storpool'
VMDK = 'vmdk'
VSTORAGE = 'vstorageobject'
# These must be strings, because there are places that check specific type
ISCSI_VARIANTS = [ISCSI, ISCSI_VARIANT]
FC_VARIANTS = [FC, FC_VARIANT_1, FC_VARIANT_2]
NFS_VARIANTS = [NFS, NFS_VARIANT]
NVMEOF_VARIANTS = [NVMEOF, NVMEOF_VARIANT_1, NVMEOF_VARIANT_2]
CACHEABLE_PROTOCOLS = FC_VARIANTS + ISCSI_VARIANTS + NVMEOF_VARIANTS

View File

@ -25,6 +25,7 @@ from oslo_config import types
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
from cinder.common import constants
from cinder import db from cinder import db
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -221,8 +222,8 @@ volume_opts = [
'directly, it will only notify that it can be used.'), 'directly, it will only notify that it can be used.'),
cfg.StrOpt('storage_protocol', cfg.StrOpt('storage_protocol',
ignore_case=True, ignore_case=True,
default='iscsi', default=constants.ISCSI,
choices=['iscsi', 'fc'], choices=[constants.ISCSI, constants.FC],
help='Protocol for transferring data between host and ' help='Protocol for transferring data between host and '
'storage back-end.'), 'storage back-end.'),
cfg.BoolOpt('enable_unsupported_driver', cfg.BoolOpt('enable_unsupported_driver',
@ -2805,7 +2806,7 @@ class ISCSIDriver(VolumeDriver):
data["volume_backend_name"] = backend_name or 'Generic_iSCSI' data["volume_backend_name"] = backend_name or 'Generic_iSCSI'
data["vendor_name"] = 'Open Source' data["vendor_name"] = 'Open Source'
data["driver_version"] = '1.0' data["driver_version"] = '1.0'
data["storage_protocol"] = 'iSCSI' data["storage_protocol"] = constants.ISCSI
data["pools"] = [] data["pools"] = []
data["replication_enabled"] = False data["replication_enabled"] = False
@ -2874,7 +2875,7 @@ class ISERDriver(ISCSIDriver):
data["volume_backend_name"] = backend_name or 'Generic_iSER' data["volume_backend_name"] = backend_name or 'Generic_iSER'
data["vendor_name"] = 'Open Source' data["vendor_name"] = 'Open Source'
data["driver_version"] = '1.0' data["driver_version"] = '1.0'
data["storage_protocol"] = 'iSER' data["storage_protocol"] = constants.ISER
data["pools"] = [] data["pools"] = []
self._update_pools_and_stats(data) self._update_pools_and_stats(data)
@ -2950,7 +2951,7 @@ class FibreChannelDriver(VolumeDriver):
data["volume_backend_name"] = backend_name or 'Generic_FC' data["volume_backend_name"] = backend_name or 'Generic_FC'
data["vendor_name"] = 'Open Source' data["vendor_name"] = 'Open Source'
data["driver_version"] = '1.0' data["driver_version"] = '1.0'
data["storage_protocol"] = 'FC' data["storage_protocol"] = constants.FC
data["pools"] = [] data["pools"] = []
self._update_pools_and_stats(data) self._update_pools_and_stats(data)

View File

@ -17,6 +17,7 @@ from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import netutils from oslo_utils import netutils
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -72,7 +73,7 @@ class RBDISCSIDriver(rbd.RBDDriver):
SUPPORTS_ACTIVE_ACTIVE = True SUPPORTS_ACTIVE_ACTIVE = True
STORAGE_PROTOCOL = 'iSCSI' STORAGE_PROTOCOL = constants.ISCSI
CHAP_LENGTH = 16 CHAP_LENGTH = 16
# The target IQN to use for creating all exports # The target IQN to use for creating all exports

View File

@ -28,6 +28,7 @@ from oslo_utils import importutils
from oslo_utils import units from oslo_utils import units
import six import six
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder.image import image_utils from cinder.image import image_utils
@ -975,7 +976,7 @@ class DateraApi(object):
'volume_backend_name': self.backend_name, 'volume_backend_name': self.backend_name,
'vendor_name': 'Datera', 'vendor_name': 'Datera',
'driver_version': self.VERSION, 'driver_version': self.VERSION,
'storage_protocol': 'iSCSI', 'storage_protocol': constants.ISCSI,
'total_capacity_gb': ( 'total_capacity_gb': (
int(results.total_capacity) / units.Gi), int(results.total_capacity) / units.Gi),
'free_capacity_gb': ( 'free_capacity_gb': (

View File

@ -28,6 +28,7 @@ from oslo_utils import importutils
from oslo_utils import units from oslo_utils import units
import six import six
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder.image import image_utils from cinder.image import image_utils
@ -1026,7 +1027,7 @@ class DateraApi(object):
'volume_backend_name': self.backend_name, 'volume_backend_name': self.backend_name,
'vendor_name': 'Datera', 'vendor_name': 'Datera',
'driver_version': self.VERSION, 'driver_version': self.VERSION,
'storage_protocol': 'iSCSI', 'storage_protocol': constants.ISCSI,
'total_capacity_gb': ( 'total_capacity_gb': (
int(results.total_capacity) / units.Gi), int(results.total_capacity) / units.Gi),
'free_capacity_gb': ( 'free_capacity_gb': (

View File

@ -29,6 +29,7 @@ from oslo_utils import units
import six import six
from six.moves import http_client from six.moves import http_client
from cinder.common import constants
from cinder import context from cinder import context
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -956,7 +957,7 @@ class PowerFlexDriver(driver.VolumeDriver):
stats["volume_backend_name"] = backend_name or "powerflex" stats["volume_backend_name"] = backend_name or "powerflex"
stats["vendor_name"] = "Dell EMC" stats["vendor_name"] = "Dell EMC"
stats["driver_version"] = self.VERSION stats["driver_version"] = self.VERSION
stats["storage_protocol"] = "scaleio" stats["storage_protocol"] = constants.SCALEIO
stats["reserved_percentage"] = 0 stats["reserved_percentage"] = 0
stats["QoS_support"] = True stats["QoS_support"] = True
stats["consistent_group_snapshot_enabled"] = True stats["consistent_group_snapshot_enabled"] = True

View File

@ -17,6 +17,7 @@ import ast
from oslo_log import log as logging from oslo_log import log as logging
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder import interface from cinder import interface
from cinder.volume import driver from cinder.volume import driver
@ -538,7 +539,7 @@ class PowerMaxFCDriver(san.SanDriver, driver.FibreChannelDriver):
"""Retrieve stats info from volume group.""" """Retrieve stats info from volume group."""
LOG.debug("Updating volume stats") LOG.debug("Updating volume stats")
data = self.common.update_volume_stats() data = self.common.update_volume_stats()
data['storage_protocol'] = 'FC' data['storage_protocol'] = constants.FC
data['driver_version'] = self.VERSION data['driver_version'] = self.VERSION
self._stats = data self._stats = data

View File

@ -22,6 +22,7 @@ from oslo_log import log as logging
from oslo_utils import strutils from oslo_utils import strutils
import six import six
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -452,7 +453,7 @@ class PowerMaxISCSIDriver(san.SanISCSIDriver):
"""Retrieve stats info from volume group.""" """Retrieve stats info from volume group."""
LOG.debug("Updating volume stats") LOG.debug("Updating volume stats")
data = self.common.update_volume_stats() data = self.common.update_volume_stats()
data['storage_protocol'] = 'iSCSI' data['storage_protocol'] = constants.ISCSI
data['driver_version'] = self.VERSION data['driver_version'] = self.VERSION
self._stats = data self._stats = data

View File

@ -18,6 +18,7 @@
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import strutils from oslo_utils import strutils
from cinder.common import constants
from cinder import coordination from cinder import coordination
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -31,8 +32,8 @@ from cinder.volume import volume_utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
PROTOCOL_FC = "FC" PROTOCOL_FC = constants.FC
PROTOCOL_ISCSI = "iSCSI" PROTOCOL_ISCSI = constants.ISCSI
CHAP_MODE_SINGLE = "Single" CHAP_MODE_SINGLE = "Single"

View File

@ -24,6 +24,7 @@ import requests
import six import six
from six.moves import http_client from six.moves import http_client
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import utils from cinder import utils
@ -373,7 +374,7 @@ class SCApiHelper(object):
connection.excluded_domain_ips)) connection.excluded_domain_ips))
# Our primary SSN doesn't change # Our primary SSN doesn't change
connection.primaryssn = self.primaryssn connection.primaryssn = self.primaryssn
if self.storage_protocol == 'FC': if self.storage_protocol == constants.FC:
connection.protocol = 'FibreChannel' connection.protocol = 'FibreChannel'
# Set appropriate ssn and failover state. # Set appropriate ssn and failover state.
if self.active_backend_id: if self.active_backend_id:

View File

@ -19,6 +19,7 @@ from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
import six import six
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder.objects import fields from cinder.objects import fields
@ -112,7 +113,7 @@ class SCCommonDriver(driver.ManageableVD,
LOG.info('Loading %(name)s: Failover state is %(state)r', LOG.info('Loading %(name)s: Failover state is %(state)r',
{'name': self.backend_name, {'name': self.backend_name,
'state': self.failed_over}) 'state': self.failed_over})
self.storage_protocol = 'iSCSI' self.storage_protocol = constants.ISCSI
self.failback_timeout = 60 self.failback_timeout = 60
@staticmethod @staticmethod

View File

@ -17,6 +17,7 @@
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -77,7 +78,7 @@ class SCFCDriver(storagecenter_common.SCCommonDriver,
super(SCFCDriver, self).__init__(*args, **kwargs) super(SCFCDriver, self).__init__(*args, **kwargs)
self.backend_name =\ self.backend_name =\
self.configuration.safe_get('volume_backend_name') or 'Dell-FC' self.configuration.safe_get('volume_backend_name') or 'Dell-FC'
self.storage_protocol = 'FC' self.storage_protocol = constants.FC
def validate_connector(self, connector): def validate_connector(self, connector):
"""Fail if connector doesn't contain all the data needed by driver. """Fail if connector doesn't contain all the data needed by driver.

View File

@ -24,6 +24,7 @@ from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
from oslo_utils import importutils from oslo_utils import importutils
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder.objects import fields from cinder.objects import fields
@ -44,8 +45,8 @@ else:
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
PROTOCOL_FC = 'FC' PROTOCOL_FC = constants.FC
PROTOCOL_ISCSI = 'iSCSI' PROTOCOL_ISCSI = constants.ISCSI
class VolumeParams(object): class VolumeParams(object):

View File

@ -49,6 +49,7 @@ import requests
import six import six
from six.moves import http_client from six.moves import http_client
from cinder.common import constants
from cinder import context from cinder import context
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -1101,7 +1102,7 @@ class XtremIOISCSIDriver(XtremIOVolumeDriver, driver.ISCSIDriver):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(XtremIOISCSIDriver, self).__init__(*args, **kwargs) super(XtremIOISCSIDriver, self).__init__(*args, **kwargs)
self.protocol = 'iSCSI' self.protocol = constants.ISCSI
def _add_auth(self, data, login_chap, discovery_chap): def _add_auth(self, data, login_chap, discovery_chap):
login_passwd, discovery_passwd = None, None login_passwd, discovery_passwd = None, None
@ -1240,7 +1241,7 @@ class XtremIOFCDriver(XtremIOVolumeDriver,
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(XtremIOFCDriver, self).__init__(*args, **kwargs) super(XtremIOFCDriver, self).__init__(*args, **kwargs)
self.protocol = 'FC' self.protocol = constants.FC
self._targets = None self._targets = None
def get_targets(self): def get_targets(self):

View File

@ -22,6 +22,7 @@ FibreChannel Cinder Volume driver for Fujitsu ETERNUS DX S3 series.
from oslo_log import log as logging from oslo_log import log as logging
import six import six
from cinder.common import constants
from cinder import interface from cinder import interface
from cinder.volume import driver from cinder.volume import driver
from cinder.volume.drivers.fujitsu.eternus_dx import eternus_dx_common from cinder.volume.drivers.fujitsu.eternus_dx import eternus_dx_common
@ -202,7 +203,7 @@ class FJDXFCDriver(driver.FibreChannelDriver):
data, pool_name = self.common.update_volume_stats() data, pool_name = self.common.update_volume_stats()
backend_name = self.configuration.safe_get('volume_backend_name') backend_name = self.configuration.safe_get('volume_backend_name')
data['volume_backend_name'] = backend_name or 'FJDXFCDriver' data['volume_backend_name'] = backend_name or 'FJDXFCDriver'
data['storage_protocol'] = 'FC' data['storage_protocol'] = constants.FC
self._stats = data self._stats = data
LOG.debug('get_volume_stats, ' LOG.debug('get_volume_stats, '

View File

@ -20,6 +20,7 @@
from oslo_log import log as logging from oslo_log import log as logging
import six import six
from cinder.common import constants
from cinder import interface from cinder import interface
from cinder.volume import driver from cinder.volume import driver
from cinder.volume.drivers.fujitsu.eternus_dx import eternus_dx_common from cinder.volume.drivers.fujitsu.eternus_dx import eternus_dx_common
@ -192,7 +193,7 @@ class FJDXISCSIDriver(driver.ISCSIDriver):
data, pool_name = self.common.update_volume_stats() data, pool_name = self.common.update_volume_stats()
backend_name = self.configuration.safe_get('volume_backend_name') backend_name = self.configuration.safe_get('volume_backend_name')
data['volume_backend_name'] = backend_name or 'FJDXISCSIDriver' data['volume_backend_name'] = backend_name or 'FJDXISCSIDriver'
data['storage_protocol'] = 'iSCSI' data['storage_protocol'] = constants.ISCSI
self._stats = data self._stats = data
LOG.debug('get_volume_stats, ' LOG.debug('get_volume_stats, '

View File

@ -19,6 +19,7 @@ from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import units from oslo_utils import units
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -159,7 +160,7 @@ class DSWAREDriver(driver.VolumeDriver):
"thin_provisioning_support": False, "thin_provisioning_support": False,
"pools": [], "pools": [],
"vendor_name": "Huawei", "vendor_name": "Huawei",
"storage_protocol": "SCSI", "storage_protocol": constants.SCSI,
} }
all_pools = self.client.query_pool_info() all_pools = self.client.query_pool_info()

View File

@ -24,6 +24,7 @@ from oslo_log import log as logging
from oslo_utils import strutils from oslo_utils import strutils
from oslo_utils import units from oslo_utils import units
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -97,7 +98,7 @@ class HedvigISCSIDriver(driver.ISCSIDriver, san.SanDriver):
stats["volume_backend_name"] = "hedvig" stats["volume_backend_name"] = "hedvig"
stats["vendor_name"] = "Hedvig Inc" stats["vendor_name"] = "Hedvig Inc"
stats["driver_version"] = self.VERSION stats["driver_version"] = self.VERSION
stats["storage_protocol"] = "iSCSI" stats["storage_protocol"] = constants.ISCSI
stats["total_capacity_gb"] = total_capacity stats["total_capacity_gb"] = total_capacity
stats["free_capacity_gb"] = free_capacity stats["free_capacity_gb"] = free_capacity
stats["QoS_support"] = True stats["QoS_support"] = True

View File

@ -37,6 +37,7 @@ except ImportError:
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils.excutils import save_and_reraise_exception from oslo_utils.excutils import save_and_reraise_exception
from cinder.common import constants
from cinder import coordination from cinder import coordination
from cinder import interface from cinder import interface
from cinder.volume.drivers.hpe import hpe_3par_base as hpebasedriver from cinder.volume.drivers.hpe import hpe_3par_base as hpebasedriver
@ -125,7 +126,7 @@ class HPE3PARFCDriver(hpebasedriver.HPE3PARDriverBase):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(HPE3PARFCDriver, self).__init__(*args, **kwargs) super(HPE3PARFCDriver, self).__init__(*args, **kwargs)
self.lookup_service = fczm_utils.create_lookup_service() self.lookup_service = fczm_utils.create_lookup_service()
self.protocol = 'FC' self.protocol = constants.FC
def _initialize_connection_common(self, volume, connector, common, host, def _initialize_connection_common(self, volume, connector, common, host,
target_wwns, init_targ_map, numPaths, target_wwns, init_targ_map, numPaths,

View File

@ -38,6 +38,7 @@ except ImportError:
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils.excutils import save_and_reraise_exception from oslo_utils.excutils import save_and_reraise_exception
from cinder.common import constants
from cinder import coordination from cinder import coordination
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -138,7 +139,7 @@ class HPE3PARISCSIDriver(hpebasedriver.HPE3PARDriverBase):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(HPE3PARISCSIDriver, self).__init__(*args, **kwargs) super(HPE3PARISCSIDriver, self).__init__(*args, **kwargs)
self.protocol = 'iSCSI' self.protocol = constants.ISCSI
def _do_setup(self, common): def _do_setup(self, common):
client_obj = common.client client_obj = common.client

View File

@ -34,6 +34,7 @@ from oslo_utils import units
import requests import requests
import six import six
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -586,7 +587,7 @@ class NimbleBaseVolumeDriver(san.SanDriver):
password=self.configuration.san_password, password=self.configuration.san_password,
ip=self.configuration.san_ip, ip=self.configuration.san_ip,
verify=self.verify) verify=self.verify)
if self._storage_protocol == "iSCSI": if self._storage_protocol == constants.ISCSI:
group_info = self.APIExecutor.get_group_info() group_info = self.APIExecutor.get_group_info()
self._enable_group_scoped_target(group_info) self._enable_group_scoped_target(group_info)
except Exception: except Exception:
@ -670,10 +671,10 @@ class NimbleBaseVolumeDriver(san.SanDriver):
LOG.info('Creating initiator group %(grp)s ' LOG.info('Creating initiator group %(grp)s '
'with initiator %(iname)s', 'with initiator %(iname)s',
{'grp': igrp_name, 'iname': initiator_name}) {'grp': igrp_name, 'iname': initiator_name})
if self._storage_protocol == "iSCSI": if self._storage_protocol == constants.ISCSI:
self.APIExecutor.create_initiator_group(igrp_name) self.APIExecutor.create_initiator_group(igrp_name)
self.APIExecutor.add_initiator_to_igroup(igrp_name, initiator_name) self.APIExecutor.add_initiator_to_igroup(igrp_name, initiator_name)
elif self._storage_protocol == "FC": elif self._storage_protocol == constants.FC:
self.APIExecutor.create_initiator_group_fc(igrp_name) self.APIExecutor.create_initiator_group_fc(igrp_name)
for wwpn in wwpns: for wwpn in wwpns:
self.APIExecutor.add_initiator_to_igroup_fc(igrp_name, wwpn) self.APIExecutor.add_initiator_to_igroup_fc(igrp_name, wwpn)
@ -952,7 +953,7 @@ class NimbleISCSIDriver(NimbleBaseVolumeDriver, san.SanISCSIDriver):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(NimbleISCSIDriver, self).__init__(*args, **kwargs) super(NimbleISCSIDriver, self).__init__(*args, **kwargs)
self._storage_protocol = "iSCSI" self._storage_protocol = constants.ISCSI
self._group_target_name = None self._group_target_name = None
def _set_gst_for_group(self): def _set_gst_for_group(self):
@ -1126,7 +1127,7 @@ class NimbleFCDriver(NimbleBaseVolumeDriver, driver.FibreChannelDriver):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(NimbleFCDriver, self).__init__(*args, **kwargs) super(NimbleFCDriver, self).__init__(*args, **kwargs)
self._storage_protocol = "FC" self._storage_protocol = constants.FC
self._lookup_service = fczm_utils.create_lookup_service() self._lookup_service = fczm_utils.create_lookup_service()
def _get_provider_location(self, volume_name): def _get_provider_location(self, volume_name):
@ -1545,7 +1546,7 @@ class NimbleRestAPIExecutor(object):
'perfpolicy_id': perf_policy_id, 'perfpolicy_id': perf_policy_id,
'encryption_cipher': cipher}} 'encryption_cipher': cipher}}
if protocol == "iSCSI": if protocol == constants.ISCSI:
data['data']['multi_initiator'] = multi_initiator data['data']['multi_initiator'] = multi_initiator
if dedupe.lower() == 'true': if dedupe.lower() == 'true':
@ -2012,7 +2013,7 @@ class NimbleRestAPIExecutor(object):
"encryption_cipher": cipher "encryption_cipher": cipher
} }
} }
if protocol == "iSCSI": if protocol == constants.ISCSI:
data['data']['multi_initiator'] = multi_initiator data['data']['multi_initiator'] = multi_initiator
folder_id = None folder_id = None

View File

@ -18,6 +18,7 @@ import json
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import strutils from oslo_utils import strutils
from cinder.common import constants as cinder_constants
from cinder import coordination from cinder import coordination
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -72,7 +73,7 @@ class HuaweiISCSIDriver(common.HuaweiBaseDriver, driver.ISCSIDriver):
def get_volume_stats(self, refresh=False): def get_volume_stats(self, refresh=False):
"""Get volume status.""" """Get volume status."""
data = self._get_volume_stats(refresh=False) data = self._get_volume_stats(refresh=False)
data['storage_protocol'] = 'iSCSI' data['storage_protocol'] = cinder_constants.ISCSI
data['driver_version'] = self.VERSION data['driver_version'] = self.VERSION
return data return data
@ -264,7 +265,7 @@ class HuaweiFCDriver(common.HuaweiBaseDriver, driver.FibreChannelDriver):
def get_volume_stats(self, refresh=False): def get_volume_stats(self, refresh=False):
"""Get volume status.""" """Get volume status."""
data = self._get_volume_stats(refresh=False) data = self._get_volume_stats(refresh=False)
data['storage_protocol'] = 'FC' data['storage_protocol'] = cinder_constants.FC
data['driver_version'] = self.VERSION data['driver_version'] = self.VERSION
return data return data

View File

@ -28,6 +28,7 @@ from oslo_utils import units
import paramiko import paramiko
import six import six
from cinder.common import constants
from cinder import context from cinder import context
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -856,7 +857,7 @@ class GPFSDriver(driver.CloneableImageVD,
data["volume_backend_name"] = backend_name or 'GPFS' data["volume_backend_name"] = backend_name or 'GPFS'
data["vendor_name"] = 'IBM' data["vendor_name"] = 'IBM'
data["driver_version"] = self.VERSION data["driver_version"] = self.VERSION
data["storage_protocol"] = 'file' data["storage_protocol"] = constants.FILE
free, capacity = self._get_available_capacity(self.configuration. free, capacity = self._get_available_capacity(self.configuration.
gpfs_mount_point_base) gpfs_mount_point_base)
data['total_capacity_gb'] = math.ceil(capacity / units.Gi) data['total_capacity_gb'] = math.ceil(capacity / units.Gi)
@ -1561,7 +1562,7 @@ class GPFSNFSDriver(GPFSDriver, nfs.NfsDriver, san.SanDriver):
data['volume_backend_name'] = backend_name or 'GPFSNFS' data['volume_backend_name'] = backend_name or 'GPFSNFS'
data['vendor_name'] = 'IBM' data['vendor_name'] = 'IBM'
data['driver_version'] = self.get_version() data['driver_version'] = self.get_version()
data['storage_protocol'] = 'file' data['storage_protocol'] = constants.FILE
self._ensure_shares_mounted() self._ensure_shares_mounted()

View File

@ -39,6 +39,7 @@ from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
from oslo_utils import strutils from oslo_utils import strutils
from cinder.common import constants
from cinder import coordination from cinder import coordination
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -104,7 +105,7 @@ class StorwizeSVCISCSIDriver(storwize_common.StorwizeSVCCommonDriver):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(StorwizeSVCISCSIDriver, self).__init__(*args, **kwargs) super(StorwizeSVCISCSIDriver, self).__init__(*args, **kwargs)
self.protocol = 'iSCSI' self.protocol = constants.ISCSI
self.configuration.append_config_values( self.configuration.append_config_values(
storwize_svc_iscsi_opts) storwize_svc_iscsi_opts)

View File

@ -24,6 +24,7 @@ from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import units from oslo_utils import units
from cinder.common import constants
from cinder import coordination from cinder import coordination
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -164,12 +165,12 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
self._backend_name = backend_name or self.__class__.__name__ self._backend_name = backend_name or self.__class__.__name__
self._volume_stats = None self._volume_stats = None
if self.configuration.infinidat_storage_protocol.lower() == 'iscsi': if self.configuration.infinidat_storage_protocol.lower() == 'iscsi':
self._protocol = 'iSCSI' self._protocol = constants.ISCSI
if len(self.configuration.infinidat_iscsi_netspaces) == 0: if len(self.configuration.infinidat_iscsi_netspaces) == 0:
msg = _('No iSCSI network spaces configured') msg = _('No iSCSI network spaces configured')
raise exception.VolumeDriverException(message=msg) raise exception.VolumeDriverException(message=msg)
else: else:
self._protocol = 'FC' self._protocol = constants.FC
if (self.configuration.infinidat_use_compression and if (self.configuration.infinidat_use_compression and
not self._system.compat.has_compression()): not self._system.compat.has_compression()):
# InfiniBox systems support compression only from v3.0 and up # InfiniBox systems support compression only from v3.0 and up
@ -182,7 +183,8 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
LOG.debug('setup complete') LOG.debug('setup complete')
def validate_connector(self, connector): def validate_connector(self, connector):
required = 'initiator' if self._protocol == 'iSCSI' else 'wwpns' required = ('initiator' if self._protocol == constants.ISCSI
else 'wwpns')
if required not in connector: if required not in connector:
LOG.error('The volume driver requires %(data)s ' LOG.error('The volume driver requires %(data)s '
'in the connector.', {'data': required}) 'in the connector.', {'data': required})
@ -419,7 +421,7 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
if connector is None: if connector is None:
# If no connector was provided it is a force-detach - remove all # If no connector was provided it is a force-detach - remove all
# host connections for the volume # host connections for the volume
if self._protocol == 'FC': if self._protocol == constants.FC:
port_cls = wwn.WWN port_cls = wwn.WWN
else: else:
port_cls = iqn.IQN port_cls = iqn.IQN
@ -429,7 +431,7 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
host_ports = [port for port in host_ports host_ports = [port for port in host_ports
if isinstance(port, port_cls)] if isinstance(port, port_cls)]
ports.extend(host_ports) ports.extend(host_ports)
elif self._protocol == 'FC': elif self._protocol == constants.FC:
ports = [wwn.WWN(wwpn) for wwpn in connector['wwpns']] ports = [wwn.WWN(wwpn) for wwpn in connector['wwpns']]
else: else:
ports = [iqn.IQN(connector['initiator'])] ports = [iqn.IQN(connector['initiator'])]
@ -439,7 +441,7 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
@coordination.synchronized('infinidat-{self.management_address}-lock') @coordination.synchronized('infinidat-{self.management_address}-lock')
def initialize_connection(self, volume, connector): def initialize_connection(self, volume, connector):
"""Map an InfiniBox volume to the host""" """Map an InfiniBox volume to the host"""
if self._protocol == 'FC': if self._protocol == constants.FC:
return self._initialize_connection_fc(volume, connector) return self._initialize_connection_fc(volume, connector)
else: else:
return self._initialize_connection_iscsi(volume, connector) return self._initialize_connection_iscsi(volume, connector)
@ -449,7 +451,7 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
def terminate_connection(self, volume, connector, **kwargs): def terminate_connection(self, volume, connector, **kwargs):
"""Unmap an InfiniBox volume from the host""" """Unmap an InfiniBox volume from the host"""
infinidat_volume = self._get_infinidat_volume(volume) infinidat_volume = self._get_infinidat_volume(volume)
if self._protocol == 'FC': if self._protocol == constants.FC:
volume_type = 'fibre_channel' volume_type = 'fibre_channel'
else: else:
volume_type = 'iscsi' volume_type = 'iscsi'
@ -469,7 +471,7 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
# check if the host now doesn't have mappings # check if the host now doesn't have mappings
if host is not None and len(host.get_luns()) == 0: if host is not None and len(host.get_luns()) == 0:
host.safe_delete() host.safe_delete()
if self._protocol == 'FC' and connector is not None: if self._protocol == constants.FC and connector is not None:
# Create initiator-target mapping to delete host entry # Create initiator-target mapping to delete host entry
# this is only relevant for regular (specific host) detach # this is only relevant for regular (specific host) detach
target_wwpns = list(self._get_online_fc_ports()) target_wwpns = list(self._get_online_fc_ports())
@ -480,7 +482,7 @@ class InfiniboxVolumeDriver(san.SanISCSIDriver):
initiator_target_map=target_map) initiator_target_map=target_map)
conn_info = dict(driver_volume_type=volume_type, conn_info = dict(driver_volume_type=volume_type,
data=result_data) data=result_data)
if self._protocol == 'FC': if self._protocol == constants.FC:
fczm_utils.remove_fc_zone(conn_info) fczm_utils.remove_fc_zone(conn_info)
return conn_info return conn_info

View File

@ -29,6 +29,7 @@ from oslo_log import log as logging
from oslo_utils import units from oslo_utils import units
import requests import requests
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -176,7 +177,6 @@ class AS13000Driver(san.SanISCSIDriver):
VENDOR = 'INSPUR' VENDOR = 'INSPUR'
VERSION = '1.0.0' VERSION = '1.0.0'
PROTOCOL = 'iSCSI'
# ThirdPartySystems wiki page # ThirdPartySystems wiki page
CI_WIKI_NAME = 'Inspur_CI' CI_WIKI_NAME = 'Inspur_CI'
@ -474,7 +474,7 @@ class AS13000Driver(san.SanISCSIDriver):
backend_name = self.configuration.safe_get('volume_backend_name') backend_name = self.configuration.safe_get('volume_backend_name')
data['vendor_name'] = self.VENDOR data['vendor_name'] = self.VENDOR
data['driver_version'] = self.VERSION data['driver_version'] = self.VERSION
data['storage_protocol'] = self.PROTOCOL data['storage_protocol'] = constants.ISCSI
data['volume_backend_name'] = backend_name data['volume_backend_name'] = backend_name
data['pools'] = self._get_pools_stats() data['pools'] = self._get_pools_stats()

View File

@ -32,6 +32,7 @@ from oslo_utils import units
import paramiko import paramiko
import six import six
from cinder.common import constants
from cinder import context from cinder import context
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -212,11 +213,11 @@ class InStorageMCSCommonDriver(driver.VolumeDriver, san.SanDriver):
for k, node in self._state['storage_nodes'].items(): for k, node in self._state['storage_nodes'].items():
if ((len(node['ipv4']) or len(node['ipv6'])) and if ((len(node['ipv4']) or len(node['ipv6'])) and
len(node['iscsi_name'])): len(node['iscsi_name'])):
node['enabled_protocols'].append('iSCSI') node['enabled_protocols'].append(constants.ISCSI)
self._state['enabled_protocols'].add('iSCSI') self._state['enabled_protocols'].add(constants.ISCSI)
if len(node['WWPN']): if len(node['WWPN']):
node['enabled_protocols'].append('FC') node['enabled_protocols'].append(constants.FC)
self._state['enabled_protocols'].add('FC') self._state['enabled_protocols'].add(constants.FC)
if not len(node['enabled_protocols']): if not len(node['enabled_protocols']):
to_delete.append(k) to_delete.append(k)
for delkey in to_delete: for delkey in to_delete:

View File

@ -15,6 +15,7 @@
"""Volume driver for Kaminario K2 all-flash arrays.""" """Volume driver for Kaminario K2 all-flash arrays."""
from oslo_log import log as logging from oslo_log import log as logging
from cinder.common import constants
from cinder import coordination from cinder import coordination
from cinder.i18n import _ from cinder.i18n import _
from cinder.objects import fields from cinder.objects import fields
@ -45,7 +46,7 @@ class KaminarioFCDriver(common.KaminarioCinderDriver):
@volume_utils.trace @volume_utils.trace
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(KaminarioFCDriver, self).__init__(*args, **kwargs) super(KaminarioFCDriver, self).__init__(*args, **kwargs)
self._protocol = 'FC' self._protocol = constants.FC
self.lookup_service = fczm_utils.create_lookup_service() self.lookup_service = fczm_utils.create_lookup_service()
@volume_utils.trace @volume_utils.trace

View File

@ -15,6 +15,7 @@
"""Volume driver for Kaminario K2 all-flash arrays.""" """Volume driver for Kaminario K2 all-flash arrays."""
from oslo_log import log as logging from oslo_log import log as logging
from cinder.common import constants
from cinder import coordination from cinder import coordination
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -50,7 +51,7 @@ class KaminarioISCSIDriver(common.KaminarioCinderDriver):
@volume_utils.trace @volume_utils.trace
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(KaminarioISCSIDriver, self).__init__(*args, **kwargs) super(KaminarioISCSIDriver, self).__init__(*args, **kwargs)
self._protocol = 'iSCSI' self._protocol = constants.ISCSI
@volume_utils.trace @volume_utils.trace
@coordination.synchronized('{self.k2_lock_name}') @coordination.synchronized('{self.k2_lock_name}')

View File

@ -19,6 +19,7 @@ from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils.secretutils import md5 from oslo_utils.secretutils import md5
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -414,7 +415,7 @@ class KumoScaleBaseVolumeDriver(driver.BaseVD):
volume_backend_name=self._backend_name, volume_backend_name=self._backend_name,
vendor_name='KIOXIA', vendor_name='KIOXIA',
driver_version=self.VERSION, driver_version=self.VERSION,
storage_protocol='NVMeOF', storage_protocol=constants.NVMEOF_VARIANT_1,
) )
data['total_capacity_gb'] = 'unknown' data['total_capacity_gb'] = 'unknown'
data['free_capacity_gb'] = 'unknown' data['free_capacity_gb'] = 'unknown'

View File

@ -28,6 +28,7 @@ from oslo_utils import units
import requests import requests
import urllib3 import urllib3
from cinder.common import constants
from cinder import coordination from cinder import coordination
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -980,7 +981,6 @@ class LightOSVolumeDriver(driver.VolumeDriver):
backend_name = self.configuration.safe_get('volume_backend_name') backend_name = self.configuration.safe_get('volume_backend_name')
res_percentage = self.configuration.safe_get('reserved_percentage') res_percentage = self.configuration.safe_get('reserved_percentage')
storage_protocol = 'lightos'
# as a tenant we dont have access to cluster stats # as a tenant we dont have access to cluster stats
# in the future we might expose this per project via get_project API # in the future we might expose this per project via get_project API
# currently we remove this stats call. # currently we remove this stats call.
@ -989,7 +989,7 @@ class LightOSVolumeDriver(driver.VolumeDriver):
data = {'vendor_name': 'LightOS Storage', data = {'vendor_name': 'LightOS Storage',
'volume_backend_name': backend_name or self.__class__.__name__, 'volume_backend_name': backend_name or self.__class__.__name__,
'driver_version': self.VERSION, 'driver_version': self.VERSION,
'storage_protocol': storage_protocol, 'storage_protocol': constants.LIGHTOS,
'reserved_percentage': res_percentage, 'reserved_percentage': res_percentage,
'QoS_support': False, 'QoS_support': False,
'online_extend_support': True, 'online_extend_support': True,

View File

@ -27,6 +27,7 @@ from oslo_log import log as logging
from oslo_utils import importutils from oslo_utils import importutils
from oslo_utils import units from oslo_utils import units
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder.image import image_utils from cinder.image import image_utils
@ -1027,7 +1028,7 @@ class LinstorIscsiDriver(LinstorBaseDriver):
def get_volume_stats(self, refresh=False): def get_volume_stats(self, refresh=False):
data = self._get_volume_stats() data = self._get_volume_stats()
data["storage_protocol"] = 'iSCSI' data["storage_protocol"] = constants.ISCSI
data["pools"][0]["location_info"] = ( data["pools"][0]["location_info"] = (
'LinstorIscsiDriver:' + data["pools"][0]["location_info"]) 'LinstorIscsiDriver:' + data["pools"][0]["location_info"])
@ -1097,7 +1098,7 @@ class LinstorDrbdDriver(LinstorBaseDriver):
def get_volume_stats(self, refresh=False): def get_volume_stats(self, refresh=False):
data = self._get_volume_stats() data = self._get_volume_stats()
data["storage_protocol"] = 'DRBD' data["storage_protocol"] = constants.DRBD
data["pools"][0]["location_info"] = 'LinstorDrbdDriver:{}'.format( data["pools"][0]["location_info"] = 'LinstorDrbdDriver:{}'.format(
data["pools"][0]["location_info"]) data["pools"][0]["location_info"])

View File

@ -27,6 +27,7 @@ from oslo_utils import excutils
from oslo_utils import strutils from oslo_utils import strutils
from oslo_utils import timeutils from oslo_utils import timeutils
from cinder.common import constants
from cinder import context from cinder import context
from cinder.coordination import synchronized from cinder.coordination import synchronized
from cinder import exception from cinder import exception
@ -1023,7 +1024,7 @@ class MacroSANISCSIDriver(MacroSANBaseDriver, driver.ISCSIDriver):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
"""Initialize the driver.""" """Initialize the driver."""
super(MacroSANISCSIDriver, self).__init__(*args, **kwargs) super(MacroSANISCSIDriver, self).__init__(*args, **kwargs)
self.storage_protocol = 'iSCSI' self.storage_protocol = constants.ISCSI
def _do_setup(self): def _do_setup(self):
ports = self.client.get_iscsi_ports() ports = self.client.get_iscsi_ports()
@ -1224,7 +1225,7 @@ class MacroSANFCDriver(MacroSANBaseDriver, driver.FibreChannelDriver):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
"""Initialize the driver.""" """Initialize the driver."""
super(MacroSANFCDriver, self).__init__(*args, **kwargs) super(MacroSANFCDriver, self).__init__(*args, **kwargs)
self.storage_protocol = 'FC' self.storage_protocol = constants.FC
self.fcsan_lookup_service = None self.fcsan_lookup_service = None
self.use_sp_port_nr = self.configuration.macrosan_fc_use_sp_port_nr self.use_sp_port_nr = self.configuration.macrosan_fc_use_sp_port_nr
self.keep_mapped_ports = \ self.keep_mapped_ports = \

View File

@ -21,6 +21,7 @@ from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
from oslo_utils import units from oslo_utils import units
from cinder.common import constants
from cinder import coordination from cinder import coordination
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -1467,7 +1468,7 @@ class MStorageDriver(volume_common.MStorageVolumeCommon):
""" """
if refresh: if refresh:
self._stats = self._update_volume_status() self._stats = self._update_volume_status()
self._stats['storage_protocol'] = 'iSCSI' self._stats['storage_protocol'] = constants.ISCSI
LOG.debug('data=%(data)s, config_group=%(group)s', LOG.debug('data=%(data)s, config_group=%(group)s',
{'data': self._stats, 'group': self._config_group}) {'data': self._stats, 'group': self._config_group})
@ -1481,7 +1482,7 @@ class MStorageDriver(volume_common.MStorageVolumeCommon):
if refresh: if refresh:
self._stats = self._update_volume_status() self._stats = self._update_volume_status()
self._stats['storage_protocol'] = 'FC' self._stats['storage_protocol'] = constants.FC
LOG.debug('data=%(data)s, config_group=%(group)s', LOG.debug('data=%(data)s, config_group=%(group)s',
{'data': self._stats, 'group': self._config_group}) {'data': self._stats, 'group': self._config_group})

View File

@ -30,6 +30,7 @@ from oslo_utils import excutils
from oslo_utils import units from oslo_utils import units
import six import six
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder.image import image_utils from cinder.image import image_utils
@ -327,7 +328,7 @@ class NetAppCmodeNfsDriver(nfs_base.NetAppNfsDriver,
data['volume_backend_name'] = backend_name or self.driver_name data['volume_backend_name'] = backend_name or self.driver_name
data['vendor_name'] = 'NetApp' data['vendor_name'] = 'NetApp'
data['driver_version'] = self.VERSION data['driver_version'] = self.VERSION
data['storage_protocol'] = 'nfs' data['storage_protocol'] = constants.NFS_VARIANT
data['pools'] = self._get_pool_stats( data['pools'] = self._get_pool_stats(
filter_function=self.get_filter_function(), filter_function=self.get_filter_function(),
goodness_function=self.get_goodness_function()) goodness_function=self.get_goodness_function())

View File

@ -16,6 +16,7 @@ from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
import six import six
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -664,7 +665,7 @@ class NexentaISCSIDriver(driver.ISCSIDriver):
'compression': self.volume_compression, 'compression': self.volume_compression,
'description': self.volume_description, 'description': self.volume_description,
'driver_version': self.VERSION, 'driver_version': self.VERSION,
'storage_protocol': 'iSCSI', 'storage_protocol': constants.ISCSI,
'total_capacity_gb': total_amount, 'total_capacity_gb': total_amount,
'free_capacity_gb': free_amount, 'free_capacity_gb': free_amount,
'reserved_percentage': self.configuration.reserved_percentage, 'reserved_percentage': self.configuration.reserved_percentage,

View File

@ -23,6 +23,7 @@ from oslo_utils.secretutils import md5
from oslo_utils import units from oslo_utils import units
import six import six
from cinder.common import constants
from cinder import context from cinder import context
from cinder import db from cinder import db
from cinder import exception from cinder import exception
@ -823,7 +824,7 @@ class NexentaNfsDriver(nfs.NfsDriver): # pylint: disable=R0921
'nms_url': nms_url, 'nms_url': nms_url,
'ns_shares': self.shares_with_capacities, 'ns_shares': self.shares_with_capacities,
'driver_version': self.VERSION, 'driver_version': self.VERSION,
'storage_protocol': 'NFS', 'storage_protocol': constants.NFS,
'total_capacity_gb': total_space, 'total_capacity_gb': total_space,
'free_capacity_gb': free_space, 'free_capacity_gb': free_space,
'reserved_percentage': self.configuration.reserved_percentage, 'reserved_percentage': self.configuration.reserved_percentage,

View File

@ -22,6 +22,7 @@ from oslo_log import log as logging
from oslo_utils import units from oslo_utils import units
import six import six
from cinder.common import constants
from cinder import context from cinder import context
from cinder import coordination from cinder import coordination
from cinder.i18n import _ from cinder.i18n import _
@ -77,7 +78,7 @@ class NexentaISCSIDriver(driver.ISCSIDriver):
vendor_name = 'Nexenta' vendor_name = 'Nexenta'
product_name = 'NexentaStor5' product_name = 'NexentaStor5'
storage_protocol = 'iSCSI' storage_protocol = constants.ISCSI
driver_volume_type = 'iscsi' driver_volume_type = 'iscsi'
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -23,6 +23,7 @@ from oslo_utils.secretutils import md5
from oslo_utils import units from oslo_utils import units
import six import six
from cinder.common import constants
from cinder import context from cinder import context
from cinder import coordination from cinder import coordination
from cinder.i18n import _ from cinder.i18n import _
@ -88,7 +89,7 @@ class NexentaNfsDriver(nfs.NfsDriver):
vendor_name = 'Nexenta' vendor_name = 'Nexenta'
product_name = 'NexentaStor5' product_name = 'NexentaStor5'
storage_protocol = 'NFS' storage_protocol = constants.NFS
driver_volume_type = 'nfs' driver_volume_type = 'nfs'
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -20,6 +20,7 @@ import string
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import units as o_units from oslo_utils import units as o_units
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -743,7 +744,7 @@ class JovianISCSIDriver(driver.ISCSIDriver):
self._stats = { self._stats = {
'vendor_name': 'Open-E', 'vendor_name': 'Open-E',
'driver_version': self.VERSION, 'driver_version': self.VERSION,
'storage_protocol': 'iSCSI', 'storage_protocol': constants.ISCSI,
'total_capacity_gb': total_capacity, 'total_capacity_gb': total_capacity,
'free_capacity_gb': free_capacity, 'free_capacity_gb': free_capacity,
'reserved_percentage': int(reserved_percentage), 'reserved_percentage': int(reserved_percentage),

View File

@ -17,6 +17,7 @@ import errno
from oslo_log import log as logging from oslo_log import log as logging
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -389,7 +390,7 @@ class DPLFCDriver(dplcommon.DPLCOMMONDriver,
if refresh: if refresh:
data = super(DPLFCDriver, self).get_volume_stats(refresh) data = super(DPLFCDriver, self).get_volume_stats(refresh)
if data: if data:
data['storage_protocol'] = 'FC' data['storage_protocol'] = constants.FC
backend_name = \ backend_name = \
self.configuration.safe_get('volume_backend_name') self.configuration.safe_get('volume_backend_name')
data['volume_backend_name'] = (backend_name or 'DPLFCDriver') data['volume_backend_name'] = (backend_name or 'DPLFCDriver')

View File

@ -17,6 +17,7 @@ import errno
from oslo_log import log as logging from oslo_log import log as logging
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -144,7 +145,7 @@ class DPLISCSIDriver(dplcommon.DPLCOMMONDriver,
try: try:
data = super(DPLISCSIDriver, self).get_volume_stats(refresh) data = super(DPLISCSIDriver, self).get_volume_stats(refresh)
if data: if data:
data['storage_protocol'] = 'iSCSI' data['storage_protocol'] = constants.ISCSI
backend_name = \ backend_name = \
self.configuration.safe_get('volume_backend_name') self.configuration.safe_get('volume_backend_name')
data['volume_backend_name'] = \ data['volume_backend_name'] = \

View File

@ -34,6 +34,7 @@ import requests
import six import six
from six.moves import http_client from six.moves import http_client
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import objects from cinder import objects
@ -1455,7 +1456,7 @@ class DPLCOMMONDriver(driver.CloneableImageVD,
if ret == 0: if ret == 0:
data['vendor_name'] = output['metadata']['vendor'] data['vendor_name'] = output['metadata']['vendor']
data['driver_version'] = output['metadata']['version'] data['driver_version'] = output['metadata']['version']
data['storage_protocol'] = 'iSCSI' data['storage_protocol'] = constants.ISCSI
data['location_info'] = location_info data['location_info'] = location_info
data['consistencygroup_support'] = True data['consistencygroup_support'] = True
data['consistent_group_snapshot_enabled'] = True data['consistent_group_snapshot_enabled'] = True

View File

@ -35,6 +35,7 @@ try:
except ImportError: except ImportError:
purestorage = None purestorage = None
from cinder.common import constants
from cinder import context from cinder import context
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -2526,7 +2527,7 @@ class PureISCSIDriver(PureBaseVolumeDriver, san.SanISCSIDriver):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
execute = kwargs.pop("execute", utils.execute) execute = kwargs.pop("execute", utils.execute)
super(PureISCSIDriver, self).__init__(execute=execute, *args, **kwargs) super(PureISCSIDriver, self).__init__(execute=execute, *args, **kwargs)
self._storage_protocol = "iSCSI" self._storage_protocol = constants.ISCSI
def _get_host(self, array, connector, remote=False): def _get_host(self, array, connector, remote=False):
"""Return dict describing existing Purity host object or None.""" """Return dict describing existing Purity host object or None."""
@ -2748,7 +2749,7 @@ class PureFCDriver(PureBaseVolumeDriver, driver.FibreChannelDriver):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
execute = kwargs.pop("execute", utils.execute) execute = kwargs.pop("execute", utils.execute)
super(PureFCDriver, self).__init__(execute=execute, *args, **kwargs) super(PureFCDriver, self).__init__(execute=execute, *args, **kwargs)
self._storage_protocol = "FC" self._storage_protocol = constants.FC
self._lookup_service = fczm_utils.create_lookup_service() self._lookup_service = fczm_utils.create_lookup_service()
def _get_host(self, array, connector, remote=False): def _get_host(self, array, connector, remote=False):

View File

@ -35,6 +35,7 @@ import requests
import six import six
from six.moves import urllib from six.moves import urllib
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -51,7 +52,7 @@ qnap_opts = [
cfg.StrOpt('qnap_poolname', cfg.StrOpt('qnap_poolname',
help='The pool name in the QNAP Storage'), help='The pool name in the QNAP Storage'),
cfg.StrOpt('qnap_storage_protocol', cfg.StrOpt('qnap_storage_protocol',
default='iscsi', default=constants.ISCSI,
help='Communication protocol to access QNAP storage') help='Communication protocol to access QNAP storage')
] ]

View File

@ -40,6 +40,7 @@ except ImportError:
rados = None rados = None
rbd = None rbd = None
from cinder.common import constants
from cinder import context from cinder import context
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -243,7 +244,7 @@ class RBDDriver(driver.CloneableImageVD, driver.MigrateVD,
RBD_FEATURE_OBJECT_MAP = 8 RBD_FEATURE_OBJECT_MAP = 8
RBD_FEATURE_FAST_DIFF = 16 RBD_FEATURE_FAST_DIFF = 16
RBD_FEATURE_JOURNALING = 64 RBD_FEATURE_JOURNALING = 64
STORAGE_PROTOCOL = 'ceph' STORAGE_PROTOCOL = constants.CEPH
def __init__(self, def __init__(self,
active_backend_id: str = None, active_backend_id: str = None,
@ -2065,7 +2066,7 @@ class RBDDriver(driver.CloneableImageVD, driver.MigrateVD,
'migration.') 'migration.')
return refuse_to_migrate return refuse_to_migrate
if (host['capabilities']['storage_protocol'] != 'ceph'): if (host['capabilities']['storage_protocol'] != self.STORAGE_PROTOCOL):
LOG.debug('Source and destination drivers need to be RBD ' LOG.debug('Source and destination drivers need to be RBD '
'to use backend assisted migration. Falling back to ' 'to use backend assisted migration. Falling back to '
'generic migration.') 'generic migration.')

View File

@ -26,6 +26,7 @@ except ImportError:
RSDLib = None RSDLib = None
sushy_exceptions = None sushy_exceptions = None
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -594,7 +595,7 @@ class RSDDriver(driver.VolumeDriver):
self._stats['volume_backend_name'] = backend_name self._stats['volume_backend_name'] = backend_name
self._stats['vendor_name'] = 'Intel' self._stats['vendor_name'] = 'Intel'
self._stats['driver_version'] = self.VERSION self._stats['driver_version'] = self.VERSION
self._stats['storage_protocol'] = 'nvmeof' self._stats['storage_protocol'] = constants.NVMEOF_VARIANT_2
# SinglePool # SinglePool
self._stats['pools'] = [spool] self._stats['pools'] = [spool]

View File

@ -18,6 +18,7 @@ from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import units from oslo_utils import units
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -334,7 +335,7 @@ class SdsISCSIDriver(SdsBaseDriver, driver.ISCSIDriver):
data = SdsBaseDriver.get_volume_stats(self, refresh) data = SdsBaseDriver.get_volume_stats(self, refresh)
backend_name = self.configuration.safe_get('volume_backend_name') backend_name = self.configuration.safe_get('volume_backend_name')
data['volume_backend_name'] = backend_name or self.__class__.__name__ data['volume_backend_name'] = backend_name or self.__class__.__name__
data['storage_protocol'] = 'iSCSI' data['storage_protocol'] = constants.ISCSI
data['driver_version'] = self.VERSION data['driver_version'] = self.VERSION
data['vendor_name'] = 'SandStone USP' data['vendor_name'] = 'SandStone USP'
return data return data

View File

@ -31,6 +31,7 @@ from oslo_utils import units
import requests import requests
import six import six
from cinder.common import constants
from cinder import context from cinder import context
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -2163,7 +2164,7 @@ class SolidFireDriver(san.SanISCSIDriver):
data["volume_backend_name"] = backend_name or self.__class__.__name__ data["volume_backend_name"] = backend_name or self.__class__.__name__
data["vendor_name"] = 'SolidFire Inc' data["vendor_name"] = 'SolidFire Inc'
data["driver_version"] = self.VERSION data["driver_version"] = self.VERSION
data["storage_protocol"] = 'iSCSI' data["storage_protocol"] = constants.ISCSI
data['consistencygroup_support'] = True data['consistencygroup_support'] = True
data['consistent_group_snapshot_enabled'] = True data['consistent_group_snapshot_enabled'] = True
data['replication_enabled'] = self.replication_enabled data['replication_enabled'] = self.replication_enabled

View File

@ -19,6 +19,7 @@ from oslo_utils import importutils
from oslo_utils import units from oslo_utils import units
import requests import requests
from cinder.common import constants
from cinder import context from cinder import context
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -91,7 +92,7 @@ class SPDKDriver(driver.VolumeDriver):
status = {'volume_backend_name': 'SPDK', status = {'volume_backend_name': 'SPDK',
'vendor_name': 'Open Source', 'vendor_name': 'Open Source',
'driver_version': self.VERSION, 'driver_version': self.VERSION,
'storage_protocol': 'NVMe-oF'} 'storage_protocol': constants.NVMEOF}
pools_status = [] pools_status = []
self.lvs = [] self.lvs = []
@ -109,7 +110,7 @@ class SPDKDriver(driver.VolumeDriver):
pool["volume_backend_name"] = 'SPDK' pool["volume_backend_name"] = 'SPDK'
pool["vendor_name"] = 'Open Source' pool["vendor_name"] = 'Open Source'
pool["driver_version"] = self.VERSION pool["driver_version"] = self.VERSION
pool["storage_protocol"] = 'NVMe-oF' pool["storage_protocol"] = constants.NVMEOF
pool["total_capacity_gb"] = total_size pool["total_capacity_gb"] = total_size
pool["free_capacity_gb"] = free_size pool["free_capacity_gb"] = free_size
pool["pool_name"] = lvs['name'] pool["pool_name"] = lvs['name']

View File

@ -23,6 +23,7 @@ from oslo_utils import importutils
from oslo_utils import units from oslo_utils import units
import six import six
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -305,7 +306,7 @@ class StorPoolDriver(driver.VolumeDriver):
'volume_backend_name') or 'storpool', 'volume_backend_name') or 'storpool',
'vendor_name': 'StorPool', 'vendor_name': 'StorPool',
'driver_version': self.VERSION, 'driver_version': self.VERSION,
'storage_protocol': 'storpool', 'storage_protocol': constants.STORPOOL,
'sparse_copy_volume': True, 'sparse_copy_volume': True,

View File

@ -15,6 +15,7 @@
# under the License. # under the License.
# #
from cinder.common import constants
import cinder.volume.driver import cinder.volume.driver
import cinder.volume.drivers.san.san as san import cinder.volume.drivers.san.san as san
import cinder.volume.drivers.stx.common as common import cinder.volume.drivers.stx.common as common
@ -146,7 +147,7 @@ class STXFCDriver(cinder.volume.driver.FibreChannelDriver):
def get_volume_stats(self, refresh=False): def get_volume_stats(self, refresh=False):
stats = self.common.get_volume_stats(refresh) stats = self.common.get_volume_stats(refresh)
stats['storage_protocol'] = 'FC' stats['storage_protocol'] = constants.FC
stats['driver_version'] = self.VERSION stats['driver_version'] = self.VERSION
backend_name = self.configuration.safe_get('volume_backend_name') backend_name = self.configuration.safe_get('volume_backend_name')
stats['volume_backend_name'] = (backend_name or stats['volume_backend_name'] = (backend_name or

View File

@ -17,6 +17,7 @@
from oslo_log import log as logging from oslo_log import log as logging
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
import cinder.volume.driver import cinder.volume.driver
@ -161,7 +162,7 @@ class STXISCSIDriver(cinder.volume.driver.ISCSIDriver):
def get_volume_stats(self, refresh=False): def get_volume_stats(self, refresh=False):
stats = self.common.get_volume_stats(refresh) stats = self.common.get_volume_stats(refresh)
stats['storage_protocol'] = 'iSCSI' stats['storage_protocol'] = constants.ISCSI
stats['driver_version'] = self.VERSION stats['driver_version'] = self.VERSION
backend_name = self.configuration.safe_get('volume_backend_name') backend_name = self.configuration.safe_get('volume_backend_name')
stats['volume_backend_name'] = (backend_name or stats['volume_backend_name'] = (backend_name or

View File

@ -30,6 +30,7 @@ from oslo_utils import excutils
from oslo_utils import units from oslo_utils import units
import paramiko import paramiko
from cinder.common import constants
from cinder import coordination from cinder import coordination
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
@ -355,7 +356,7 @@ class Acs5000CommonDriver(san.SanDriver,
self._state.update(self._cmd.get_system()) self._state.update(self._cmd.get_system())
self._state['controller'] = self._cmd.ls_controller() self._state['controller'] = self._cmd.ls_controller()
if self.protocol == 'FC': if self.protocol == constants.FC:
ports = self._cmd.ls_fc() ports = self._cmd.ls_fc()
else: else:
ports = self._cmd.ls_iscsi() ports = self._cmd.ls_iscsi()

View File

@ -19,6 +19,7 @@ acs5000 FC driver
from oslo_log import log as logging from oslo_log import log as logging
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -42,7 +43,7 @@ class Acs5000FCDriver(acs5000_common.Acs5000CommonDriver):
VENDOR = 'TOYOU' VENDOR = 'TOYOU'
VERSION = '1.0.0' VERSION = '1.0.0'
PROTOCOL = 'FC' PROTOCOL = constants.FC
# ThirdPartySystems wiki page # ThirdPartySystems wiki page
CI_WIKI_NAME = 'TOYOU_ACS5000_CI' CI_WIKI_NAME = 'TOYOU_ACS5000_CI'

View File

@ -19,6 +19,7 @@ acs5000 iSCSI driver
from oslo_log import log as logging from oslo_log import log as logging
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -41,7 +42,7 @@ class Acs5000ISCSIDriver(acs5000_common.Acs5000CommonDriver):
VENDOR = 'TOYOU' VENDOR = 'TOYOU'
VERSION = '1.0.0' VERSION = '1.0.0'
PROTOCOL = 'iSCSI' PROTOCOL = constants.ISCSI
# ThirdPartySystems wiki page # ThirdPartySystems wiki page
CI_WIKI_NAME = 'TOYOU_ACS5000_CI' CI_WIKI_NAME = 'TOYOU_ACS5000_CI'

View File

@ -31,6 +31,7 @@ import requests
import requests.auth import requests.auth
from six.moves import http_client from six.moves import http_client
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -85,7 +86,6 @@ class ACCESSIscsiDriver(driver.ISCSIDriver):
VERSION = "1.0" VERSION = "1.0"
# ThirdPartySytems wiki page # ThirdPartySytems wiki page
CI_WIKI_NAME = "Veritas_Access_CI" CI_WIKI_NAME = "Veritas_Access_CI"
DRIVER_VOLUME_TYPE = 'iSCSI'
LUN_FOUND_INTERVAL = 30 # seconds LUN_FOUND_INTERVAL = 30 # seconds
# TODO(jsbryant) Remove driver in the 'U' release if CI is not fixed. # TODO(jsbryant) Remove driver in the 'U' release if CI is not fixed.
@ -892,7 +892,7 @@ class ACCESSIscsiDriver(driver.ISCSIDriver):
self._stats["vendor_name"] = 'Veritas' self._stats["vendor_name"] = 'Veritas'
self._stats["reserved_percentage"] = res_percentage or 0 self._stats["reserved_percentage"] = res_percentage or 0
self._stats["driver_version"] = self.VERSION self._stats["driver_version"] = self.VERSION
self._stats["storage_protocol"] = self.DRIVER_VOLUME_TYPE self._stats["storage_protocol"] = constants.ISCSI
self._stats['total_capacity_gb'] = total_capacity self._stats['total_capacity_gb'] = total_capacity
self._stats['free_capacity_gb'] = free_capacity self._stats['free_capacity_gb'] = free_capacity
self._stats['thin_provisioning_support'] = True self._stats['thin_provisioning_support'] = True

View File

@ -18,6 +18,7 @@ import os
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import excutils from oslo_utils import excutils
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -52,7 +53,7 @@ class VeritasCNFSDriver(nfs.NfsDriver):
VERSION = "1.0.3" VERSION = "1.0.3"
# ThirdPartySytems wiki page # ThirdPartySytems wiki page
CI_WIKI_NAME = "Veritas_Access_CI" CI_WIKI_NAME = "Veritas_Access_CI"
DRIVER_VOLUME_TYPE = 'nfs' DRIVER_VOLUME_TYPE = constants.NFS_VARIANT
# TODO(jsbryant) Remove driver in the 'V' release if CI is not fixed. # TODO(jsbryant) Remove driver in the 'V' release if CI is not fixed.
SUPPORTED = False SUPPORTED = False

View File

@ -27,6 +27,7 @@ from oslo_vmware import image_transfer
from oslo_vmware.objects import datastore from oslo_vmware.objects import datastore
from oslo_vmware import vim_util from oslo_vmware import vim_util
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -55,7 +56,7 @@ class VMwareVStorageObjectDriver(vmdk.VMwareVcVmdkDriver):
# minimum supported vCenter version # minimum supported vCenter version
MIN_SUPPORTED_VC_VERSION = '6.5' MIN_SUPPORTED_VC_VERSION = '6.5'
STORAGE_TYPE = 'vstorageobject' STORAGE_TYPE = constants.VSTORAGE
def do_setup(self, context): def do_setup(self, context):
"""Any initialization the volume driver needs to do while starting. """Any initialization the volume driver needs to do while starting.

View File

@ -37,6 +37,7 @@ from oslo_vmware import image_transfer
from oslo_vmware import pbm from oslo_vmware import pbm
from oslo_vmware import vim_util from oslo_vmware import vim_util
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder.image import image_utils from cinder.image import image_utils
@ -369,7 +370,7 @@ class VMwareVcVmdkDriver(driver.VolumeDriver):
data = {'volume_backend_name': backend_name, data = {'volume_backend_name': backend_name,
'vendor_name': 'VMware', 'vendor_name': 'VMware',
'driver_version': self.VERSION, 'driver_version': self.VERSION,
'storage_protocol': 'vmdk', 'storage_protocol': constants.VMDK,
'reserved_percentage': self.configuration.reserved_percentage, 'reserved_percentage': self.configuration.reserved_percentage,
'shared_targets': False} 'shared_targets': False}
ds_summaries = self._get_datastore_summaries() ds_summaries = self._get_datastore_summaries()

View File

@ -29,6 +29,7 @@ from oslo_utils import fileutils
from oslo_utils import units from oslo_utils import units
from oslo_utils import uuidutils from oslo_utils import uuidutils
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.image import image_utils from cinder.image import image_utils
from cinder import interface from cinder import interface
@ -334,7 +335,7 @@ class WindowsISCSIDriver(driver.ISCSIDriver):
data["volume_backend_name"] = backend_name or self.__class__.__name__ data["volume_backend_name"] = backend_name or self.__class__.__name__
data["vendor_name"] = 'Microsoft' data["vendor_name"] = 'Microsoft'
data["driver_version"] = self.VERSION data["driver_version"] = self.VERSION
data["storage_protocol"] = 'iSCSI' data["storage_protocol"] = constants.ISCSI
data['total_capacity_gb'] = total_gb data['total_capacity_gb'] = total_gb
data['free_capacity_gb'] = free_gb data['free_capacity_gb'] = free_gb
data['reserved_percentage'] = self.configuration.reserved_percentage data['reserved_percentage'] = self.configuration.reserved_percentage

View File

@ -22,6 +22,7 @@ from oslo_log import log as logging
from oslo_utils import strutils from oslo_utils import strutils
import six import six
from cinder.common import constants
from cinder import exception as cinder_exception from cinder import exception as cinder_exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import interface from cinder import interface
@ -709,9 +710,9 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
"""Retrieve stats info from volume group.""" """Retrieve stats info from volume group."""
LOG.debug("Updating volume stats") LOG.debug("Updating volume stats")
backend_name = self.configuration.safe_get('volume_backend_name') backend_name = self.configuration.safe_get('volume_backend_name')
storage_protocol = ('iSER' if storage_protocol = (constants.ISER if
(self.configuration.safe_get('zadara_use_iser')) (self.configuration.safe_get('zadara_use_iser'))
else 'iSCSI') else constants.ISCSI)
pool_name = self.configuration.zadara_vpsa_poolname pool_name = self.configuration.zadara_vpsa_poolname
(total, free, provisioned) = self.vpsa._get_pool_capacity(pool_name) (total, free, provisioned) = self.vpsa._get_pool_capacity(pool_name)
data = dict( data = dict(

View File

@ -844,9 +844,10 @@ class VolumeManager(manager.CleanableManager,
# Shared targets is only relevant for iSCSI connections. # Shared targets is only relevant for iSCSI connections.
# We default to True to be on the safe side. # We default to True to be on the safe side.
capabilities = self.driver.capabilities
volume.shared_targets = ( volume.shared_targets = (
self.driver.capabilities.get('storage_protocol') == 'iSCSI' and capabilities.get('storage_protocol') in constants.ISCSI_VARIANTS
self.driver.capabilities.get('shared_targets', True)) and capabilities.get('shared_targets', True))
# TODO(geguileo): service_uuid won't be enough on Active/Active # TODO(geguileo): service_uuid won't be enough on Active/Active
# deployments. There can be 2 services handling volumes from the same # deployments. There can be 2 services handling volumes from the same
# backend. # backend.
@ -2761,8 +2762,8 @@ class VolumeManager(manager.CleanableManager,
# Append cacheable flag for iSCSI/FC/NVMe-oF and only when # Append cacheable flag for iSCSI/FC/NVMe-oF and only when
# cacheable is not set in driver level # cacheable is not set in driver level
if volume_stats.get('storage_protocol') in [ if (volume_stats.get('storage_protocol')
'iSCSI', 'FC', 'NVMe-oF']: in constants.CACHEABLE_PROTOCOLS):
if volume_stats.get('pools'): if volume_stats.get('pools'):
for pool in volume_stats.get('pools'): for pool in volume_stats.get('pools'):
if pool.get('cacheable') is None: if pool.get('cacheable') is None:

View File

@ -15,6 +15,7 @@ import abc
from oslo_concurrency import processutils from oslo_concurrency import processutils
from oslo_log import log as logging from oslo_log import log as logging
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder import utils from cinder import utils
@ -37,7 +38,7 @@ class ISCSITarget(driver.Target):
super(ISCSITarget, self).__init__(*args, **kwargs) super(ISCSITarget, self).__init__(*args, **kwargs)
self.iscsi_target_prefix = self.configuration.safe_get('target_prefix') self.iscsi_target_prefix = self.configuration.safe_get('target_prefix')
self.iscsi_protocol = self.configuration.safe_get('target_protocol') self.iscsi_protocol = self.configuration.safe_get('target_protocol')
self.protocol = 'iSCSI' self.protocol = constants.ISCSI
self.volumes_dir = self.configuration.safe_get('volumes_dir') self.volumes_dir = self.configuration.safe_get('volumes_dir')
def _get_iscsi_properties(self, volume, multipath=False): def _get_iscsi_properties(self, volume, multipath=False):

View File

@ -14,6 +14,7 @@ import abc
from oslo_log import log as logging from oslo_log import log as logging
from cinder.common import constants
from cinder import exception from cinder import exception
from cinder.i18n import _ from cinder.i18n import _
from cinder.volume.targets import driver from cinder.volume.targets import driver
@ -31,7 +32,7 @@ class NVMeOF(driver.Target):
"""Target object for block storage devices with RDMA transport.""" """Target object for block storage devices with RDMA transport."""
protocol = 'nvmeof' protocol = constants.NVMEOF_VARIANT_2
target_protocol_map = { target_protocol_map = {
'nvmet_rdma': 'rdma', 'nvmet_rdma': 'rdma',
'nvmet_tcp': 'tcp', 'nvmet_tcp': 'tcp',

View File

@ -0,0 +1,5 @@
---
fixes:
- |
`Bug #1969366 <https://bugs.launchpad.net/cinder/+bug/1969366>`_: Fixed
reporting of cacheable capability by drivers.