解决openstack实例主机名后缀问题

时间:2022-03-03 10:33:17

参考地址
https://ask.openstack.org/en/question/26918/change-novalocal-suffix-in-hostname/

问题现象 可以看到主机名的后缀带.novalocal

[root@open-controller-1 ~]# source dawn-openstack.sh
[root@open-controller-1 ~]# nova list
+--------------------------------------+-------------+--------+------------+-------------+---------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+-------------+--------+------------+-------------+---------------------+
| 818a137d-61db-41b9-9cbc-699b28227bd3 | CentOS7-1 | ACTIVE | - | Running | provider=10.0.8.111 |
| 14fe356f-bdf9-4ce0-aef6-11833d9d6015 | centos7-119 | ACTIVE | - | Running | provider=10.0.8.119 |
| b410b03a-5358-49d9-b52a-e5bc4fe720c8 | demo1 | ACTIVE | - | Running | provider=10.0.8.117 |
| 5bfb09ea-f53e-43c2-8c42-74d3c51cbfe6 | demo10 | ACTIVE | - | Running | provider=10.0.8.118 |
| 385d5ccb-7efe-4d09-ab2b-8e05619bf3d6 | demo9 | ACTIVE | - | Running | provider=10.0.8.106 |
+--------------------------------------+-------------+--------+------------+-------------+---------------------+
[root@open-controller-1 ~]# ssh centos@10.0.8.119
Last login: Tue Dec 4 13:56:16 2018 from 10.0.8.11
[centos@centos7-119 ~]$ hostname
centos7-119.novalocal
[centos@centos7-119 ~]$ exit
logout
Connection to 10.0.8.119 closed.
[root@open-controller-1 ~]#

  

在 Control node修改nova.conf

去掉这个后缀

解决openstack实例主机名后缀问题

配置为空

解决openstack实例主机名后缀问题

重启nova-api服务

[root@open-controller-1 ~]# systemctl restart openstack-nova-api.service
[root@open-controller-1 ~]#

  

后面创建的实例查看主机名不带后缀了

[root@open-controller-1 ~]# sh show_vm.sh
open-compute-1.inner.hzdgjy.cn instance-00000018 demo10 provider=10.0.8.118
open-compute-1.inner.hzdgjy.cn instance-0000000f demo1 provider=10.0.8.117
-----------------------
open-compute-2.inner.hzdgjy.cn instance-0000001b cent provider=10.0.8.119
open-compute-2.inner.hzdgjy.cn instance-0000000e demo9 provider=10.0.8.106
-----------------------
[root@open-controller-1 ~]# ssh centos@10.0.8.119
[centos@cent ~]$ hostname
cent
[centos@cent ~]$ sudo su -
Last login: Mon Nov 5 21:30:33 CST 2018 from 10.0.8.11 on pts/0
[root@cent ~]# hostname
cent
[root@cent ~]#