Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow OVN dynamic IPv4 if only static IPv6 is configured #12297

Closed
wants to merge 2 commits into from

Conversation

MusicDin
Copy link
Member

This PR fixes static IPv4 not being allocated if only static IPv6 is set for an OVN nic.

Currently, this does not work as expected. If OVN is instructed to get dynamic IPs, it will generate dynamic IP for both v4 and v6 family.

For example:

$ lxc launch ubuntu:22.04 c1 -n ovn -d eth0,ipv6.address=fd42:1000:1000:1000:a:b:c:d

$ lxc network list-leases ovn
+----------+-------------------+----------------------------------------+---------+
| HOSTNAME |    MAC ADDRESS    |               IP ADDRESS               |  TYPE   |
+----------+-------------------+----------------------------------------+---------+
| c1       | 00:16:3e:21:c4:7f | 10.100.100.2                           | DYNAMIC |
+----------+-------------------+----------------------------------------+---------+
| c1       | 00:16:3e:21:c4:7f | fd42:1000:1000:1000:216:3eff:fe21:c47f | DYNAMIC | << EUI64
+----------+-------------------+----------------------------------------+---------+
| c1       | 00:16:3e:21:c4:7f | fd42:1000:1000:1000:a:b:c:d            | STATIC  |
+----------+-------------------+----------------------------------------+---------+
| ovn.gw   |                   | 10.100.100.1                           | GATEWAY |
+----------+-------------------+----------------------------------------+---------+
| ovn.gw   |                   | fd42:1000:1000:1000::1                 | GATEWAY |
+----------+-------------------+----------------------------------------+---------+

As a result, instance gets sometimes static IPv6 and sometimes the generated one:

$ lxc ls
+------+---------+---------------------+-----------------------------------------------+-----------+-----------+
| NAME |  STATE  |        IPV4         |                     IPV6                      |   TYPE    | SNAPSHOTS |
+------+---------+---------------------+-----------------------------------------------+-----------+-----------+
| c1   | RUNNING | 10.100.100.2 (eth0) | fd42:1000:1000:1000:216:3eff:fe21:c47f (eth0) | CONTAINER | 0         |
+------+---------+---------------------+-----------------------------------------------+-----------+-----------+
                                         ^ Incorrect

However, after restart (when last used IPs are directly set as static IPs), it works as expected:

$ lxc restart c1

$ lxc ls
+------+---------+---------------------+------------------------------------+-----------+-----------+
| NAME |  STATE  |        IPV4         |                IPV6                |   TYPE    | SNAPSHOTS |
+------+---------+---------------------+------------------------------------+-----------+-----------+
| c1   | RUNNING | 10.100.100.2 (eth0) | fd42:1000:1000:1000:a:b:c:d (eth0) | CONTAINER | 0         |
+------+---------+---------------------+------------------------------------+-----------+-----------+

$ lxc network list-leases ovn
+----------+-------------------+-----------------------------+---------+
| HOSTNAME |    MAC ADDRESS    |         IP ADDRESS          |  TYPE   |
+----------+-------------------+-----------------------------+---------+
| c1       | 00:16:3e:21:c4:7f | 10.100.100.2                | DYNAMIC |
+----------+-------------------+-----------------------------+---------+
| c1       | 00:16:3e:21:c4:7f | fd42:1000:1000:1000:a:b:c:d | STATIC  |
+----------+-------------------+-----------------------------+---------+
| ovn.gw   |                   | 10.100.100.1                | GATEWAY |
+----------+-------------------+-----------------------------+---------+
| ovn.gw   |                   | fd42:1000:1000:1000::1      | GATEWAY |
+----------+-------------------+-----------------------------+---------+

Signed-off-by: Din Music <din.music@canonical.com>
…mic from another

Signed-off-by: Din Music <din.music@canonical.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant