Skip to content

Commit

Permalink
Merge "solidfire: Add ability to override account prefix"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed May 14, 2013
2 parents 4558d68 + f9fd91e commit e831013
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions cinder/tests/test_solidfire.py
Expand Up @@ -44,6 +44,7 @@ def setUp(self):
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',
Expand Down
10 changes: 8 additions & 2 deletions cinder/volume/drivers/solidfire.py
Expand Up @@ -43,7 +43,11 @@

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):
Expand Down Expand Up @@ -190,7 +194,9 @@ def _get_sfaccount_by_name(self, sf_account_name):

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)
Expand Down

0 comments on commit e831013

Please sign in to comment.