← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1771145] [NEW] Hostname changes after every reboot with OpenNebula

 

Public bug reported:

When using the OpenNebula datasource (Ubuntu 16.04.4, cloud-init
18.2-4-g05926e48-0ubuntu1~16.04.2) the hostname switches after every
reboot between the one defined by the OpenNebula HOSTNAME context
variable and one based on the IP address (eg ip-10-22-33-44).

I took some time to review the code, and I believe it's happening
because HOSTNAME is a bash environment variable and also in context.sh
that is sourced in. When I applied the attached patch to unset HOSTNAME
prior to sourcing context.sh, the correct hostname stays persistent
across reboots. I'm not sure though if this is a "proper" fix for the
issue, but it's working for us.

Example:
root@cjm1604:~# cat /run/cloud-init/instance-data.json | jq .v1
{
  "availability-zone": null,
  "cloud-name": "opennebula",
  "instance-id": "iid-dsopennebula",
  "local-hostname": "cjm1604",
  "region": null
}
root@cjm1604:~# reboot


root@ip-10-236-120-173:~# cat /run/cloud-init/instance-data.json | jq .v1
{
  "availability-zone": null,
  "cloud-name": "opennebula",
  "instance-id": "iid-dsopennebula",
  "local-hostname": "ip-10-236-120-173",
  "region": null
}
root@ip-10-236-120-173:~# reboot


root@cjm1604:~# cat /run/cloud-init/instance-data.json | jq .v1
{
  "availability-zone": null,
  "cloud-name": "opennebula",
  "instance-id": "iid-dsopennebula",
  "local-hostname": "cjm1604",
  "region": null
}
root@cjm1604:~# reboot


Let me know if you require any additional information.

Cheers,
Corey Melanson

** Affects: cloud-init
     Importance: Undecided
         Status: New

** Patch added: "DataSourceOpenNebula.py.patch"
   https://bugs.launchpad.net/bugs/1771145/+attachment/5139300/+files/DataSourceOpenNebula.py.patch

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1771145

Title:
  Hostname changes after every reboot with OpenNebula

Status in cloud-init:
  New

Bug description:
  When using the OpenNebula datasource (Ubuntu 16.04.4, cloud-init
  18.2-4-g05926e48-0ubuntu1~16.04.2) the hostname switches after every
  reboot between the one defined by the OpenNebula HOSTNAME context
  variable and one based on the IP address (eg ip-10-22-33-44).

  I took some time to review the code, and I believe it's happening
  because HOSTNAME is a bash environment variable and also in context.sh
  that is sourced in. When I applied the attached patch to unset
  HOSTNAME prior to sourcing context.sh, the correct hostname stays
  persistent across reboots. I'm not sure though if this is a "proper"
  fix for the issue, but it's working for us.

  Example:
  root@cjm1604:~# cat /run/cloud-init/instance-data.json | jq .v1
  {
    "availability-zone": null,
    "cloud-name": "opennebula",
    "instance-id": "iid-dsopennebula",
    "local-hostname": "cjm1604",
    "region": null
  }
  root@cjm1604:~# reboot

  
  root@ip-10-236-120-173:~# cat /run/cloud-init/instance-data.json | jq .v1
  {
    "availability-zone": null,
    "cloud-name": "opennebula",
    "instance-id": "iid-dsopennebula",
    "local-hostname": "ip-10-236-120-173",
    "region": null
  }
  root@ip-10-236-120-173:~# reboot

  
  root@cjm1604:~# cat /run/cloud-init/instance-data.json | jq .v1
  {
    "availability-zone": null,
    "cloud-name": "opennebula",
    "instance-id": "iid-dsopennebula",
    "local-hostname": "cjm1604",
    "region": null
  }
  root@cjm1604:~# reboot


  
  Let me know if you require any additional information.

  Cheers,
  Corey Melanson

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1771145/+subscriptions


Follow ups