[openstack-dev] How do I mark one option as deprecating another one ?

Day, Phil philip.day at hp.com
Wed Feb 26 14:17:15 UTC 2014


Hi Folks,

I could do with some pointers on config value deprecation.

All of the examples in the code and documentation seem to deal with  the case of "old_opt" being replaced by "new_opt" but still returning the same value
Here using deprecated_name and  / or deprecated_opts in the definition of "new_opt" lets me still get the value (and log a warning) if the config still uses "old_opt"

However my use case is different because while I want deprecate old-opt, new_opt doesn't take the same value and I need to  different things depending on which is specified, i.e. If old_opt is specified and new_opt isn't I still want to do some processing specific to old_opt and log a deprecation warning.

Clearly I can code this up as a special case at the point where I look for the options - but I was wondering if there is some clever magic in oslo.config that lets me declare this as part of the option definition ?



As a second point,  I thought that using a deprecated option automatically logged a warning, but in the latest Devstack wait_soft_reboot_seconds is defined as:

    cfg.IntOpt('wait_soft_reboot_seconds',
               default=120,
               help='Number of seconds to wait for instance to shut down after'
                    ' soft reboot request is made. We fall back to hard reboot'
                    ' if instance does not shutdown within this window.',
               deprecated_name='libvirt_wait_soft_reboot_seconds',
               deprecated_group='DEFAULT'),



but if I include the following in nova.conf

                libvirt_wait_soft_reboot_seconds = 20


I can see the new value of 20 being used, but there is no warning logged that I'm using a deprecated name ?

Thanks
Phil

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140226/18e99c7c/attachment-0001.html>


More information about the OpenStack-dev mailing list