diff --git a/neutron/services/metering/metering_plugin.py b/neutron/services/metering/metering_plugin.py index 3ad78b821be..727de098a67 100644 --- a/neutron/services/metering/metering_plugin.py +++ b/neutron/services/metering/metering_plugin.py @@ -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) diff --git a/releasenotes/notes/deprecate-remote_ip_prefix-metering-label-rules-5203f681d2fce058.yaml b/releasenotes/notes/deprecate-remote_ip_prefix-metering-label-rules-5203f681d2fce058.yaml new file mode 100644 index 00000000000..62fb8578c85 --- /dev/null +++ b/releasenotes/notes/deprecate-remote_ip_prefix-metering-label-rules-5203f681d2fce058.yaml @@ -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/. \ No newline at end of file