How to specify domain name for the overcloud in Red Hat OpenStack Platform

Solution Verified - Updated

Environment

  • Red Hat OpenStack 7
  • Red Hat OpenStack 8
  • Red Hat OpenStack Platform 9
  • Red Hat OpenStack Platform 10
  • Red Hat OpenStack Platform 11
  • Red Hat OpenStack 12
  • IS NOT VALID for Red Hat OpenStack Platform 13 and newer releases

Issue

After deployment of Overcloud all servers have domain localdomain like overcloud-compute-0.localdoman. Is there a way to define our own domain name?

  • Overcloud deploy can fail because domain name isn't set correctly in undercloud configuration.
    journalctl -u os-collect-config from overcloud controller:
Scope(Haproxy::Config[haproxy]): haproxy: The $merge_options parameter will default to true in the next major release. Please review the documentation regarding the implications.\u001b[0m\n\u001b[1;31mError: Could not prefetch mysql_user provider 'mysql': Execution of '/usr/bin/mysql -NBe SELECT CONCAT(User, '@',Host) AS User FROM mysql.user' returned 1: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)\u001b[0m\n\u001b[1;31mError: /usr/bin/clust
  • Galera fails to sync because of hostname problem
  • pcs status
 Master/Slave Set: galera-master [galera]
     galera     (ocf::heartbeat:galera):        FAILED Master rh-cntrl1 (blocked)
     galera     (ocf::heartbeat:galera):        FAILED Master rh-cntrl0 (blocked)
 Masters: [ ops2-rh-cntrl2 ]

Resolution

WARNING 1: Changes to host and/or domain names in an already deployed cloud are not supported and can lead to catastrophic consequences. Host and domain name configuration is supported on new clouds only.

WARNING 2: overcloud_domain_name configuration parameter should be used to configure overcloud domain name in undercloud starting from RHOSP 13. Please follow official documentation and ignore information below if you are using RHOSP 13 or newer RHOSP release.

The domain name for overcloud nodes defaults to 'localdomain' . For example: 'overcloud-compute-0.localdomain' . With an enhancement released with RHEA-2016-0604 , a parameter (CloudDomain) to customize the domain name has been introduced.

Steps:

  • Create an environment file with the CloudDomain parameter included in the 'parameter_defaults' section. If no domain name is defined, the Heat templates default to 'localdomain'.
parameter_defaults:
  CloudDomain: redhat.com
  • In the /etc/nova/nova.conf on the undercloud edit the following option. (Will be deprecated in the future by dns_domain)
dhcp_domain = redhat.com

Use crudini to make configuration easier:

crudini --set /etc/nova/nova.conf DEFAULT dhcp_domain redhat.com
  • In the /etc/neutron/neutron.conf file on the undercloud edit the following option.
dns_domain = redhat.com

Use crudini to make configuration easier:

crudini --set /etc/neutron/neutron.conf DEFAULT dns_domain redhat.com
  • Restart both nova and neutron on the undercloud
# systemctl list-units | egrep 'nova|neutron' | awk '{print $1}' | xargs -I {} systemctl restart {}
  • Deploy the overcloud

Note: For OSP releases prior to version 10 the dhcp_domain and dns_domain parameters will be overwritten during undercloud updates or upgrades. This parameter must be manually restored after an update or upgrade using the steps outline above.

Making changes last after undercloud updates

For OSP 10 and later, a new parameter hieradata_override has been added to the undercloud configuration which can be used to preserve the dhcp_domain nova parameter.

Example usage on the undercloud:

  • Create hiera override file /home/stack/custom_hiera.yaml
cat<<'EOF' > /home/stack/custom_hiera.yaml
nova::network::neutron::dhcp_domain: redhat.com
neutron::dns_domain: redhat.com
EOF
  • Configure the hieradata_override parameter in undercloud.conf.
crudini --set /home/stack/undercloud.conf DEFAULT hieradata_override /home/stack/custom_hiera.yaml
  • Also, the directory: /var/lib/os-collect-config should not be present on the undercloud; remove it to work around a known issue.

  • After an undercloud update or upgrade, verify dhcp_domain is still set properly.

$ sudo crudini --get /etc/nova/nova.conf DEFAULT dhcp_domain

Diagnostic Steps

  • check hostname and comapre to /etc/hosts
[root@ops2-rh-cntrl0 heat-admin]# hostname
rh-cntrl0.localdomain

 [root@ops2-rh-cntrl0 heat-admin]# cat /etc/hosts | grep rh-cntrl0
 172.31.178.74 rh-cntrl0.lab.redat.com rh-cntrl0
SBR
Components

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.