From: Mathieu Gagné Date: Mon, 13 May 2013 21:05:21 +0000 (-0400) Subject: solidfire: Add ability to override account prefix X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f9fd91e05e7d8d4a7d3a4659ba3c0ebd483732e1;p=openstack-build%2Fcinder-build.git solidfire: Add ability to override account prefix The SolidFire account is created with a prefix based on the hostname of the host running cinder-volume. This prevents cinder-volume from being run in an active/active setup. This patch introduces a new configuration option sf_account_prefix to override the prefix used when a SolidFire account is created. If sf_account_prefix is empty, no prefix will be added to the SolidFire account name when created. The default value is still the hostname. Change-Id: I3b974789ea3e749cc8696b69754023ad76155179 Fixes: bug #1179671 --- diff --git a/cinder/tests/test_solidfire.py b/cinder/tests/test_solidfire.py index 40dfa419a..8679f4142 100644 --- a/cinder/tests/test_solidfire.py +++ b/cinder/tests/test_solidfire.py @@ -44,6 +44,7 @@ class SolidFireVolumeTestCase(test.TestCase): self.configuration.sf_allow_tenant_qos = True self.configuration.san_is_local = True self.configuration.sf_emulate_512 = True + self.configuration.sf_account_prefix = 'cinder' super(SolidFireVolumeTestCase, self).setUp() self.stubs.Set(SolidFire, '_issue_api_request', diff --git a/cinder/volume/drivers/solidfire.py b/cinder/volume/drivers/solidfire.py index 85aba46e8..602da4d8a 100644 --- a/cinder/volume/drivers/solidfire.py +++ b/cinder/volume/drivers/solidfire.py @@ -43,7 +43,11 @@ sf_opts = [ cfg.BoolOpt('sf_allow_tenant_qos', default=False, - help='Allow tenants to specify QOS on create'), ] + help='Allow tenants to specify QOS on create'), + + cfg.StrOpt('sf_account_prefix', + default=socket.gethostname(), + help='Create SolidFire accounts with this prefix'), ] class SolidFire(SanISCSIDriver): @@ -190,7 +194,9 @@ class SolidFire(SanISCSIDriver): def _get_sf_account_name(self, project_id): """Build the SolidFire account name to use.""" - return ('%s-%s' % (socket.gethostname(), project_id)) + return '%s%s%s' % (self.configuration.sf_account_prefix, + '-' if self.configuration.sf_account_prefix else '', + project_id) def _get_sfaccount(self, project_id): sf_account_name = self._get_sf_account_name(project_id)