共计 8413 个字符,预计需要花费 22 分钟才能阅读完成。
这篇文章主要介绍了 kilo 版 openstack 如何调整云主机大小,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让丸趣 TV 小编带着大家一起了解一下。
一、背景
kilo 版本,dashboard 页面在线调整云主机大小,点击后无变化,需要修改配置。
二、配置修改
所有节点修改 nova 配置文件 /etc/nova/nova.conf
# vi /etc/nova/nova.conf
[DEFAULT]
scheduler_default_filters=RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter
allow_resize_to_same_host=true
三、重启服务
控制节点
# systemctl restart openstack-nova-api openstack-nova-cert openstack-nova-compute openstack-nova-scheduler openstack-nova-conductor
计算节点
# systemctl restart openstack-nova-compute
四、配置 nova 用户互信
按照官方文档安装的 kilo 版本 openstack 的 nova 用户并不是自己手动创建的,需要修改 nova 用户的配置才可以配置互信
配置互信是为了避免出现调整云主机大小时出现以下类似报错
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher Traceback (most recent call last):
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py , line 142, in _dispatch_and_reply
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher executor_callback))
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py , line 186, in _dispatch
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher executor_callback)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py , line 130, in _do_dispatch
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher result = func(ctxt, **new_args)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/nova/compute/manager.py , line 6890, in resize_instance
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher clean_shutdown=clean_shutdown)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/nova/exception.py , line 88, in wrapped
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher payload)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/oslo_utils/excutils.py , line 85, in __exit__
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/nova/exception.py , line 71, in wrapped
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher return f(self, context, *args, **kw)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/nova/compute/manager.py , line 333, in decorated_function
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher LOG.warning(msg, e, instance_uuid=instance_uuid)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/oslo_utils/excutils.py , line 85, in __exit__
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/nova/compute/manager.py , line 304, in decorated_function
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher return function(self, context, *args, **kwargs)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/nova/compute/manager.py , line 383, in decorated_function
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher return function(self, context, *args, **kwargs)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/nova/compute/manager.py , line 292, in decorated_function
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher migration.instance_uuid, exc_info=True)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/oslo_utils/excutils.py , line 85, in __exit__
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/nova/compute/manager.py , line 269, in decorated_function
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher return function(self, context, *args, **kwargs)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/nova/compute/manager.py , line 361, in decorated_function
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher kwargs[instance], e, sys.exc_info())
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/oslo_utils/excutils.py , line 85, in __exit__
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/nova/compute/manager.py , line 349, in decorated_function
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher return function(self, context, *args, **kwargs)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/nova/compute/manager.py , line 4078, in resize_instance
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher self.instance_events.clear_events_for_instance(instance)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib64/python2.7/contextlib.py , line 35, in __exit__
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher self.gen.throw(type, value, traceback)
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher File /usr/lib/python2.7/site-packages/nova/compute/manager.py , line 6479, in _error_out_instance_on_exception
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher raise error.inner_exception
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher ResizeError: Resize error: not able to execute ssh command: Unexpected error while running command.
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher Command: ssh 192.168.8.218 mkdir -p /var/lib/nova/instances/2907c778-3e30-4012-ab2c-ab43dcca1ea0
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher Exit code: 255
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher Stdout: u
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher Stderr: u Host key verification failed.\r\n
2016-07-29 14:03:13.933 33877 TRACE oslo_messaging.rpc.dispatcher
4.1 修改 nova 用户密码
# passwd nova
Changing password for user nova.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
4.2 修改 /etc/passwd
# vi /etc/passwd
nova:x:162:162:OpenStack Nova Daemons:/var/lib/nova:/sbin/nologin
nova:x:162:162:OpenStack Nova Daemons:/var/lib/nova:/bin/bash
4.3 配置互信
此时可以切换至 nova 用户,bdc217 上操作
nova 之间不仅仅是要无密码,还必须得是不需要验证,节点少的情况下所以最好手动节点之间互相先 ssh 连接一下。
-bash-4.2$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/nova/.ssh/id_rsa):
Created directory /var/lib/nova/.ssh .
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/lib/nova/.ssh/id_rsa.
Your public key has been saved in /var/lib/nova/.ssh/id_rsa.pub.
The key fingerprint is:
35:b2:62:61:cb:1e:fb:a9:03:19:5b:a8:38:e7:70:54 nova@bdc212
The key s randomart image is:
+--[ RSA 2048]----+
| |
| E |
| . .o .. o |
| . oo.o + . |
| o . =* S |
|+ + +o + |
| * .o |
| . .. . |
| .oo |
+-----------------+
-bash-4.2$ ssh-copy-id localhost
-bash-4.2$ scp -r .ssh/ bdc218:~/
-bash-4.2$ scp -r .ssh/ bdc216:~/
-bash-4.2$ ssh bdc218
Last login: Fri Jul 29 16:13:20 2016 from 192.168.13.217
-bash-4.2$ uname -n
bdc218
成功无密码连接到 bdc218 的 nova 用户
4.4 登录 dashboard4.4.1 调整大小前截图留念
4.4.2 调整云主机大小
4.4.3 把其它的几台云主机也调整了
4.4.4 此外不仅可以调大,开弓也有回头箭,还可以调小
五、总结
OpenStack 的云主机配置类型的修改,其实相当于做了一个云主机在不同宿主机的迁移,所以需要在相关迁移云主机进行无密码访问,由于 OpenStack 是由 Nova 组件来管理云主机,所以需要对 Nova 用户进行无密码访问。
但是,云主机之间的迁移可以通过 virsh 的 qemu+tcp 的方式进行迁移,不用配置 nova 的互信也可以进行。
kilo 版 openstack 云主机动态热迁移
六、注意
1、在迁移或者调整云主机大小的过程中,虚拟机会有 downtime,运行的服务也会 down 掉,所以最好事先关闭正在运行的服务。
2、nova 之间不仅仅是要无密码,还必须得是不需要验证,节点少的情况下所以最好手动节点之间互相先 ssh 连接一下。
感谢你能够认真阅读完这篇文章,希望丸趣 TV 小编分享的“kilo 版 openstack 如何调整云主机大小”这篇文章对大家有帮助,同时也希望大家多多支持丸趣 TV,关注丸趣 TV 行业资讯频道,更多相关知识等着你来学习!