Activity log for bug #1807157

Date Who What changed Old value New value Message
2018-12-06 14:14:17 Alexandru Sorodoc bug added bug
2018-12-06 14:18:22 Alexandru Sorodoc description The metering agent running on compute nodes fails to report metering data for DVR routers. How to reproduce: 1. Have a multi-node OpenStack Pike deployment with a network node and a compute node (alongside other nodes needed). 2. Create a distributed public router and attach it to a private network. 3. Create some metering rules. In my case I have a metering label with the ingress rule 0.0.0.0/0 and another metering label with the egress rule 0.0.0.0/0. 3. Create an instance attached to the private network. You can optionally associate a floating ip with it. 4. Do something on the instance that would generate external traffic. For example, download a file. 5. Check the metering samples for the metering rules in gnocchi. The traffic generated by the instance is not recorded. You can also ssh into the compute and network nodes and check the iptables rules with the argument -v on the qrouter- and snat- namespaces for the public router. You can see the traffic on the snat- namespace on the network node when not using a floating ip and on the qrouter- namespace on the compute node when using a floating ip. However, the metering labels are missing. Checking the code in `neutron/services/metering/drivers/iptables/iptables_driver.py` I noticed the following: 1. The metering agent adds the metering iptables rules on the qrouter- namespace for the qg- interface. This is for centralized routers and works well. 2. The metering agent adds the metering iptables rules on the snat- namespace for the rpf- interface. This is wrong. The snat- namespace (which exists only on network nodes for DVR routers) houses a qg- interface for doing NAT. The rfp- interface exists only on compute nodes in the qrouter- namespace and it is used to route floating ip traffic. 3. The metering agent adds the metering rules only once for the qrouter- namespace. It uses the RouterWithMetering.metering_labels dictionary to avoid adding the same metering label twice in iptables. But it uses the dictionary for both the qrouter- and the snat- namespaces. When a label is added to the qrouter- namespace it will not be added to the snat- namespace too because it will already be present in the dictionary. The metering agent code has not changed significantly since stable/pike, so I assume that the problem still persists. The metering agent running on compute nodes fails to report metering data for DVR routers. How to reproduce: 1. Have a multi-node OpenStack Pike deployment with a network node and a compute node (alongside other nodes needed). 2. Create a distributed public router and attach it to a private network. 3. Create some metering rules. In my case I have a metering label with the ingress rule 0.0.0.0/0 and another metering label with the egress rule 0.0.0.0/0. 3. Create an instance attached to the private network. You can optionally associate a floating ip with it. 4. Do something on the instance that would generate external traffic. For example, download a file. 5. Check the metering samples for the metering rules in gnocchi. The traffic generated by the instance is not recorded. You can also ssh into the compute and network nodes and check the iptables rules with the argument -v on the qrouter- and snat- namespaces for the public router. You can see the traffic on the snat- namespace on the network node when not using a floating ip and on the qrouter- namespace on the compute node when using a floating ip. However, the metering labels are missing. Checking the code in `neutron/services/metering/drivers/iptables/iptables_driver.py` I noticed the following: 1. The metering agent adds the metering iptables rules on the qrouter- namespace for the qg- interface. This is for centralized routers and works well. 2. The metering agent adds the metering iptables rules on the snat- namespace for the rpf- interface. This is wrong. The snat- namespace (which exists only on network nodes for DVR routers) houses a qg- interface for doing NAT. The rfp- interface exists only on compute nodes in the qrouter- namespace and it is used to route floating ip traffic. 3. The metering agent adds the metering rules only once for the qrouter- namespace. It uses the RouterWithMetering.metering_labels dictionary to avoid adding the same metering label twice in iptables. But it uses the dictionary for both the qrouter- and the snat- namespaces. When a label is added to the qrouter- namespace it will not be added to the snat- namespace too because it will already be present in the dictionary. Also, in `neutron/db/metering/metering_rpc.py` the `get_sync_data_metering` function doesn't include DVR routers for compute node hosts. The l3_plugin.get_l3_agents function in Pike seems to only return the scheduled routers on the host (which doesn't include DVR routers). The metering agent code has not changed significantly since stable/pike, so I assume that the problem still persists.
2018-12-06 14:28:33 Alexandru Sorodoc tags metering
2018-12-13 15:25:11 Brian Haley bug added subscriber Brian Haley
2019-01-30 17:49:16 OpenStack Infra neutron: status New In Progress
2019-01-30 17:49:16 OpenStack Infra neutron: assignee Mohamed El Gindi (gindi)
2019-04-16 08:47:57 Slawek Kaplonski neutron: status In Progress New
2019-04-16 08:47:57 Slawek Kaplonski neutron: assignee Mohamed El Gindi (gindi)
2019-04-16 08:48:02 Slawek Kaplonski tags metering metering timeout-abandon
2019-06-22 21:32:35 OpenStack Infra neutron: status New In Progress
2019-06-22 21:32:35 OpenStack Infra neutron: assignee Alexandru Sorodoc (bno1)