Modify default prefix for solidfire account

The SolidFire driver creates a unique account at volume
creation composed of <cinderhost-tenantID>.This is fine
until one tries to implement HA Cinder or moves their
Cinder node to another machine.

This patch changes the default setting to be an empty string
(ie no prefix), but still allows backward compatability by setting
the config option to 'hostname'.

DocImpact: Changes default for account-prefix, for backwards compatability
use the non-default 'hostname'

Change-Id: I500ea14c1b4e9e3efd51c035cc3c4e6232da9dd6
Closes-Bug: 1265208
This commit is contained in:
john-griffith
2013-12-31 09:04:05 -07:00
parent 9fbb0b19b1
commit 5b74ecbcce
2 changed files with 11 additions and 5 deletions

View File

@@ -47,8 +47,10 @@ sf_opts = [
cfg.StrOpt('sf_account_prefix',
default=None,
help='Create SolidFire accounts with this prefix. Uses current '
'hostname if unset (default).'),
help='Create SolidFire accounts with this prefix. Any string '
'can be used here, but the string \"hostname\" is special '
'and will create a prefix using the cinder node hostsname '
'(previous default behavior). The default is NO prefix.'),
cfg.IntOpt('sf_api_port',
default=443,
@@ -224,7 +226,9 @@ class SolidFireDriver(SanISCSIDriver):
def _get_sf_account_name(self, project_id):
"""Build the SolidFire account name to use."""
prefix = self.configuration.sf_account_prefix or socket.gethostname()
prefix = self.configuration.sf_account_prefix or ''
if prefix == 'hostname':
prefix = socket.gethostname()
return '%s%s%s' % (prefix, '-' if prefix else '', project_id)
def _get_sfaccount(self, project_id):

View File

@@ -1620,8 +1620,10 @@
# Allow tenants to specify QOS on create (boolean value)
#sf_allow_tenant_qos=false
# Create SolidFire accounts with this prefix. Uses current
# hostname if unset (default). (string value)
# Create SolidFire accounts with this prefix. Any string can
# be used here, but the string "hostname" is special and will
# create a prefix using the cinder node hostsname (previous
# default behavior). The default is NO prefix. (string value)
#sf_account_prefix=<None>
# SolidFire API port. Useful if the device api is behind a