Re: [openstack-dev] How do I mark one option as deprecating another one ?
Hi Denis, Thanks for the pointer, but I looked at that and I my understanding is that it only allows me to retrieve a value by an old name, but doesn't let me know that the old name has been used. So If all I wanted to do was change the name/group of the config value it would be fine. But in my case I need to be able to implement: If new_value_defined: do_something else if old_value_defined: warn_about_deprectaion do_something_else Specifically I want to replace tenant_name based authentication with tenant_id - so I need to know which has been specified. Phil From: Denis Makogon [mailto:dmako...@mirantis.com] Sent: 26 February 2014 14:31 To: OpenStack Development Mailing List (not for usage questions) Subject: Re: [openstack-dev] How do I mark one option as deprecating another one ? Here what oslo.config documentation says. Represents a Deprecated option. Here's how you can use it oldopts = [cfg.DeprecatedOpt('oldfoo', group='oldgroup'), cfg.DeprecatedOpt('oldfoo2', group='oldgroup2')] cfg.CONF.register_group(cfg.OptGroup('blaa')) cfg.CONF.register_opt(cfg.StrOpt('foo', deprecated_opts=oldopts), group='blaa') Multi-value options will return all new and deprecated options. For single options, if the new option is present ([blaa]/foo above) it will override any deprecated options present. If the new option is not present and multiple deprecated options are present, the option corresponding to the first element of deprecated_opts will be chosen. I hope that it'll help you. Best regards, Denis Makogon. On Wed, Feb 26, 2014 at 4:17 PM, Day, Phil philip@hp.commailto:philip@hp.com wrote: 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 ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.orgmailto:OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] How do I mark one option as deprecating another one ?
Phil, Correct. We don't have this functionality in oslo.config. Please create a new feature/enhancement request against oslo thanks, dims On Thu, Feb 27, 2014 at 4:47 AM, Day, Phil philip@hp.com wrote: Hi Denis, Thanks for the pointer, but I looked at that and I my understanding is that it only allows me to retrieve a value by an old name, but doesn't let me know that the old name has been used. So If all I wanted to do was change the name/group of the config value it would be fine. But in my case I need to be able to implement: If new_value_defined: do_something else if old_value_defined: warn_about_deprectaion do_something_else Specifically I want to replace tenant_name based authentication with tenant_id - so I need to know which has been specified. Phil From: Denis Makogon [mailto:dmako...@mirantis.com] Sent: 26 February 2014 14:31 To: OpenStack Development Mailing List (not for usage questions) Subject: Re: [openstack-dev] How do I mark one option as deprecating another one ? Here what oslo.config documentation says. Represents a Deprecated option. Here's how you can use it oldopts = [cfg.DeprecatedOpt('oldfoo', group='oldgroup'), cfg.DeprecatedOpt('oldfoo2', group='oldgroup2')] cfg.CONF.register_group(cfg.OptGroup('blaa')) cfg.CONF.register_opt(cfg.StrOpt('foo', deprecated_opts=oldopts), group='blaa') Multi-value options will return all new and deprecated options. For single options, if the new option is present ([blaa]/foo above) it will override any deprecated options present. If the new option is not present and multiple deprecated options are present, the option corresponding to the first element of deprecated_opts will be chosen. I hope that it'll help you. Best regards, Denis Makogon. On Wed, Feb 26, 2014 at 4:17 PM, Day, Phil philip@hp.com wrote: 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 ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev -- Davanum Srinivas :: http://davanum.wordpress.com ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] How do I mark one option as deprecating another one ?
On 2/27/2014 6:32 AM, Davanum Srinivas wrote: Phil, Correct. We don't have this functionality in oslo.config. Please create a new feature/enhancement request against oslo thanks, dims Done: https://bugs.launchpad.net/oslo/+bug/1285768 On Thu, Feb 27, 2014 at 4:47 AM, Day, Phil philip@hp.com wrote: Hi Denis, Thanks for the pointer, but I looked at that and I my understanding is that it only allows me to retrieve a value by an old name, but doesn't let me know that the old name has been used. So If all I wanted to do was change the name/group of the config value it would be fine. But in my case I need to be able to implement: If new_value_defined: do_something else if old_value_defined: warn_about_deprectaion do_something_else Specifically I want to replace tenant_name based authentication with tenant_id - so I need to know which has been specified. Phil From: Denis Makogon [mailto:dmako...@mirantis.com] Sent: 26 February 2014 14:31 To: OpenStack Development Mailing List (not for usage questions) Subject: Re: [openstack-dev] How do I mark one option as deprecating another one ? Here what oslo.config documentation says. Represents a Deprecated option. Here's how you can use it oldopts = [cfg.DeprecatedOpt('oldfoo', group='oldgroup'), cfg.DeprecatedOpt('oldfoo2', group='oldgroup2')] cfg.CONF.register_group(cfg.OptGroup('blaa')) cfg.CONF.register_opt(cfg.StrOpt('foo', deprecated_opts=oldopts), group='blaa') Multi-value options will return all new and deprecated options. For single options, if the new option is present ([blaa]/foo above) it will override any deprecated options present. If the new option is not present and multiple deprecated options are present, the option corresponding to the first element of deprecated_opts will be chosen. I hope that it'll help you. Best regards, Denis Makogon. On Wed, Feb 26, 2014 at 4:17 PM, Day, Phil philip@hp.com wrote: 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 ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev -- Thanks, Matt Riedemann ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
[openstack-dev] How do I mark one option as deprecating another one ?
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 ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] How do I mark one option as deprecating another one ?
Here what oslo.config documentation says. Represents a Deprecated option. Here's how you can use it oldopts = [cfg.DeprecatedOpt('oldfoo', group='oldgroup'), cfg.DeprecatedOpt('oldfoo2', group='oldgroup2')] cfg.CONF.register_group(cfg.OptGroup('blaa')) cfg.CONF.register_opt(cfg.StrOpt('foo', deprecated_opts=oldopts), group='blaa') Multi-value options will return all new and deprecated options. For single options, if the new option is present ([blaa]/foo above) it will override any deprecated options present. If the new option is not present and multiple deprecated options are present, the option corresponding to the first element of deprecated_opts will be chosen. I hope that it'll help you. Best regards, Denis Makogon. On Wed, Feb 26, 2014 at 4:17 PM, Day, Phil philip@hp.com wrote: 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 ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev ___ OpenStack-dev mailing list OpenStack-dev@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev