文档章节

kilo版openstack调整云主机大小

哓竹
 哓竹
发布于 2016/07/29 16:39
字数 1539
阅读 310
收藏 0

 

一、背景

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 登录dashboard

4.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连接一下。

感谢参考链接

http://blog.csdn.net/chinagissoft/article/details/50293981
http://blog.csdn.net/wylfengyujiancheng/article/details/50822491

© 著作权归作者所有

哓竹
粉丝 7
博文 54
码字总数 63086
作品 0
朝阳
运维
私信 提问
云计算OpenStack应用及开发

在云计算如火如荼纷纷落地的时候,开源软件OpenStack可谓抢占了先机,它可以提供一个可部署的云平台,提供可扩展的灵活架构。包括公有云和私有云中的虚拟计算和存储服务。OpenStack构建的云平...

马丹
2015/07/29
60
0
CentOS 推出官方 openstack 软件源

为了红帽系在云计算的市场份额,CentOS最近推出了官方openstack软件源。 有了官方源,虽然没有红帽的企业级支持,但咱也有了稳定的企业级的软件包。 不多说,直接上软件源。 http://mirrors...

purple_grape
2015/05/27
11.8K
5
云计算OpenStack应用及开发

主办方简介:中科普开是国内首家致力于IT新技术领域的领航者,专注于云计算、大数据、物联网、移动互联网技术的培训,也是国内第一家开展Hadoop、云计算的培训机构。 中科普开长期致力于企业...

马丹
2015/07/29
38
0
云计算OpenStack应用及开发

主办方简介:中科普开是国内首家致力于IT新技术领域的领航者,专注于云计算、大数据、物联网、移动互联网技术的培训,也是国内第一家开展Hadoop、云计算的培训机构。 中科普开长期致力于企业...

马丹
2015/07/29
7
0
OpenStack centos版安装(二)

在OpenStack第一天文档翻译后,丁丁努力坚持每晚抽时间翻译OpenStack官方网站提供的安装与部署指南,本文翻译自官方安装与部署指南的前四章内容,前四章内容主要是对OpenStack整体安装步骤以...

蓝狐乐队
2014/04/18
277
0

没有更多内容

加载失败,请刷新页面

加载更多

kerberos 常用命令

假定前提 1:你已经知道kerberos是做什么的,有什么用了。 2:操作者叫 zhangsan 常用命令 命令 说明 kdestroy 删除票据 kinit zhangsan {需要密码}获取张三的票据 票据有效期使用的是默认值...

os_m
22分钟前
4
0
64.springboot设置默认值启动线程数量

1.springboot配置线程 1.1 springboot默认启动线程 server.port=9000#配置编码server.tomcat.uri-encoding=UTF-8#最大并发数server.tomcat.max-threads=1000 #接受和处理的最大连接...

20190513
22分钟前
5
0
磁盘存储和文件系统(三)

磁盘存储和文件系统(三) 分区工具fdisk和gdisk 清空分区表,查看分区表 dd if=/dev/zero of=/dev/sdb bs=1 count=2 seek=510fdisk -l /dev/sdb 添加一块硬盘,识别添加的新硬盘 [root@Cent...

hardstudy-win
53分钟前
5
0
为什么Python无法解析此JSON数据? [关闭]

我在文件中有此JSON: { "maps": [ { "id": "blabla", "iscategorical": "0" }, { "id": "blabla", "iscateg......

技术盛宴
55分钟前
4
0
Eclipse更换炫酷黑色主题

https://blog.csdn.net/qq_32293345/article/details/81144831

天涯爪哇岛
58分钟前
5
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部