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

feat(net-naming-scheme): enable by default #1312

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,14 @@ def generate_link_file(interface):

@suppress_deprecation(InitrdIncludes)
def process():
if get_env('LEAPP_USE_NET_NAMING_SCHEMES', '0') == '1' and version.get_target_major_version() == '9':
# We can use this only for 8>9, for now
api.current_logger().info('Skipping generation of .link files renaming NICs as LEAPP_USE_NET_NAMING_SCHEMES=1')
are_net_schemes_enabled = get_env('LEAPP_DISABLE_NET_NAMING_SCHEMES', '0') != '1'
is_upgrade_8to9 = version.get_target_major_version() == '9'

if are_net_schemes_enabled and is_upgrade_8to9:
# For 8>9 we are using net.naming_scheme kernel arg by default - do not generate link files
msg = ('Skipping generation of .link files renaming NICs as net.naming-scheme '
'{LEAPP_DISABLE_NET_NAMING_SCHEMES != 1} is enabled and upgrade is 8>9')
api.current_logger().info(msg)
return

if get_env('LEAPP_NO_NETWORK_RENAMING', '0') == '1':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def is_net_scheme_compatible_with_current_cmdline():


def emit_msgs_to_use_net_naming_schemes():
is_env_var_set = get_env('LEAPP_USE_NET_NAMING_SCHEMES', '0') == '1'
is_feature_enabled = get_env('LEAPP_DISABLE_NET_NAMING_SCHEMES', '0') != '1'
is_upgrade_8to9 = version.get_target_major_version() == '9'
is_net_naming_enabled_and_permitted = is_env_var_set and is_upgrade_8to9
is_net_naming_enabled_and_permitted = is_feature_enabled and is_upgrade_8to9
if not is_net_naming_enabled_and_permitted:
return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ def mocked_consume(msg_type):
]
)
def test_emit_msgs_to_use_net_naming_schemes(monkeypatch, is_net_scheme_enabled, is_current_cmdline_compatible):
envvar_value = '1' if is_net_scheme_enabled else '0'
envvar_value = '0' if is_net_scheme_enabled else '1'

mocked_actor = CurrentActorMocked(src_ver='8.10',
dst_ver='9.5',
envars={'LEAPP_USE_NET_NAMING_SCHEMES': envvar_value})
envars={'LEAPP_DISABLE_NET_NAMING_SCHEMES': envvar_value})
monkeypatch.setattr(api, 'current_actor', mocked_actor)

monkeypatch.setattr(api, 'produce', produce_mocked())
Expand Down