Metadata agent
Running the agent
neutron-ovn-metadata-agent –config-file /etc/neutron/neutron.conf –config-file /etc/neutron/neutron_ovn_metadata_agent.ini
Configure neutron_ovn_metadata_agent.ini.j2 on the compute node(s)
[ovn] ovn_nb_connection=tcp:{{OVN Controller IP}}:6641 ovn_sb_connection=tcp:{{OVN Controller IP}}:6642 ovn_metadata_enabled = true
Configure neutron.conf on the Neutron server
[ovn] ovn_metadata_enabled = true
Reading
https://docs.openstack.org/networking-ovn/latest/admin/refarch/refarch.html – For a nice diagram on how the bits fit together
https://man7.org/linux/man-pages/man7/ovn-architecture.7.html – Some more in depth technical secrets hidden in this doc
Specifically the example of local ports
- One logical switch sw0 with 2 ports (p1, p2) and 1 localport (lp) - Two hypervisors: HV1 and HV2 - p1 will be in HV1 (OVS port with external-id:iface-id="p1") - p2 will be in HV2 (OVS port with external-id:iface-id="p2") - lp will be in both (OVS port with external-id:iface-id="lp") - p1 should be able to reach p2 and viceversa - lp on HV1 should be able to reach p1 but not p2 - lp on HV2 should be able to reach p2 but not p1 ovn-nbctl ls-add sw0 ovn-nbctl lsp-add sw0 p1 ovn-nbctl lsp-add sw0 p2 ovn-nbctl lsp-add sw0 lp ovn-nbctl lsp-set-addresses p1 "00:00:00:aa:bb:10 10.0.1.10" ovn-nbctl lsp-set-addresses p2 "00:00:00:aa:bb:20 10.0.1.20" ovn-nbctl lsp-set-addresses lp "00:00:00:aa:bb:30 10.0.1.30" ovn-nbctl lsp-set-type lp localport add_phys_port() { name=$1 mac=$2 ip=$3 mask=$4 gw=$5 iface_id=$6 sudo ip netns add $name sudo ovs-vsctl add-port br-int $name -- set interface $name type=internal sudo ip link set $name netns $name sudo ip netns exec $name ip link set $name address $mac sudo ip netns exec $name ip addr add $ip/$mask dev $name sudo ip netns exec $name ip link set $name up sudo ip netns exec $name ip route add default via $gw sudo ovs-vsctl set Interface $name external_ids:iface-id=$iface_id } # Add p1 to HV1, p2 to HV2 and localport to both # HV1 add_phys_port p1 00:00:00:aa:bb:10 10.0.1.10 24 10.0.1.1 p1 add_phys_port lp 00:00:00:aa:bb:30 10.0.1.30 24 10.0.1.1 lp $ sudo ip netns exec p1 ping -c 2 10.0.1.20 PING 10.0.1.20 (10.0.1.20) 56(84) bytes of data. 64 bytes from 10.0.1.20: icmp_seq=1 ttl=64 time=0.738 ms 64 bytes from 10.0.1.20: icmp_seq=2 ttl=64 time=0.502 ms --- 10.0.1.20 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 0.502/0.620/0.738/0.118 ms $ sudo ip netns exec lp ping -c 2 10.0.1.10 PING 10.0.1.10 (10.0.1.10) 56(84) bytes of data. 64 bytes from 10.0.1.10: icmp_seq=1 ttl=64 time=0.187 ms 64 bytes from 10.0.1.10: icmp_seq=2 ttl=64 time=0.032 ms --- 10.0.1.10 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 999ms rtt min/avg/max/mdev = 0.032/0.109/0.187/0.078 ms $ sudo ip netns exec lp ping -c 2 10.0.1.20 PING 10.0.1.20 (10.0.1.20) 56(84) bytes of data. --- 10.0.1.20 ping statistics --- 2 packets transmitted, 0 received, 100% packet loss, time 1000ms $ sudo ovs-ofctl dump-flows br-int | grep table=32 cookie=0x0, duration=141.939s, table=32, n_packets=2, n_bytes=196, idle_age=123, priority=150,reg14=0x3,reg15=0x2,metadata=0x7 actions=drop cookie=0x0, duration=141.939s, table=32, n_packets=2, n_bytes=196, idle_age=129, priority=100,reg15=0x2,metadata=0x7 actions=load:0x7->NXM_NX_TUN_ID[0..23],set_field:0x2->tun_metadata0,move:NXM_NX_REG14[0..14]->NXM_NX_TUN_METADATA0[16..30],output:59 # On HV2 add_phys_port p2 00:00:00:aa:bb:20 10.0.1.20 24 10.0.1.1 p2 add_phys_port lp 00:00:00:aa:bb:30 10.0.1.30 24 10.0.1.1 lp $ sudo ip netns exec p2 ping -c 2 10.0.1.10 PING 10.0.1.10 (10.0.1.10) 56(84) bytes of data. 64 bytes from 10.0.1.10: icmp_seq=1 ttl=64 time=0.810 ms 64 bytes from 10.0.1.10: icmp_seq=2 ttl=64 time=0.673 ms --- 10.0.1.10 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1000ms rtt min/avg/max/mdev = 0.673/0.741/0.810/0.073 ms $ sudo ip netns exec lp ping -c 2 10.0.1.20 PING 10.0.1.20 (10.0.1.20) 56(84) bytes of data. 64 bytes from 10.0.1.20: icmp_seq=1 ttl=64 time=0.357 ms 64 bytes from 10.0.1.20: icmp_seq=2 ttl=64 time=0.062 ms --- 10.0.1.20 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1000ms rtt min/avg/max/mdev = 0.062/0.209/0.357/0.148 ms $ sudo ip netns exec lp ping -c 2 10.0.1.10 PING 10.0.1.10 (10.0.1.10) 56(84) bytes of data. --- 10.0.1.10 ping statistics --- 2 packets transmitted, 0 received, 100% packet loss, time 999ms $ sudo ovs-ofctl dump-flows br-int | grep table=32 cookie=0x0, duration=24.169s, table=32, n_packets=2, n_bytes=196, idle_age=12, priority=150,reg14=0x3,reg15=0x1,metadata=0x7 actions=drop cookie=0x0, duration=24.169s, table=32, n_packets=2, n_bytes=196, idle_age=14, priority=100,reg15=0x1,metadata=0x7 actions=load:0x7->NXM_NX_TUN_ID[0..23],set_field:0x1->tun_metadata0,move:NXM_NX_REG14[0..14]->NXM_NX_TUN_METADATA0[16..30],output:40