diff --git a/cinder/tests/unit/volume/drivers/disco/__init__.py b/cinder/tests/unit/volume/drivers/disco/__init__.py index 42c795e4723..8460126e062 100644 --- a/cinder/tests/unit/volume/drivers/disco/__init__.py +++ b/cinder/tests/unit/volume/drivers/disco/__init__.py @@ -59,6 +59,8 @@ class TestDISCODriver(test.TestCase): self.cfg.num_volume_device_scan_tries = 3 self.cfg.disco_choice_client = 'SOAP' self.cfg.disco_rest_ip = '127.0.0.1' + self.cfg.san_ip = '127.0.0.1' + self.cfg.san_api_port = '8080' self.FAKE_RESPONSE = { 'standard': { diff --git a/cinder/volume/drivers/disco/disco.py b/cinder/volume/drivers/disco/disco.py index 67b9ffc6203..54a41cecaa4 100644 --- a/cinder/volume/drivers/disco/disco.py +++ b/cinder/volume/drivers/disco/disco.py @@ -35,6 +35,7 @@ from cinder.volume import configuration from cinder.volume import driver from cinder.volume.drivers.disco import disco_api from cinder.volume.drivers.disco import disco_attach_detach +from cinder.volume.drivers.san import san LOG = logging.getLogger(__name__) @@ -55,6 +56,8 @@ disco_opts = [ 'to communicate with DISCO request manager'), cfg.IPOpt('disco_rest_ip', help='The IP address of the REST server', + deprecated_for_removal=True, + deprecated_reason='Using san_ip later', deprecated_name='rest_ip', deprecated_group='DEFAULT'), cfg.StrOpt('disco_choice_client', help='Use soap client or rest client for communicating ' @@ -63,6 +66,8 @@ disco_opts = [ deprecated_name='choice_client', deprecated_group='DEFAULT'), cfg.PortOpt('disco_src_api_port', default=8080, + deprecated_for_removal=True, + deprecated_reason='Using san_api_port later', help='The port of DISCO source API', deprecated_group='DEFAULT'), cfg.StrOpt('disco_volume_name_prefix', @@ -124,6 +129,7 @@ class DiscoDriver(driver.VolumeDriver): """Init Disco driver : get configuration, create client.""" super(DiscoDriver, self).__init__(*args, **kwargs) self.configuration.append_config_values(disco_opts) + self.configuration.append_config_values(san.san_opts) self.ctxt = context.get_admin_context() self.attach_detach_volume = ( disco_attach_detach.AttachDetachDiscoVolume(self.configuration)) @@ -131,7 +137,13 @@ class DiscoDriver(driver.VolumeDriver): def do_setup(self, context): """Create client for DISCO request manager.""" LOG.debug("Enter in DiscoDriver do_setup.") - if self.configuration.disco_choice_client.lower() == "rest": + if (self.configuration.disco_choice_client.lower() == "rest" and + self.configuration.san_ip): + self.client = disco_api.DiscoApi( + self.configuration.san_ip, + self.configuration.san_api_port) + elif (self.configuration.disco_choice_client.lower() == "rest" and + self.configuration.disco_rest_ip): self.client = disco_api.DiscoApi( self.configuration.disco_rest_ip, self.configuration.disco_src_api_port) @@ -142,15 +154,16 @@ class DiscoDriver(driver.VolumeDriver): def check_for_setup_error(self): """Make sure we have the pre-requisites.""" - if (not self.configuration.disco_rest_ip and - self.configuration.disco_choice_client.lower() == "rest"): - msg = _("Could not find the IP address of the REST server.") - raise exception.VolumeBackendAPIException(data=msg) - else: + if self.configuration.disco_choice_client.lower() == "soap": path = self.configuration.disco_wsdl_path if not os.path.exists(path): msg = _("Could not find DISCO wsdl file.") raise exception.VolumeBackendAPIException(data=msg) + else: + if not (self.configuration.disco_rest_ip or + self.configuration.san_ip): + msg = _("Could not find the IP address of the REST server.") + raise exception.VolumeBackendAPIException(data=msg) def create_volume(self, volume): """Create a disco volume.""" diff --git a/cinder/volume/drivers/san/san.py b/cinder/volume/drivers/san/san.py index a5de68831c4..20e626c41ca 100644 --- a/cinder/volume/drivers/san/san.py +++ b/cinder/volume/drivers/san/san.py @@ -59,6 +59,8 @@ san_opts = [ cfg.PortOpt('san_ssh_port', default=22, help='SSH port to use with SAN'), + cfg.PortOpt('san_api_port', + help='Port to use to access the SAN API'), cfg.BoolOpt('san_is_local', default=False, help='Execute commands locally instead of over SSH; ' diff --git a/releasenotes/notes/update_config_options_disco_volume_driver-07e52aa43e83c243.yaml b/releasenotes/notes/update_config_options_disco_volume_driver-07e52aa43e83c243.yaml new file mode 100644 index 00000000000..0d882140105 --- /dev/null +++ b/releasenotes/notes/update_config_options_disco_volume_driver-07e52aa43e83c243.yaml @@ -0,0 +1,13 @@ +--- +upgrade: + - | + We replaced the config option in the disco volume driver + "disco_choice_client" with "disco_client_protocol". + We add "san_api_port" as new config option in san driver for accessing + the SAN API using this port. +Deprecations: + - | + Marked the ITRI DISCO driver option 'disco_rest_api' as deprecated + in order to use the config 'san_ip' provided by the generic driver san. + Marked the ITRI DISCO driver option 'disco_src_api_port' as deprecated + in order to use the config 'san_ssh_port' provided by the generic driver san.