Need a consistent means to know the hostname of a machine

Bug #1918204 reported by Xav Paice
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Achilleas Anagnostopoulos

Bug Description

Currently various providers list the dns-name, and instance-id, for machines but oftentimes the cloud provider doesn't provide the hostname, so in dns-name we see an IP address and in instance-id we might see an instance uuid. We do have occasions when it's necessary to know the actual hostname of a machine, outside the times we can run code on the unit itself or via ssh.

It would be good to include in machine data a 'hostname' field that is populated by the machine agent, to read whatever is returned by a command like 'hostname', or os.Hostname().

Ian Booth (wallyworld)
Changed in juju:
milestone: none → 2.8.10
importance: Undecided → High
status: New → Triaged
Revision history for this message
Xav Paice (xavpaice) wrote :

Example output from an openstack provider machine:

$ juju show-machine 0 --format yaml
model: hacluster
machines:
  "0":
    juju-status:
      current: started
      since: 09 Mar 2021 10:07:25+13:00
      version: 2.9-beta1
    dns-name: 10.5.0.16
    ip-addresses:
    - 10.5.0.16
    - 252.0.16.1
    instance-id: 36364855-396d-436b-90f2-4134d49d58d4
    machine-status:
      current: running
      message: ACTIVE
      since: 09 Mar 2021 10:06:34+13:00
    modification-status:
      current: idle
      since: 09 Mar 2021 10:05:47+13:00
    series: xenial
    network-interfaces:
      ens3:
        ip-addresses:
        - 10.5.0.16
        mac-address: fa:16:3e:cd:4c:af
        gateway: 10.5.0.1
        space: alpha
        is-up: true
      fan-252:
        ip-addresses:
        - 252.0.16.1
        mac-address: 06:b8:17:f1:57:98
        space: alpha
        is-up: true
    hardware: arch=amd64 cores=1 mem=2048M root-disk=20480M availability-zone=nova

Compared to Maas output:
machines:
  "60":
    juju-status:
      current: started
      since: 02 Feb 2021 21:11:48Z
      version: 2.8.7
    dns-name: 1.2.3.4
    ip-addresses:
    - 1.2.3.4
    - 192.168.1.2
    instance-id: whpchd
    display-name: host1
    machine-status:
      current: running
      message: Deployed
      since: 24 Dec 2020 20:36:51Z
    modification-status:
      current: idle
      since: 24 Dec 2020 20:24:19Z
    series: xenial
    network-interfaces:
      bond0.120:
        ip-addresses:
        - 192.168.1.2
        mac-address: e4:43:4b:f6:58:f8
        space: space-2
        is-up: true
      eno3:
        ip-addresses:
        - 1.2.3.4
        mac-address: e4:43:4b:f6:58:fc
        gateway: 1.2.3.1
        space: space-0
        is-up: true
    constraints: tags=compute
    hardware: arch=amd64 cores=104 mem=589824M tags=294254-compute availability-zone=default

Changed in juju:
assignee: nobody → Achilleas Anagnostopoulos (achilleasa)
Changed in juju:
status: Triaged → In Progress
Revision history for this message
Achilleas Anagnostopoulos (achilleasa) wrote :

PR https://github.com/juju/juju/pull/12754 includes a fix for 2.8

Ian Booth (wallyworld)
Changed in juju:
status: In Progress → Fix Committed
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.