RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2084469 - RFE: static hostname modification
Summary: RFE: static hostname modification
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: nmstate
Version: 9.1
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Gris Ge
QA Contact: Mingyu Shi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-12 08:25 UTC by Quique Llorente
Modified: 2023-01-09 16:11 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-15 10:00:45 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github nmstate nmstate pull 1911 0 None open hostname: Add support of static hostname modification 2022-05-27 08:54:06 UTC
Red Hat Issue Tracker RHELPLAN-121812 0 None None None 2022-05-12 08:27:07 UTC
Red Hat Product Errata RHBA-2022:7991 0 None None None 2022-11-15 10:01:03 UTC

Description Quique Llorente 2022-05-12 08:25:18 UTC
Description of problem:

At openshift the hostname of nodes are taken from DHCP if interfaces are configured statically setting "dhcp: false" the nodes does not get the hostname and the cluster startup fail.

Setting the hostname statically withing the nmstate yaml that move the interfaces to "dhcp: false" would help here.


Version-Release number of selected component (if applicable):


How reproducible: 


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Gris Ge 2022-05-27 08:54:06 UTC
Patch posted to upstream: https://github.com/nmstate/nmstate/pull/1911

Example yaml:

```yaml
---
hostname:
  running: "nmstate-test.example.org"
  config: "nmstate-test.example.org"
```

The `running` is the activating hostname. The `config` is the on-disk
hostname in /etc/hostname. Then setting empty string to `config`,
nmstate will remove on-disk hostname.

Comment 3 Quique Llorente 2022-05-27 09:02:04 UTC
(In reply to Gris Ge from comment #2)
> Patch posted to upstream: https://github.com/nmstate/nmstate/pull/1911
> 
> Example yaml:
> 
> ```yaml
> ---
> hostname:
>   running: "nmstate-test.example.org"
>   config: "nmstate-test.example.org"
> ```
> 
> The `running` is the activating hostname. The `config` is the on-disk
> hostname in /etc/hostname. Then setting empty string to `config`,
> nmstate will remove on-disk hostname.

There is also the following concept on hostnamectl, don't know if we have that at NM.

     --transient         Only set transient hostname
     --static            Only set static hostname
     --pretty            Only set pretty hostname

Comment 4 Fernando F. Mancera 2022-06-02 10:46:14 UTC
Tested with integration tests out of a container. It works as expected. Thanks!

Comment 7 Mingyu Shi 2022-06-15 03:22:58 UTC
nmstate-2.1.1-0.alpha.20220602.5accbd1.el9.x86_64

It seems successful according to the output, but nmstatectl got error when applying.
@Gris could you please take a look?


The original hostname in `nmstatectl show`:
hostname:
  running: sweetpig-8.4a2m.lab.eng.bos.redhat.com
  config: ""


Then I applied such state:
hostname:
  running: sweetpig-8.4a2m.lab.eng.bos.redhat.com
  config: test.name


It reported error(returned 65):
[11:12:13@sweetpig-8 ~]0# nmstatectl edit 
[2022-06-15T03:12:23Z INFO  nmstate::nispor::show] Got unsupported interface lo type Loopback
[2022-06-15T03:12:23Z INFO  nmstate::nm::show] Got unsupported interface type generic: lo, ignoring
[2022-06-15T03:12:56Z INFO  nmstate::nispor::show] Got unsupported interface lo type Loopback
[2022-06-15T03:12:57Z INFO  nmstate::nm::show] Got unsupported interface type generic: lo, ignoring
[2022-06-15T03:12:57Z INFO  nmstate::net_state] Ignoring kernel interface lo
[2022-06-15T03:12:57Z INFO  nmstate::net_state] Created checkpoint /org/freedesktop/NetworkManager/Checkpoint/6
[2022-06-15T03:12:57Z INFO  nmstate::nispor::show] Got unsupported interface lo type Loopback
[2022-06-15T03:12:57Z INFO  nmstate::nm::show] Got unsupported interface type generic: lo, ignoring
[2022-06-15T03:12:57Z ERROR nmstate::hostname] VerificationError: Verification fail, desire hostname.running: sweetpig-8.4a2m.lab.eng.bos.redhat.com, current: Some("test.name")
[2022-06-15T03:12:57Z INFO  nmstate::net_state] Retrying on verification failure: VerificationError: Verification fail, desire hostname.running: sweetpig-8.4a2m.lab.eng.bos.redhat.com, current: Some("test.name")
[2022-06-15T03:12:58Z INFO  nmstate::nispor::show] Got unsupported interface lo type Loopback
[2022-06-15T03:12:58Z INFO  nmstate::nm::show] Got unsupported interface type generic: lo, ignoring
[2022-06-15T03:12:58Z ERROR nmstate::hostname] VerificationError: Verification fail, desire hostname.running: sweetpig-8.4a2m.lab.eng.bos.redhat.com, current: Some("test.name")
[2022-06-15T03:12:58Z INFO  nmstate::net_state] Retrying on verification failure: VerificationError: Verification fail, desire hostname.running: sweetpig-8.4a2m.lab.eng.bos.redhat.com, current: Some("test.name")
[2022-06-15T03:12:59Z INFO  nmstate::nispor::show] Got unsupported interface lo type Loopback
[2022-06-15T03:12:59Z INFO  nmstate::nm::show] Got unsupported interface type generic: lo, ignoring
[2022-06-15T03:12:59Z ERROR nmstate::hostname] VerificationError: Verification fail, desire hostname.running: sweetpig-8.4a2m.lab.eng.bos.redhat.com, current: Some("test.name")
[2022-06-15T03:12:59Z INFO  nmstate::net_state] Retrying on verification failure: VerificationError: Verification fail, desire hostname.running: sweetpig-8.4a2m.lab.eng.bos.redhat.com, current: Some("test.name")
[2022-06-15T03:13:00Z INFO  nmstate::nispor::show] Got unsupported interface lo type Loopback
[2022-06-15T03:13:00Z INFO  nmstate::nm::show] Got unsupported interface type generic: lo, ignoring
[2022-06-15T03:13:00Z ERROR nmstate::hostname] VerificationError: Verification fail, desire hostname.running: sweetpig-8.4a2m.lab.eng.bos.redhat.com, current: Some("test.name")
[2022-06-15T03:13:00Z INFO  nmstate::net_state] Retrying on verification failure: VerificationError: Verification fail, desire hostname.running: sweetpig-8.4a2m.lab.eng.bos.redhat.com, current: Some("test.name")
[2022-06-15T03:13:01Z INFO  nmstate::nispor::show] Got unsupported interface lo type Loopback
[2022-06-15T03:13:01Z INFO  nmstate::nm::show] Got unsupported interface type generic: lo, ignoring
[2022-06-15T03:13:01Z ERROR nmstate::hostname] VerificationError: Verification fail, desire hostname.running: sweetpig-8.4a2m.lab.eng.bos.redhat.com, current: Some("test.name")
[2022-06-15T03:13:01Z INFO  nmstate::net_state] Rollbacked to checkpoint /org/freedesktop/NetworkManager/Checkpoint/6
NmstateError: VerificationError: Verification fail, desire hostname.running: sweetpig-8.4a2m.lab.eng.bos.redhat.com, current: Some("test.name")


But it actually succeeded by checking:
[11:13:52@sweetpig-8 ~]0# nmstatectl show | yq '.hostname'
[2022-06-15T03:14:14Z INFO  nmstate::nispor::show] Got unsupported interface lo type Loopback
[2022-06-15T03:14:15Z INFO  nmstate::nm::show] Got unsupported interface type generic: lo, ignoring
running: test.name
config: test.name
[11:14:15@sweetpig-8 ~]0# hostname
test.name

Comment 8 Mingyu Shi 2022-06-20 07:21:05 UTC
In here, "running" and "config" under "hostname" are different, "running" takes effect at runtime(is recovered after rebooting)

Mark it as verified, filed a new bug to trace the problem in #comment7

Comment 10 errata-xmlrpc 2022-11-15 10:00:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (nmstate bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:7991


Note You need to log in before you can comment on or make changes to this bug.