Skip to content

Fix/udev rules persistance of network interfaces#387

Open
BogdanEmilian wants to merge 1 commit intocloudbase:masterfrom
BogdanEmilian:fix/udev-rules-persistance-of-network-interfaces
Open

Fix/udev rules persistance of network interfaces#387
BogdanEmilian wants to merge 1 commit intocloudbase:masterfrom
BogdanEmilian:fix/udev-rules-persistance-of-network-interfaces

Conversation

@BogdanEmilian
Copy link

Current version does not handle the case of already existing etc/udev/rules.d/70-persistent-net.rules, so this case will add the file etc/udev/rules.d/99-coriolis-net.rules that will overwrite those configurations and apply them for the interfaces.

coriolis_udev_rules_file = "etc/udev/rules.d/99-coriolis-net.rules"
if net_ifaces_info:
content = utils.get_udev_net_rules(net_ifaces_info)
if not self._test_path(udev_file):
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need to write to the original file anymore, we can simply use the custom one. Please write directly to that.

@@ -639,11 +639,10 @@ def _set_grub2_console_settings(self, consoles=None, speed=None,
config_obj, execute_update_grub)

def _add_net_udev_rules(self, net_ifaces_info):
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine, but I noticed something weird about how net_ifaces_info is passed to this method:
https://github.com/cloudbase/coriolis/blob/master/coriolis/osmorphing/base.py#L693

That feels weird for a method to use, and really presents ambiguous usability when called upon (because of the missing type annotations or method docs, but that's not for you to fix now)

I think we should move the .items() call down the stack, maybe here: https://github.com/cloudbase/coriolis/blob/master/coriolis/utils.py#L201

Overwriting network interface udev rules

Writing a file to overwrite the 70-persistent-net.rules if existing or adding if not existent

Removing the system udev rules overwrite in order to use only Coriolis specific file

Choosing to overwrite just the udev rules created by Coriolis as etc/udev/rules.d/99-coriolis-net.rules in order to keep the current network configuration when the deployment is done, through the reported network interface info

Changing path used for the udev rules test to match the changes

Changing the path used for the tests to check for changes in etc/udev/rules.d/99-coriolis-net.rules

Passing the entire object through the method that adds udev rules, so that we later retrieve its items

Fixing tests for new approach of how items are being retrieved for net_ifaces_info
@BogdanEmilian BogdanEmilian force-pushed the fix/udev-rules-persistance-of-network-interfaces branch from 99d2757 to 3c7c100 Compare February 5, 2026 17:09
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.

2 participants