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,
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'])
'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,
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