From 9fbb0b19b145099a8275e19f2bcf89c220bb9c6e Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 12 Dec 2013 18:05:31 +0100 Subject: [PATCH] Remove dynamic default on sf_account_prefix A dynamic default makes it difficult to generate a proper cinder.conf.sample template. Make it default to the hostname when the option is unset or left at default. DocImpact: default of sf_account_prefix changed to "None", which however preserves behavior of a previously unset option: use the current hostname. Change-Id: Ic90305bd93ae0156c37e32012cdc32848192de07 --- cinder/volume/drivers/solidfire.py | 10 +++++----- etc/cinder/cinder.conf.sample | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/cinder/volume/drivers/solidfire.py b/cinder/volume/drivers/solidfire.py index d86204862..a0e87d443 100644 --- a/cinder/volume/drivers/solidfire.py +++ b/cinder/volume/drivers/solidfire.py @@ -46,8 +46,9 @@ sf_opts = [ help='Allow tenants to specify QOS on create'), cfg.StrOpt('sf_account_prefix', - default=socket.gethostname(), - help='Create SolidFire accounts with this prefix'), + default=None, + help='Create SolidFire accounts with this prefix. Uses current ' + 'hostname if unset (default).'), cfg.IntOpt('sf_api_port', default=443, @@ -223,9 +224,8 @@ class SolidFireDriver(SanISCSIDriver): def _get_sf_account_name(self, project_id): """Build the SolidFire account name to use.""" - return '%s%s%s' % (self.configuration.sf_account_prefix, - '-' if self.configuration.sf_account_prefix else '', - project_id) + prefix = self.configuration.sf_account_prefix or socket.gethostname() + return '%s%s%s' % (prefix, '-' if prefix else '', project_id) def _get_sfaccount(self, project_id): sf_account_name = self._get_sf_account_name(project_id) diff --git a/etc/cinder/cinder.conf.sample b/etc/cinder/cinder.conf.sample index 60cdd824a..b0cdb7213 100644 --- a/etc/cinder/cinder.conf.sample +++ b/etc/cinder/cinder.conf.sample @@ -1620,8 +1620,9 @@ # Allow tenants to specify QOS on create (boolean value) #sf_allow_tenant_qos=false -# Create SolidFire accounts with this prefix (string value) -#sf_account_prefix=cinder +# Create SolidFire accounts with this prefix. Uses current +# hostname if unset (default). (string value) +#sf_account_prefix= # SolidFire API port. Useful if the device api is behind a # proxy on a different port. (integer value) -- 2.45.2