From: Kazumasa Nomura Date: Thu, 25 Jun 2015 18:33:16 +0000 (+0900) Subject: Fix cinder.conf.sample generation X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=b3c6764918064bea53d1f1fce712893652c94350;p=openstack-build%2Fcinder-build.git Fix cinder.conf.sample generation Introduction of the hp_xp driver broke cinder.conf.sample generation due to the way the driver was registering the configuration items. Originally the options were being included into the FC driver file and registered there. When the config generator found the options in the separate hp_xp_opts.py file it did not know what group to include the options in since they were not registered at all. This fix moves registration of the options to the hp_xp_opts.py file so that the config generation will work. Since cfg.CONF is a global, the hp_xp driver will still have access to the options in there after they are set by importing the opts file. An additional problem that was uncovered when creating this fix is the fact that the old config generator we are using from oslo-incubator doesn't support using cfg.Opt. To temporarily workaround this I have changed the cfg.Opts to be cfg.IntOpts or cfg.ListOpts(as appropriate) and documented the valid values for those options. The last change that was necessary was to add config values for several of the options in cinder/tests.py as the options were marked as required by the driver. If values were not set this caused oslo config to error out reporting that they values needed to be set. Change-Id: Ie47d38c2f8fde675cf00ea2ec9abf60691c57ef9 Closes-Bug: 1466198 Signed-off-by: Jay S. Bryant, Kazumasa Nomura --- diff --git a/cinder/volume/drivers/san/hp/hp_xp_fc.py b/cinder/volume/drivers/san/hp/hp_xp_fc.py index 2e84087b1..b67f5d952 100644 --- a/cinder/volume/drivers/san/hp/hp_xp_fc.py +++ b/cinder/volume/drivers/san/hp/hp_xp_fc.py @@ -16,7 +16,6 @@ Fibre channel Cinder volume driver for Hewlett-Packard storage. """ -from oslo_config import cfg from oslo_utils import importutils from cinder.volume import driver @@ -26,9 +25,6 @@ from cinder.zonemanager import utils as fczm_utils _DRIVER_DIR = 'cinder.volume.drivers.san.hp' _DRIVER_CLASS = 'hp_xp_horcm_fc.HPXPHORCMFC' -CONF = cfg.CONF -CONF.register_opts(opts.FC_VOLUME_OPTS) - class HPXPFCDriver(driver.FibreChannelDriver): """OpenStack Fibre Channel driver to enable HP XP storage.""" diff --git a/cinder/volume/drivers/san/hp/hp_xp_opts.py b/cinder/volume/drivers/san/hp/hp_xp_opts.py index 3dcb68d93..277e878eb 100644 --- a/cinder/volume/drivers/san/hp/hp_xp_opts.py +++ b/cinder/volume/drivers/san/hp/hp_xp_opts.py @@ -14,7 +14,6 @@ """HP XP driver options.""" from oslo_config import cfg -from oslo_config import types FC_VOLUME_OPTS = [ cfg.BoolOpt( @@ -27,17 +26,14 @@ COMMON_VOLUME_OPTS = [ cfg.StrOpt( 'hpxp_storage_cli', default=None, - required=True, help='Type of storage command line interface'), cfg.StrOpt( 'hpxp_storage_id', default=None, - required=True, help='ID of storage system'), cfg.StrOpt( 'hpxp_pool', default=None, - required=True, help='Pool of storage system'), cfg.StrOpt( 'hpxp_thin_pool', @@ -53,25 +49,21 @@ COMMON_VOLUME_OPTS = [ help='Default copy method of storage system. ' 'There are two valid values: "FULL" specifies that a full copy; ' '"THIN" specifies that a thin copy. Default value is "FULL"'), - cfg.Opt( + cfg.IntOpt( 'hpxp_copy_speed', - type=types.Integer(min=1, max=15), default=3, help='Copy speed of storage system'), - cfg.Opt( + cfg.IntOpt( 'hpxp_copy_check_interval', - type=types.Integer(min=1, max=600), default=3, help='Interval to check copy'), - cfg.Opt( + cfg.IntOpt( 'hpxp_async_copy_check_interval', - type=types.Integer(min=1, max=600), default=10, help='Interval to check copy asynchronously'), cfg.ListOpt( 'hpxp_target_ports', default=None, - required=True, help='Target port names for host group or iSCSI target'), cfg.ListOpt( 'hpxp_compute_target_ports', @@ -86,15 +78,13 @@ COMMON_VOLUME_OPTS = [ ] HORCM_VOLUME_OPTS = [ - cfg.Opt( + cfg.ListOpt( 'hpxp_horcm_numbers', - type=types.List(item_type=types.Integer(min=0, max=2047)), - default=[200, 201], + default=["200", "201"], help='Instance numbers for HORCM'), cfg.StrOpt( 'hpxp_horcm_user', default=None, - required=True, help='Username of storage system for HORCM'), cfg.BoolOpt( 'hpxp_horcm_add_conf', @@ -109,3 +99,8 @@ HORCM_VOLUME_OPTS = [ default=False, help='Only discover a specific name of host group or iSCSI target'), ] + +CONF = cfg.CONF +CONF.register_opts(FC_VOLUME_OPTS) +CONF.register_opts(COMMON_VOLUME_OPTS) +CONF.register_opts(HORCM_VOLUME_OPTS)