4

I recently made a code fix in trove to rename a config parameter name in vertica from 'cluster_member_count' to 'min_cluster_member_count'. Also, I deprecated the value of the old parameter so it can be backwards-compatible. Here is the group where the config option is to be deprecated:

# Vertica
     vertica_group = cfg.OptGroup(
         'vertica', title='Vertica options',
          help="Oslo option group designed for Vertica datastore")
     vertica_opts = [
         cfg.ListOpt('tcp_ports',
               default=["5433", "5434", "22", "5444", "5450", "4803"],
               help='List of TCP ports and/or port ranges to open '
                    'in the security group (only applicable '
                    'if trove_security_groups_support is True).'),
  (skip lines)

I am changing the following cfg.IntOpt:

    cfg.IntOpt('cluster_member_count', default=3,
           help='Number of members in Vertica cluster.'),

Changes to be made:

  • change the parameter name 'cluster_member_count' to 'min_cluster_member_count'
  • the help description is changed accordingly
  • DEPRECATE the old parameter name 'cluster_member_count' and reference it under the group (use DEPRECATED_GROUP) = 'vertical'. This is done for backward compatibility.

The updated cfg.IntOpt is shown below:

    cfg.IntOpt('min_cluster_member_count', default=3,
           help='Minimum number of members in Vertica cluster.',
           deprecated_name='cluster_member_count',
           deprecated_group='vertica'),

however when I ran the tox -e py27 test I am getting the following error:

oslo.config.cfg.NoSuchOptError: no such option in group vertica: cluster_member_count

What am I missing here? I initially thought that this should have worked, as I assigned the correct deprecated_group = 'vertica' for the deprecated name. I appreciate any helpful input - thank you.

UPDATE: I believe I may have to define 'cluster_member_group' under DEPRECATED_OPTS, but googling does not show any sample on how to do it. Wish the Openstack doc provides a sample code, not just the syntax.

punsoca
  • 459
  • 1
  • 7
  • 15

1 Answers1

3

because somethere in trove is using cfg.CONF.vertica.cluster_member_count but there is no such option, you should change the code to cfg.CONF.vertica.min_cluster_member_count

and I think you should not deprecate the group, it is better to be in vertica group, if you do want to deprecate the group name as well, you need to register it in a specific group, for example, the DEFAULT, then other code should reference it as cfg.CONF.min_cluster_member_count

Cheers

ZhiQiang Fan
  • 986
  • 6
  • 7
  • thank you for your input, Zhi. I forgot to mention in my main post that I may have forgotten to define 'cluster_member_group' as a deprecated option somewhere? I believe that I may not have to change the references to the cfg.CONF.vertica.cluster_member_count at all, as long as I define 'cluster_member_count' as a deprecated option. But the internet does not have a lot of information on how to do so. – punsoca Apr 23 '16 at 19:53
  • Also, I believe the deprecated_group does not mean to say the group is to be deprecated, per Oslo documentation it says "the group containing a deprecated alias" - from http://docs.openstack.org/developer/oslo.config/opts.html – punsoca Apr 23 '16 at 23:28
  • the problem is the new option is already in the vertica group, why you deprecate it while you inside the group, so if don't want it be in the group, you must let it in another group, if the group is a new one, you need to register the group and the new option – ZhiQiang Fan Apr 24 '16 at 01:51
  • deprecated_name is enough, when code use min_cluster_member_count but don't find it, it will try to search the deprecated one, if there is deprecated one, there is warning in the log, but the value is valid for use, for the new option min_cluster_member_count, the old option cluster_member_count is no longer in the namespace after you remove it (by deprecated_name) – ZhiQiang Fan Apr 24 '16 at 01:53
  • hi Zhi, I gather that from your above notes, deprecated_group is not needed. However, when I did remove deprecated_group but keep deprecated_name, I am still getting the same error. – punsoca Apr 26 '16 at 16:25
  • ok actually your original suggestion is correct. I just renamed the old parameter to the new parameter name, and the errors went away. Also, I changed the above code removing the deprecated_group as it is not needed at all. Thanks! – punsoca Apr 27 '16 at 18:19