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

Fixes #37098 - setting the hostname from the primary interface #10013

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

aldreygalindo
Copy link
Contributor

Setting the hostname from the primary interface

@theforeman-bot
Copy link
Member

Can one of the admins verify this patch?

2 similar comments
@theforeman-bot
Copy link
Member

Can one of the admins verify this patch?

@theforeman-bot
Copy link
Member

Can one of the admins verify this patch?

@@ -23,6 +23,9 @@ test_on:
.map { |add_on| "--addon '#{add_on.strip}'" }.join(" ")}" if host_param('syspurpose_addons')
-%>
<% if subman_registration -%>
%pre
hostnamectl set-hostname --static <%= @host.name %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please comment here why it is necessary, the same way described in the https://projects.theforeman.org/issues/37098?

Copy link
Contributor

Choose a reason for hiding this comment

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

Provisioning a RHEL9 system with a dedicated nic for provisioning and another as primary results in a duplicated host created on satellite, with the name defined on the provisioning interface.

This happens because we're using the rhsm component of Anaconda to register the system. At that point of the installation, the host is using the hostname that it got from the DHCP. Then it registers into Satellite with that name.

Later, the anaconda will update the name for the name of the primary interface, but at that point, the extra host already exists on Satellite.

This change sets the expected hostname to the host early during the installation avoiding this situation.

@stejskalleos
Copy link
Contributor

Waiting for QA review: https://issues.redhat.com/browse/SAT-22579

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

We want to avoid using %pre if there is a proper way. We already push the hostname on the network here:

network_options.push("--hostname #{@host.name}")

So the question is, why isn't that used. I suspect it's because we don't set up the networking properly and only use the network statement for the provisioning interface. #9961 aims to solve that.

If the hostname of the machine itself needs to be set while booting, then the proper place to solve it is probably in the boot. https://anaconda-installer.readthedocs.io/en/latest/boot-options.html#ip describes how to do that with Anaconda. https://github.com/theforeman/foreman/blob/develop/app/views/unattended/provisioning_templates/snippet/kickstart_kernel_options.erb is where we send those. The challenge here is probably that we use DHCP mode where the hostname isn't set.

@stejskalleos
Copy link
Contributor

Hi, there has been a change in configuring network interfaces during the provisioning; we are now using the network command from Anaconda for all interfaces.

Can you please check if the problem still occurs with the new behavior?

ca34010

@stejskalleos stejskalleos removed their assignment Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants