Skip to content

Fix network multinodes - #340

Merged
al1img merged 7 commits into
aosedge:developfrom
MykolaSuperman:fix_network_multinodes
Nov 24, 2026
Merged

al1img merged 7 commits into
aosedge:developfrom
MykolaSuperman:fix_network_multinodes

Conversation

@MykolaSuperman

Copy link
Copy Markdown

No description provided.

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2025 EPAM Systems, Inc.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Copyright (C) 2025 EPAM Systems, Inc.
* Copyright (C) 2026 EPAM Systems, Inc.

@@ -0,0 +1,24 @@
/*
* Copyright (C) 2025 EPAM Systems, Inc.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Copyright (C) 2025 EPAM Systems, Inc.
* Copyright (C) 2026 EPAM Systems, Inc.

@mlohvynenko mlohvynenko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>

@al1img al1img left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>

Mykola Solianko added 7 commits November 23, 2026 18:37
Implement OnUnitNetworksUpdate of the pending update handler interface:
write the unit networks update notification with the full set of unit
network IDs to the instance network update stream of the node.

Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
Handle the unit networks update notification of the instance network
update stream and pass the full set of unit network IDs to the network
update handler.

The set is full-state and the handler releases the networks missing in
it, so the update that can't be converted completely is skipped.

Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
SM creates the provider network only for its own instances, so instances
of different providers running on different nodes can't communicate: the
node has no bridge and VLAN of the remote provider network.

Make the network manager own the set of unit networks: the networks that
have at least one allocated instance. The full set is sent to the node
when it subscribes to the instance network updates and to all subscribed
nodes when the set changes, so each SM can create the missing networks
and release the ones that left the set.

Add the update subscription listener interface, which SM controller uses
to notify the network manager about nodes subscribed to the instance
network updates.

Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
The provider network leaves the set of unit networks as soon as its last
instance is released: all nodes remove the network and CM frees its VLAN
ID and subnet.

This also happens when the only instance of the provider is moved to
another node or restarted on update: the instance is released on the old
node before it is allocated on the new one, which has to install the
image first. As a result, the network is recreated on all nodes, possibly
with another VLAN ID and subnet, and the instance IP is not preserved.

To avoid this, the network without instances should stay in the set of
unit networks for some time. This time depends on how long the image
installation takes on the unit, so add the networkRemoveTimeout parameter
to CM config to make it configurable. The default value is 2 minutes.

Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
The provider network leaves the set of unit networks as soon as its last
instance is released. When the only instance of the provider is moved to
another node or restarted on update, it is released on the old node
before it is allocated on the new one. So all nodes remove the network,
CM frees its VLAN ID and subnet, and then the network is created again,
possibly with another VLAN ID and subnet.

Keep the network without instances in the set of unit networks for the
network remove timeout. The removal is scheduled when the network is
created, when its last instance is released and, on init, for the stored
networks without instances. It is canceled when an instance is allocated
in the network. When the timeout expires, the network leaves the set, SMs
release it and CM removes it with its last host as before.

As a result, the new network is announced to all nodes right after it is
created, before its first instance is allocated.

The removal time is not stored, so after CM restart the timeout starts
again. Zero timeout disables the delay.

Add Start and Stop methods to run and stop the thread that handles the
removal timeouts.

Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
The network manager documents describe the provider network as created
only on the nodes that run its instances and removed with the last
instance, which is no longer true.

Describe the set of unit networks in the CM network manager document: how
the set is built, when it is sent to the nodes, the update subscription
listener and the delayed network removal with the networkRemoveTimeout
config parameter.

Update the lifecycle diagram in the SM network manager document: the
bridge, VLAN and masquerade of the unit network are created without
instances and are removed only when the network leaves the unit networks.

Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
SM starts dnsmasq for each network by the hard-coded path
/usr/sbin/dnsmasq. Yocto installs dnsmasq to /usr/bin, so on the target
the process is not started: exec fails in the forked child and SM gets
no error. Instances then have no DNS server on the bridge address and
resolve names only through the CM DNS server.

Start dnsmasq by name and let exec find it in PATH, so SM does not
depend on where the distro installs the binary.

Signed-off-by: Mykola Solianko <mykola_solianko@epam.com>
Reviewed-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Reviewed-by: Mykhailo Lohvynenko <mykhailo_lohvynenko@epam.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
47.2% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@al1img
al1img merged commit 03a6fb6 into aosedge:develop Nov 24, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants