Bug 1330358

Summary: Hostname shown in cockpit is not the same between login page and host page
Product: Red Hat Enterprise Linux 7 Reporter: wanghui <huiwa>
Component: cockpitAssignee: Marius Vollmer <mvollmer>
Status: CLOSED NOTABUG QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: bugs, cshao, fdeutsch, huzhao, leiwang, mvollmer, stefw, weiwang, yaniwang
Target Milestone: pre-dev-freezeKeywords: Extras
Target Release: 7.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-07 08:58:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Node RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1329957    

Description wanghui 2016-04-26 02:23:20 UTC
Description of problem:
The hostname shown in cockpit in not the same between login page and host page.
In login page, the server name is the same as the output as #hostname in node. But in host page, the hostname is the same as the output as /etc/hostname.

Version-Release number of selected component (if applicable):
ovirt-node-ng-installer-ovirt-3.6-2016042323.iso 
cockpit-0.103-1.el7.centos.x86_64
cockpit-ovirt-0.5.1-0.0.master.el7.centos.noarch

How reproducible:
100%

Steps to Reproduce:
1. Anaconda install NGN 4.0.
2. Start cockpit service.
3. Change the hostname in node side by #echo "test.redhat.com" > /etc/hostname.
4. Change the hostname in node side using command #hostname ltest.redhat.com"
5. Check in cockpit with fresh login.

Actual results:
1. After step4, login page shows "Server: ltest.redhat.com".
2. After step5, host page shows "Host Name test.redhat.com".

Expected results:
1. The hostname in cockpit should be same between login page and host page.

Additional info:

Comment 1 Stef Walter 2016-04-26 08:30:14 UTC
What does the hostnamectl command say? This is where Cockpit gets the information about the host name.

Comment 2 wanghui 2016-04-27 05:33:18 UTC
(In reply to Stef Walter from comment #1)
> What does the hostnamectl command say? This is where Cockpit gets the
> information about the host name.

# hostnamectl 
   Static hostname: test.redhat.com
   Pretty hostname: test
Transient hostname: ltest.redhat.com
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: aedcf54a9c5d4e87b19123ee38fc653b
           Boot ID: 6fdeb36ea0cf4479b5310153686897a4
  Operating System: oVirt Node 3.6.5_master
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-327.13.1.el7.x86_64
      Architecture: x86-64

Comment 3 Stef Walter 2016-04-27 08:52:32 UTC
Marius, do you think we should show the transient host name in the server page when it differs from the static host name?

Comment 5 Marius Vollmer 2016-07-05 13:48:10 UTC
> do you think we should show the transient host name in the server page when it differs from the static host name?

Shouldn't the static hostname take precedence always?  I think I remember a change you made to systemd to that effect, no?

Comment 6 Marius Vollmer 2016-07-05 14:14:23 UTC
Stef, https://github.com/systemd/systemd/commit/c779a44222161155c039a7fd2fd304c006590ac7

Based on that I'd say that the login page should use the static hostname.

Comment 7 Marius Vollmer 2016-07-05 14:15:32 UTC
Is the problem here maybe that the "#hostname ..." thing changes the kernel hostname directly?  This is not supported anymore with systemd.  Everyone must go via hostnamed.

Comment 8 Marius Vollmer 2016-07-05 14:17:58 UTC
> the "#hostname ..." thing

Ahh, that's just /usr/bin/hostname.

Comment 9 Stef Walter 2016-07-06 10:58:29 UTC
Marius, I agree. If someone calls hostname, instead of hostnamectl to change the hostname they've gone "off road" and get to keep both pieces.

I would suggest closing this with WONTFIX.

Comment 10 Marius Vollmer 2016-07-07 08:58:44 UTC
> If someone calls hostname, instead of hostnamectl to change the hostname they've gone "off road" and get to keep both pieces.

Yeah, that's the new rule apparently.  Is it documented somewhere?  

https://www.freedesktop.org/wiki/Software/systemd/hostnamed/ doesn't really mention it.

Comment 11 Stef Walter 2016-07-07 09:23:36 UTC
It's documented here: http://cockpit-project.org/guide/latest/feature-systemd.html

Should we make it more explicit?