Comment 6 for bug 2055397

Revision history for this message
Alberto Contreras (aciba) wrote :

Thanks for the work here. I can confirm that systemd 245.4-4ubuntu-3.24 properly renders route metrics and fixes the routing issue that this bug refers to. Applying the following diff to cloud-init to install systemd's version from focal-proposed and make extra assertions results in the test passing, see attached log.

```diff
diff --git a/tests/integration_tests/modules/test_hotplug.py b/tests/integration_tests/modules/test_hotplug.py
index 8c7bc7839..82d4a2cd1 100644
--- a/tests/integration_tests/modules/test_hotplug.py
+++ b/tests/integration_tests/modules/test_hotplug.py
@@ -299,7 +299,6 @@ def test_multi_nic_hotplug(setup_image, session_cloud: IntegrationCloud):
         verify_clean_log(log_content)

-@pytest.mark.skipif(CURRENT_RELEASE <= FOCAL, reason="See LP: #2055397")
 @pytest.mark.skipif(PLATFORM != "ec2", reason="test is ec2 specific")
 def test_multi_nic_hotplug_vpc(setup_image, session_cloud: IntegrationCloud):
     """Tests that additional secondary NICs are routable from local
@@ -308,6 +307,19 @@ def test_multi_nic_hotplug_vpc(setup_image, session_cloud: IntegrationCloud):
     with session_cloud.launch(
         user_data=USER_DATA
     ) as client, session_cloud.launch() as bastion:
+ assert client.execute("""\
+sudo sh -c "echo 'deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-proposed restricted main multiverse universe' >> /etc/apt/sources.list.d/proposed-repositories.list"
+ """).ok
+ assert client.execute("sudo apt update").ok
+ assert client.execute("sudo apt upgrade systemd -y").ok
+ systemd_resp = client.execute("apt policy systemd | grep Installed | cut -d ':' -f 2 | tr -d ' '")
+ assert systemd_resp.ok
+ assert systemd_resp.stdout == "245.4-4ubuntu3.24"
+
+ assert client.execute("cloud-init clean --logs")
+ client.restart()
+ wait_for_cloud_init(client)
+
         ips_before = _get_ip_addr(client)
         primary_priv_ip4 = ips_before[1].ip4
         primary_priv_ip6 = ips_before[1].ip6
@@ -343,18 +355,23 @@ def test_multi_nic_hotplug_vpc(setup_image, session_cloud: IntegrationCloud):
         assert r.ok, r.stdout
         r = bastion.execute(f"ping -c1 {secondary_priv_ip4}")
         assert r.ok, r.stdout
- r = bastion.execute(f"ping -c1 {primary_priv_ip6}")
+ r = bastion.execute(f"ping -c3 {primary_priv_ip6}")
         assert r.ok, r.stdout
- r = bastion.execute(f"ping -c1 {secondary_priv_ip6}")
+ r = bastion.execute(f"ping -c3 {secondary_priv_ip6}")
         assert r.ok, r.stdout

+ ip_route_show = client.execute("ip route show")
+ assert ip_route_show.ok, ip_route_show.stderr
+ for route in ip_route_show.splitlines():
+ assert "metric" in route, "Expected metric to be configured in route"
+
         # Remove new NIC
         client.instance.remove_network_interface(secondary_priv_ip4)
         _wait_till_hotplug_complete(client, expected_runs=2)

         # ping to primary NIC works
         assert bastion.execute(f"ping -c1 {primary_priv_ip4}").ok
- assert bastion.execute(f"ping -c1 {primary_priv_ip6}").ok
+ assert bastion.execute(f"ping -c3 {primary_priv_ip6}").ok

         log_content = client.read_from_file("/var/log/cloud-init.log")
         verify_clean_log(log_content)

```