]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add SolidFire svip to config options
authorJohn Griffith <john.griffith8@gmail.com>
Thu, 20 Aug 2015 21:49:59 +0000 (15:49 -0600)
committerJohn Griffith <john.griffith8@gmail.com>
Thu, 20 Aug 2015 21:49:59 +0000 (15:49 -0600)
The SolidFire driver uses a simple method of gathering
the Storage Virtual IP, it just queries the Cluster and
asks for the SVIP. This is great almost all the time,
BUT it doesn't take into consideration that the deployer
may be using VLAN's and accessing the cluster from multiple
clouds, or multiple networks.

This patch just adds a config option to specify an SVIP
if the admin has configured VLANs in their environment and
on their cluster.  The default behavior is to still use the
global SVIP.

Change-Id: I10b784f903cd8d16580110f01d338a3ad867eada
Closes-Bug: #1487194

cinder/tests/unit/test_solidfire.py
cinder/volume/drivers/solidfire.py

index 80514573194f3c1418008e3a541668d159e5f95b..6ae121dd6f2f2b169ac4d4fa5a49c2761e603caa 100644 (file)
@@ -49,6 +49,7 @@ class SolidFireVolumeTestCase(test.TestCase):
         self.configuration.iscsi_helper = None
         self.configuration.sf_template_account_name = 'openstack-vtemplate'
         self.configuration.sf_allow_template_caching = False
+        self.configuration.sf_svip = None
 
         super(SolidFireVolumeTestCase, self).setUp()
         self.stubs.Set(solidfire.SolidFireDriver,
@@ -984,3 +985,31 @@ class SolidFireVolumeTestCase(test.TestCase):
                                side_effect=_fake_issue_api_req):
             self.assertEqual(1,
                              sfv._create_template_account('foo'))
+
+    def test_configured_svip(self):
+        sfv = solidfire.SolidFireDriver(configuration=self.configuration)
+
+        def _fake_get_volumes(account_id):
+            return [{'volumeID': 1,
+                     'iqn': ''}]
+
+        def _fake_get_cluster_info():
+            return {'clusterInfo': {'svip': 1}}
+
+        with mock.patch.object(sfv,
+                               '_get_volumes_by_sfaccount',
+                               side_effect=_fake_get_volumes),\
+                mock.patch.object(sfv,
+                                  '_issue_api_request',
+                                  side_effect=self.fake_issue_api_request):
+
+            sfaccount = {'targetSecret': 'yakitiyak',
+                         'accountID': 5,
+                         'username': 'bobthebuilder'}
+            v = sfv._get_model_info(sfaccount, 1)
+            self.assertEqual('1.1.1.1:3260  0', v['provider_location'])
+
+            configured_svip = '9.9.9.9:6500'
+            self.configuration.sf_svip = configured_svip
+            v = sfv._get_model_info(sfaccount, 1)
+            self.assertEqual('%s  0' % configured_svip, v['provider_location'])
index c209c088b620ef11e354f92d9becaacf4566fb36..0d9d27c44757295cb3704776c4af7cf2d4fb5c53 100644 (file)
@@ -68,6 +68,13 @@ sf_opts = [
                      'a bootable volume is created to eliminate fetch from '
                      'glance and qemu-conversion on subsequent calls.'),
 
+    cfg.StrOpt('sf_svip',
+               default=None,
+               help='Overrides default cluster SVIP with the one specified. '
+                    'This is required or deployments that have implemented '
+                    'the use of VLANs for iSCSI networks in their cloud.'),
+
+
     cfg.IntOpt('sf_api_port',
                default=443,
                min=1, max=65535,
@@ -320,7 +327,10 @@ class SolidFireDriver(san.SanISCSIDriver):
     def _get_model_info(self, sfaccount, sf_volume_id):
         """Gets the connection info for specified account and volume."""
         cluster_info = self._get_cluster_info()
-        iscsi_portal = cluster_info['clusterInfo']['svip'] + ':3260'
+        if self.configuration.sf_svip is None:
+            iscsi_portal = cluster_info['clusterInfo']['svip'] + ':3260'
+        else:
+            iscsi_portal = self.configuration.sf_svip
         chap_secret = sfaccount['targetSecret']
 
         found_volume = False