虚拟机跨主机RESIZE和迁移时候报错的问题
起因KILO版本,今天查到在分布式环境下修改虚拟机配置大小,是有一定的概率出错的,当一个虚拟机修改配置时候,有可能此虚拟机会被迁移到另一个资源更多的主机,这个时候就会报错我查了原因是nova 用户需要配置免密钥登录,才能完成这样的操作。报错内容如下:nova.compute.manager [req-7cb1c029-beb4-4905-a9d9-62d488540eda f542d1b
起因
KILO版本,
今天查到在分布式环境下修改虚拟机配置大小,是有一定的概率出错的,
当一个虚拟机修改配置时候,有可能此虚拟机会被迁移到另一个资源更多的主机,这个时候就会报错
我查了原因是nova 用户需要配置免密钥登录,才能完成这样的操作。
报错内容如下:
nova.compute.manager [req-7cb1c029-beb4-4905-a9d9-62d488540eda f542d1b5afeb4908b8b132c4486f9fa8 c2bfab5ad24642359f43cdff9bb00047] Setting instance vm_state to ERROR
TRACE nova.compute.manager Traceback (most recent call last):
TRACE nova.compute.manager File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 5596, in _error_out_instance_on_exception
TRACE nova.compute.manager yield
TRACE nova.compute.manager File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 3459, in resize_instance
TRACE nova.compute.manager block_device_info)
TRACE nova.compute.manager File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 4980, in migrate_disk_and_power_off
TRACE nova.compute.manager utils.execute('ssh', dest, 'mkdir', '-p', inst_base)
TRACE nova.compute.manager File "/usr/lib/python2.7/site-packages/nova/utils.py", line 165, in execute
TRACE nova.compute.manager return processutils.execute(*cmd, **kwargs)
TRACE nova.compute.manager File "/usr/lib/python2.7/site-packages/nova/openstack/common/processutils.py", line 193, in execute
TRACE nova.compute.manager cmd=' '.join(cmd))
TRACE nova.compute.manager ProcessExecutionError: Unexpected error while running command.
TRACE nova.compute.manager Command: ssh 10.5.2.20 mkdir -p /var/lib/nova/instances/99736f90-db0f-4cba-8f44-a73a603eee0b
TRACE nova.compute.manager Exit code: 255
TRACE nova.compute.manager Stdout: ''
TRACE nova.compute.manager Stderr: 'Host key verification failed.\r\n'
TRACE nova.compute.manager
ERROR oslo.messaging.rpc.dispatcher [-] Exception during message handling: Unexpected error while running command.
Command: ssh 10.5.2.20 mkdir -p /var/lib/nova/instances/99736f90-db0f-4cba-8f44-a73a603eee0b
Exit code: 255
解决办法
控制节点配置:
usermod -s /bin/bash nova
Generate SSH key and configuration
After doing this the next steps are all run as the nova user.
su - nova
We need to generate an SSH key:
ssh-keygen -t rsa
Follow the directions, and save the key WITHOUT a passphrase.
Next up we need to configure SSH to not do host key verification, unless you want to manually SSH to all compute nodes that exist and accept the key (and continue to do so for each new compute node you add).
cat << EOF > ~/.ssh/config
Host *
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
EOF
cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
如果用比较暴力简单的方案,可以COPY这个.ssh到其他主机的nova家目录,就可以了
scp -r serverip:/var/lib/nova/.ssh/* /var/lib/nova/.ssh/
之后,发现仍有报错:
.103 7779 TRACE nova.compute.manager [instance: ] Traceback (most recent call last):
.103 7779 TRACE nova.compute.manager [instance: ] File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 6459, in _error_out_instance_on_exception
.103 7779 TRACE nova.compute.manager [instance: ] yield
.103 7779 TRACE nova.compute.manager [instance: ] File "/usr/lib/python2.7/dist-packages/nova/compute/manager.py", line 4054, in resize_instance
.103 7779 TRACE nova.compute.manager [instance: ] timeout, retry_interval)
.103 7779 TRACE nova.compute.manager [instance: ] File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 6353, in migrate_disk_and_power_off
.103 7779 TRACE nova.compute.manager [instance: ] shared_storage)
.103 7779 TRACE nova.compute.manager [instance: ] File "/usr/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 85, in __exit__
.103 7779 TRACE nova.compute.manager [instance: ] six.reraise(self.type_, self.value, self.tb)
.103 7779 TRACE nova.compute.manager [instance: ] File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/driver.py", line 6342, in migrate_disk_and_power_off
.103 7779 TRACE nova.compute.manager [instance: ] on_completion=on_completion)
.103 7779 TRACE nova.compute.manager [instance: ] File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/utils.py", line 329, in copy_image
.103 7779 TRACE nova.compute.manager [instance: ] on_execute=on_execute, on_completion=on_completion)
.103 7779 TRACE nova.compute.manager [instance: ] File "/usr/lib/python2.7/dist-packages/nova/virt/libvirt/utils.py", line 55, in execute
.103 7779 TRACE nova.compute.manager [instance: ] return utils.execute(*args, **kwargs)
.103 7779 TRACE nova.compute.manager [instance: ] File "/usr/lib/python2.7/dist-packages/nova/utils.py", line 207, in execute
.103 7779 TRACE nova.compute.manager [instance: ] return processutils.execute(*cmd, **kwargs)
.103 7779 TRACE nova.compute.manager [instance: ] File "/usr/lib/python2.7/dist-packages/oslo_concurrency/processutils.py", line 174, in execute
.103 7779 TRACE nova.compute.manager [instance: ] raise UnknownArgumentError(_('Got unknown keyword args: %r') % kwargs)
.103 7779 TRACE nova.compute.manager [instance: ] UnknownArgumentError: Got unknown keyword args: {'on_execute': <function <lambda> at 0x7f3a64527050>, 'on_completion': <function <lambda> at 0x7f39ff6ddf50>}
.103 7779 TRACE nova.compute.manager [instance: ]
查证,
OpenStack Nova Kilo release requires 1.8.2 or higher, this is due to the
addition of on_execute and on_completion to the execute(..) function.
The latest Ubuntu OpenStack Kilo packages currently have code that
depend on this new updated release. This results in a crash in some
operations like resizes or migrations.
下载软件python-oslo-concurrency-1.8.2-1.el7
http://cbs.centos.org/koji/buildinfo?buildID=7030
替换后,解决!
参考:
http://funcptr.net/2014/09/29/openstack-resizing-of-instances/
https://blueprints.launchpad.net/nova/+spec/no-migration-resize
更多推荐
所有评论(0)