<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><font face="DejaVu Sans">Hello,<br>
<br>
I'm trying to set up metering for neutron in Pike. I tested it
with a<br>
centralized router and it works, but when I try with a
distributed router it<br>
doesn't record any usage samples. I have one compute node and
one network node<br>
and I've created an instance with a floating ip.<br>
<br>
</font><tt>openstack router show public-router2</tt><tt><br>
</tt><tt>+-------------------------+----------------------------------------------------+</tt><tt><br>
</tt><tt>| Field |
Value |</tt><tt><br>
</tt><tt>+-------------------------+----------------------------------------------------+</tt><tt><br>
</tt><tt>| admin_state_up |
UP |</tt><tt><br>
</tt><tt>| availability_zone_hints
| |</tt><tt><br>
</tt><tt>| availability_zones |
nova |</tt><tt><br>
</tt><tt>| created_at |
2018-10-05T12:07:32Z |</tt><tt><br>
</tt><tt>| description
| |</tt><tt><br>
</tt><tt>| distributed |
True |</tt><tt><br>
</tt><tt>| external_gateway_info | {"network_id":
"b96473ce- |</tt><tt><br>
</tt><tt>| | 94f6-464f-a703-5285fb8ff3d3",
"enable_snat": true, |</tt><tt><br>
</tt><tt>| | "external_fixed_ips":
[{"subnet_id": |</tt><tt><br>
</tt><tt>| |
"6c08c3d9-7df1-4bec-b847-19f80b9d1764", |</tt><tt><br>
</tt><tt>| | "ip_address":
"192.168.252.102"}]} |</tt><tt><br>
</tt><tt>| flavor_id |
None |</tt><tt><br>
</tt><tt>| ha |
False |</tt><tt><br>
</tt><tt>| id |
37c1794b-58d1-4d0d-b34b-944ca411b86b |</tt><tt><br>
</tt><tt>| name |
public-router2 |</tt><tt><br>
</tt><tt>| project_id |
fe203109e67f4e39b066c9529f9fc35d |</tt><tt><br>
</tt><tt>| revision_number |
5 |</tt><tt><br>
</tt><tt>| routes
| |</tt><tt><br>
</tt><tt>| status |
ACTIVE |</tt><tt><br>
</tt><tt>| tags
| |</tt><tt><br>
</tt><tt>| updated_at |
2018-10-05T12:09:36Z |</tt><tt><br>
</tt><tt>+-------------------------+----------------------------------------------------+</tt><font
face="DejaVu Sans"><br>
<br>
</font><tt>openstack network agent list</tt><tt><br>
</tt><tt>+-----------+------------+-----------+-------------------+-------+-------+--------------+</tt><tt><br>
</tt><tt>| ID | Agent Type | Host | Availability Zone
| Alive | State | Binary |</tt><tt><br>
</tt><tt>+-----------+------------+-----------+-------------------+-------+-------+--------------+</tt><tt><br>
</tt><tt>| 14b9ea75- | L3 agent | compute1. | nova
| :-) | UP | neutron-l3-a |</tt><tt><br>
</tt><tt>| 1dc1-4e37 | | localdoma |
| | | gent |</tt><tt><br>
</tt><tt>| -a2b0-508 | | in |
| | | |</tt><tt><br>
</tt><tt>| 3d336916d | | |
| | | |</tt><tt><br>
</tt><tt>| 26139ec1- | Metering | compute1. | None
| :-) | UP | neutron- |</tt><tt><br>
</tt><tt>| f4f9-4bb3 | agent | localdoma |
| | | metering- |</tt><tt><br>
</tt><tt>| -aebb-c35 | | in |
| | | agent |</tt><tt><br>
</tt><tt>| 3a36ed79c | | |
| | | |</tt><tt><br>
</tt><tt>| 2a54971f- | DHCP agent | network1. | nova
| :-) | UP | neutron- |</tt><tt><br>
</tt><tt>| 9849-4ed2 | | localdoma |
| | | dhcp-agent |</tt><tt><br>
</tt><tt>| -b009-00e | | in |
| | | |</tt><tt><br>
</tt><tt>| 45eb4d255 | | |
| | | |</tt><tt><br>
</tt><tt>| 443c0b49- | Open | compute1. | None
| :-) | UP | neutron- |</tt><tt><br>
</tt><tt>| 4484-44d2 | vSwitch | localdoma |
| | | openvswitch- |</tt><tt><br>
</tt><tt>| -a704-32a | agent | in |
| | | agent |</tt><tt><br>
</tt><tt>| 92ffe6982 | | |
| | | |</tt><tt><br>
</tt><tt>| 5d00a219 | L3 agent | network1. | nova
| :-) | UP | neutron-vpn- |</tt><tt><br>
</tt><tt>| -abce- | | localdoma |
| | | agent |</tt><tt><br>
</tt><tt>| 48ca- | | in |
| | | |</tt><tt><br>
</tt><tt>| ba1e-d962 | | |
| | | |</tt><tt><br>
</tt><tt>| 01bd7de3 | | |
| | | |</tt><tt><br>
</tt><tt>| bc3458b4 | Open | network1. | None
| :-) | UP | neutron- |</tt><tt><br>
</tt><tt>| -250e- | vSwitch | localdoma |
| | | openvswitch- |</tt><tt><br>
</tt><tt>| 4adf-90e0 | agent | in |
| | | agent |</tt><tt><br>
</tt><tt>| -110a1a7f | | |
| | | |</tt><tt><br>
</tt><tt>| 6ccb | | |
| | | |</tt><tt><br>
</tt><tt>| c29f9da8- | Metering | network1. | None
| :-) | UP | neutron- |</tt><tt><br>
</tt><tt>| ca58-4a11 | agent | localdoma |
| | | metering- |</tt><tt><br>
</tt><tt>| -b500-a25 | | in |
| | | agent |</tt><tt><br>
</tt><tt>| 3f820808e | | |
| | | |</tt><tt><br>
</tt><tt>| cdce667d- | Metadata | network1. | None
| :-) | UP | neutron- |</tt><tt><br>
</tt><tt>| faa4 | agent | localdoma |
| | | metadata- |</tt><tt><br>
</tt><tt>| -49ed- | | in |
| | | agent |</tt><tt><br>
</tt><tt>| 83ee-e0e5 | | |
| | | |</tt><tt><br>
</tt><tt>| a352d482 | | |
| | | |</tt><tt><br>
</tt><tt>| cf5ae104- | Metadata | compute1. | None
| :-) | UP | neutron- |</tt><tt><br>
</tt><tt>| 49d7-4c85 | agent | localdoma |
| | | metadata- |</tt><tt><br>
</tt><tt>| -a252-cc5 | | in |
| | | agent |</tt><tt><br>
</tt><tt>| 9a9a12789 | | |
| | | |</tt><tt><br>
</tt><tt>+-----------+------------+-----------+-------------------+-------+-------+--------------+</tt><font
face="DejaVu Sans"><br>
<br>
If I check the node on which my distributed router is running it
tells me that<br>
it's running on the network node:<br>
<br>
</font><tt>neutron l3-agent-list-hosting-router
37c1794b-58d1-4d0d-b34b-944ca411b86b</tt><tt><br>
</tt><tt>+--------------------------------------+----------------------+----------------+-------+----------+</tt><tt><br>
</tt><tt>| id |
host | admin_state_up | alive | ha_state |</tt><tt><br>
</tt><tt>+--------------------------------------+----------------------+----------------+-------+----------+</tt><tt><br>
</tt><tt>| 5d00a219-abce-48ca-ba1e-d96201bd7de3 |
network1.localdomain | True | :-) | |</tt><tt><br>
</tt><tt>+--------------------------------------+----------------------+----------------+-------+----------+</tt><font
face="DejaVu Sans"><br>
<br>
If I check the iptable rules for the router on the compute and
network nodes by running:<br>
<br>
</font><tt>ip netns exec
qrouter-37c1794b-58d1-4d0d-b34b-944ca411b86b iptables -nv -L</tt><font
face="DejaVu Sans"><br>
<br>
I see that compute1 records the traffic while network1 doesn't.
Also, I did some<br>
debugging and found out that the metering agent on compute1
receives an empty<br>
list of routers when querying the routers that it should
monitor.<br>
<br>
Source:<br>
<br>
</font><tt><a class="moz-txt-link-freetext"
href="https://github.com/openstack/neutron/blob/stable/pike/neutron/services/metering/agents/metering_agent.py#L177-L189"
moz-do-not-send="true">https://github.com/openstack/neutron/blob/stable/pike/neutron/services/metering/agents/metering_agent.py#L177-L189</a><br>
<br>
<a class="moz-txt-link-freetext"
href="https://github.com/openstack/neutron/blob/stable/pike/neutron/db/metering/metering_rpc.py#L33-L57"
moz-do-not-send="true">https://github.com/openstack/neutron/blob/stable/pike/neutron/db/metering/metering_rpc.py#L33-L57</a></tt><font
face="DejaVu Sans"><br>
<br>
I think this is because the router is running on network1. Why
is it running on<br>
network1 and why does it seem that the l3 agent on compute1 does
the actual<br>
routing?<br>
<br>
Thanks,<br>
Alex</font><br>
</p>
</body>
</html>