kilo版openstack調整雲主機大小

 

1、背景

kilo版本,dashboard頁面在線調整雲主機大小,點擊後無變化,須要修改配置。python

 

 

2、配置修改

全部節點修改nova配置文件/etc/nova/nova.confapi


 

# vi /etc/nova/nova.conf

[DEFAULT]

...

scheduler_default_filters=RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter

allow_resize_to_same_host=true

 

3、重啓服務

控制節點bash

 

# systemctl restart openstack-nova-api openstack-nova-cert openstack-nova-compute openstack-nova-scheduler openstack-nova-conductor

 

計算節點app

 

# systemctl restart openstack-nova-compute

 

 

4、配置nova用戶互信

按照官方文檔安裝的kilo版本openstack的nova用戶並非本身手動建立的,須要修改nova用戶的配置才能夠配置互信dom

配置互信是爲了不出現調整雲主機大小時出現如下相似報錯python2.7

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上操做ssh

nova之間不單單是要無密碼,還必須得是不須要驗證,節點少的狀況下因此最好手動節點之間互相先ssh鏈接一下。 tcp

-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用戶ide

 

4.4 登陸dashboard

4.4.1 調整大小前截圖留念

 

 

4.4.2 調整雲主機大小

4.4.3 把其它的幾臺雲主機也調整了

 

4.4.4  此外不只能夠調大,開弓也有回頭箭,還能夠調小

 

5、總結

OpenStack的雲主機配置類型的修改,其實至關於作了一個雲主機在不一樣宿主機的遷移,因此須要在相關遷移雲主機進行無密碼訪問,因爲OpenStack是由Nova組件來管理雲主機,因此須要對Nova用戶進行無密碼訪問。ui

可是,雲主機之間的遷移能夠經過virsh 的qemu+tcp的方式進行遷移,不用配置nova的互信也能夠進行。

kilo版openstack雲主機動態熱遷移


6、注意

一、 在遷移或者調整雲主機大小的過程當中,虛擬機會有 downtime,運行的服務也會down掉,因此最好事先關閉正在運行的服務。

二、nova之間不單單是要無密碼,還必須得是不須要驗證,節點少的狀況下因此最好手動節點之間互相先ssh鏈接一下。

感謝參考連接

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

相關文章
相關標籤/搜索