Public bug reported: In current metering-label-rule, 'tenant_id' is included into RESOURCE_ATTRIBUTE_MAP[1]. However, even if we specify 'tenant_id' by using CLI or REST-API, 'tenant_id' isn't stored on DB[2] and we cannot see the result. Therefore, I think following fixes are necessary:
1. 'tenant_id' definition should be removed at extensions/metering.py. 2. Remove 'tenant_id' option from CLI(meter-label-rule) [CLI] (neutron) meter-label-rule-create my-label 192.168.2.0/24 --tenant-id 8ae2759224e94ed0a66011315a32d07c Created a new metering_label_rule: +-------------------+--------------------------------------+ | Field | Value | +-------------------+--------------------------------------+ | direction | ingress | | excluded | False | | id | 4ef89142-b216-42c7-9455-abc3a8fd1d3d | | metering_label_id | 543ce87e-2190-46d5-9d79-3fd113681372 | | remote_ip_prefix | 192.168.2.0/24 | +-------------------+--------------------------------------+ [REST-API] $ source devstack/openrc admin admin $ export TOKEN=`openstack token issue | grep ' id ' | get_field 2` $ curl -s -X POST -H "accept:application/json" -H "content-type: application/json" -d '{"metering_label_rule": {"remote_ip_prefix": "172.16.3.0/24", "metering_label_id": "d34c612f-3e02-433b-ba9f-f13b2ac6511d", "direction": "ingress", "excluded": false, "tenant_id": "8ae2759224e94ed0a66011315a32d07c"}}' -H "x-auth-token:$TOKEN" localhost:9696/v2.0/metering/metering-label-rules | jq "." { "metering_label_rule": { "remote_ip_prefix": "172.16.3.0/24", "direction": "ingress", "metering_label_id": "d34c612f-3e02-433b-ba9f-f13b2ac6511d", "id": "d300512f-db84-4680-92cd-dafb91bec33b", "excluded": false } } [1] https://github.com/openstack/neutron/blob/master/neutron/extensions/metering.py#L79 [2] https://github.com/openstack/neutron/blob/master/neutron/db/metering/metering_db.py#L171 ** Affects: neutron Importance: Undecided Status: New ** Tags: metering -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1624276 Title: Metering - metering-label-rule doesn't need 'tenant_id' Status in neutron: New Bug description: In current metering-label-rule, 'tenant_id' is included into RESOURCE_ATTRIBUTE_MAP[1]. However, even if we specify 'tenant_id' by using CLI or REST-API, 'tenant_id' isn't stored on DB[2] and we cannot see the result. Therefore, I think following fixes are necessary: 1. 'tenant_id' definition should be removed at extensions/metering.py. 2. Remove 'tenant_id' option from CLI(meter-label-rule) [CLI] (neutron) meter-label-rule-create my-label 192.168.2.0/24 --tenant-id 8ae2759224e94ed0a66011315a32d07c Created a new metering_label_rule: +-------------------+--------------------------------------+ | Field | Value | +-------------------+--------------------------------------+ | direction | ingress | | excluded | False | | id | 4ef89142-b216-42c7-9455-abc3a8fd1d3d | | metering_label_id | 543ce87e-2190-46d5-9d79-3fd113681372 | | remote_ip_prefix | 192.168.2.0/24 | +-------------------+--------------------------------------+ [REST-API] $ source devstack/openrc admin admin $ export TOKEN=`openstack token issue | grep ' id ' | get_field 2` $ curl -s -X POST -H "accept:application/json" -H "content-type: application/json" -d '{"metering_label_rule": {"remote_ip_prefix": "172.16.3.0/24", "metering_label_id": "d34c612f-3e02-433b-ba9f-f13b2ac6511d", "direction": "ingress", "excluded": false, "tenant_id": "8ae2759224e94ed0a66011315a32d07c"}}' -H "x-auth-token:$TOKEN" localhost:9696/v2.0/metering/metering-label-rules | jq "." { "metering_label_rule": { "remote_ip_prefix": "172.16.3.0/24", "direction": "ingress", "metering_label_id": "d34c612f-3e02-433b-ba9f-f13b2ac6511d", "id": "d300512f-db84-4680-92cd-dafb91bec33b", "excluded": false } } [1] https://github.com/openstack/neutron/blob/master/neutron/extensions/metering.py#L79 [2] https://github.com/openstack/neutron/blob/master/neutron/db/metering/metering_db.py#L171 To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1624276/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp