]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Remove dynamic default on sf_account_prefix
authorDirk Mueller <dirk@dmllr.de>
Thu, 12 Dec 2013 17:05:31 +0000 (18:05 +0100)
committerDirk Mueller <dirk@dmllr.de>
Tue, 17 Dec 2013 13:33:38 +0000 (14:33 +0100)
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
etc/cinder/cinder.conf.sample

index d862048625002387062eee7c6f9fa7a7c871cb3d..a0e87d443b6a6724a406fea3d9727f06e0905655 100644 (file)
@@ -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)
index 60cdd824ab993f402226f81c8c35d8b646d72c42..b0cdb7213c18095142fb8321cbf15b8a963f4f2b 100644 (file)
 # 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=<None>
 
 # SolidFire API port. Useful if the device api is behind a
 # proxy on a different port. (integer value)