Announce deprecation of `remote_ip_prefix` in metering label rules

As proposed in the RFE and then approved in the spec, we are adding to
the neutron metering rules two new parameters. The source IP prefix, and
destination IP prefix. Moreover, with that new spec implementation, we
deprecate the use of `remote_ip_prefix`.

This patch introduces a log message to inform people to migrate to the new API usage.

Change-Id: I5e81d8b27c6126f10011f2d1b4d8f8697e987f13
Partially-Implements: https://bugs.launchpad.net/neutron/+bug/1889431
RFE: https://bugs.launchpad.net/neutron/+bug/1889431
Depends-On: https://review.opendev.org/#/c/744702/
Depends-On: https://review.opendev.org/#/c/743828/
Depends-On: https://review.opendev.org/#/c/746142/
This commit is contained in:
Rafael Weingärtner 2020-08-13 14:03:19 -03:00
parent b4dad5bb3d
commit b0c6cb35e7
2 changed files with 19 additions and 0 deletions

View File

@ -21,6 +21,10 @@ from neutron.db.metering import metering_db
from neutron.db.metering import metering_rpc
from neutron import service
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
class MeteringPlugin(metering_db.MeteringDbMixin):
"""Implementation of the Neutron Metering Service Plugin."""
@ -65,6 +69,14 @@ class MeteringPlugin(metering_db.MeteringDbMixin):
rule = super(MeteringPlugin, self).create_metering_label_rule(
context, metering_label_rule)
if rule.get("remote_ip_prefix"):
LOG.warning("The use of 'remote_ip_prefix' in metering label "
"rules is deprecated and will be removed in future "
"releases. One should use instead the "
"'source_ip_prefix' and/or 'destination_ip_prefix' "
"parameters. For more details, you can check the "
"spec: https://review.opendev.org/#/c/744702/.")
data = self.get_sync_data_for_rule(context, rule)
self.meter_rpc.add_metering_label_rule(context, data)

View File

@ -0,0 +1,7 @@
---
deprecations:
- |
Deprecate the use of ``remote_ip_prefix`` in metering label rules, and it
will be removed in future releases. One should use instead the
``source_ip_prefix`` and/or ``destination_ip_prefix`` parameters. For more
details, please refer to the spec: https://review.opendev.org/#/c/744702/.