<div dir="ltr">Here what oslo.config documentation says.<br><div><br>Represents a Deprecated option. Here's how you can use it<br><br> oldopts = [cfg.DeprecatedOpt('oldfoo', group='oldgroup'),<br>
cfg.DeprecatedOpt('oldfoo2', group='oldgroup2')]<br> cfg.CONF.register_group(cfg.OptGroup('blaa'))<br> cfg.CONF.register_opt(cfg.StrOpt('foo', deprecated_opts=oldopts),<br>
group='blaa')<br><br> Multi-value options will return all new and deprecated<br> options. For single options, if the new option is present<br> ("[blaa]/foo" above) it will override any deprecated options<br>
present. If the new option is not present and multiple<br> deprecated options are present, the option corresponding to<br> the first element of deprecated_opts will be chosen.<br><br></div><div>I hope that it'll help you.<br>
</div><div><br>Best regards,<br></div><div>Denis Makogon.<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 26, 2014 at 4:17 PM, Day, Phil <span dir="ltr"><<a href="mailto:philip.day@hp.com" target="_blank">philip.day@hp.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="#0563C1" vlink="#954F72" lang="EN-US">
<div>
<p class="MsoNormal">Hi Folks,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I could do with some pointers on config value deprecation.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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<u></u><u></u></p>
<p class="MsoNormal">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”
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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 ?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">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:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> cfg.IntOpt('wait_soft_reboot_seconds',<u></u><u></u></p>
<p class="MsoNormal"> default=120,<u></u><u></u></p>
<p class="MsoNormal"> help='Number of seconds to wait for instance to shut down after'<u></u><u></u></p>
<p class="MsoNormal"> ' soft reboot request is made. We fall back to hard reboot'<u></u><u></u></p>
<p class="MsoNormal"> ' if instance does not shutdown within this window.',<u></u><u></u></p>
<p class="MsoNormal"> deprecated_name='libvirt_wait_soft_reboot_seconds',<u></u><u></u></p>
<p class="MsoNormal"> deprecated_group='DEFAULT'),<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">but if I include the following in nova.conf <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"> libvirt_wait_soft_reboot_seconds = 20<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I can see the new value of 20 being used, but there is no warning logged that I’m using a deprecated name ?<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks<span class="HOEnZb"><font color="#888888"><u></u><u></u></font></span></p><span class="HOEnZb"><font color="#888888">
<p class="MsoNormal">Phil<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</font></span></div>
</div>
<br>_______________________________________________<br>
OpenStack-dev mailing list<br>
<a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br></div>