openstack迁移实例报错
迁移实例报错信息:
Setting instance to ACTIVE state.: InvalidCPUInfo_Remote: Unacceptable CPU info: CPU doesn't have compatibility
2020-09-02 10:04:33.079 14141 WARNING nova.scheduler.utils [req-a4bc6a99-7298-4ad2-9fd0-911e7be5fad7 d608482bcb1b4522949e8e3d429d0b00 4abcf64d621e4cf89aa267887647bc8c - default default] Failed to compute_task_migrate_server: Unacceptable CPU info: CPU doesn't have compatibility. 0 Refer to http://libvirt.org/html/libvirt-libvirt-host.html#virCPUCompareResult Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 165, in _process_incoming res = self.dispatcher.dispatch(message) File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 274, in dispatch return self._do_dispatch(endpoint, method, ctxt, args) File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 194, in _do_dispatch result = func(ctxt, **new_args) File "/usr/lib/python2.7/site-packages/nova/exception_wrapper.py", line 79, in wrapped function_name, call_dict, binary, tb) File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__ self.force_reraise() File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise six.reraise(self.type_, self.value, self.tb) File "/usr/lib/python2.7/site-packages/nova/exception_wrapper.py", line 69, in wrapped return f(self, context, *args, **kw) File "/usr/lib/python2.7/site-packages/nova/compute/utils.py", line 1372, in decorated_function return function(self, context, *args, **kwargs) File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 219, in decorated_function kwargs['instance'], e, sys.exc_info()) File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__ self.force_reraise() File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise six.reraise(self.type_, self.value, self.tb) File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 207, in decorated_function return function(self, context, *args, **kwargs) File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 6789, in check_can_live_migrate_destination block_migration, disk_over_commit) File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 7990, in check_can_live_migrate_destination self._compare_cpu(None, source_cpu_info, instance) File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 8315, in _compare_cpu raise exception.InvalidCPUInfo(reason=m % {'ret': ret, 'u': u}) InvalidCPUInfo: Unacceptable CPU info: CPU doesn't have compatibility. 0 Refer to http://libvirt.org/html/libvirt-libvirt-host.html#virCPUCompareResult : InvalidCPUInfo_Remote: Unacceptable CPU info: CPU doesn't have compatibility. 2020-09-02 10:04:33.080 14141 WARNING nova.scheduler.utils [req-a4bc6a99-7298-4ad2-9fd0-911e7be5fad7 d608482bcb1b4522949e8e3d429d0b00 4abcf64d621e4cf89aa267887647bc8c - default default] [instance: 2cb54812-1e21-4d25-9a19-fa6aa2a4c0e3] Setting instance to ACTIVE state.: InvalidCPUInfo_Remote: Unacceptable CPU info: CPU doesn't have compatibility.
解决方法
vim /usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py
##注释掉以下配置跳过CPU检测
8267 if guest_cpu is None: 8268 info = jsonutils.loads(host_cpu_str) 8269 LOG.info('Instance launched has CPU info: %s', host_cpu_str) 8270 cpu = vconfig.LibvirtConfigCPU() 8271 cpu.arch = info['arch'] 8272 cpu.model = info['model'] 8273 cpu.vendor = info['vendor'] 8274 cpu.sockets = info['topology']['sockets'] 8275 cpu.cores = info['topology']['cores'] 8276 cpu.threads = info['topology']['threads'] 8277 #for f in info['features']: 8278 # cpu.add_feature(vconfig.LibvirtConfigCPUFeature(f)) 8279 #elif isinstance(guest_cpu, vconfig.LibvirtConfigGuestCPU): 8280 # cpu = guest_cpu 8281 else: 8282 cpu = self._vcpu_model_to_cpu_config(guest_cpu)
7987 # Compare CPU 7988 """ 7989 if not instance.vcpu_model or not instance.vcpu_model.model: 7990 source_cpu_info = src_compute_info['cpu_info'] 7991 self._compare_cpu(None, source_cpu_info, instance) 7992 else: 7993 self._compare_cpu(instance.vcpu_model, None, instance) 7994 """
systemctl restart openstack-nova-compute.service
热迁移计算节点报错:
2020-09-03 11:14:12.288 2144 ERROR nova.virt.libvirt.driver [-] [instance: 1bb2c170-83c6-4111-8713-e4c81e02a95d] Live Migration failure: operation failed: Failed to connect to remote libvirt URI qemu+tcp://node01/system: unable to connect to server at 'node01:16509': Connection refused: libvirtError: operation failed: Failed to connect to remote libvirt URI qemu+tcp://node01/system: unable to connect to server at 'node01:16509': Connection refused
2020-09-03 11:14:12.225 2144 INFO nova.compute.manager [-] [instance: 1bb2c170-83c6-4111-8713-e4c81e02a95d] Took 2.20 seconds for pre_live_migration on destination host node01. 2020-09-03 11:14:12.288 2144 ERROR nova.virt.libvirt.driver [-] [instance: 1bb2c170-83c6-4111-8713-e4c81e02a95d] Live Migration failure: operation failed: Failed to connect to remote libvirt URI qemu+tcp://node01/system: unable to connect to server at 'node01:16509': Connection refused: libvirtError: operation failed: Failed to connect to remote libvirt URI qemu+tcp://node01/system: unable to connect to server at 'node01:16509': Connection refused 2020-09-03 11:14:12.781 2144 ERROR nova.virt.libvirt.driver [-] [instance: 1bb2c170-83c6-4111-8713-e4c81e02a95d] Migration operation has aborted 2020-09-03 11:14:12.800 2144 INFO nova.compute.manager [-] [instance: 1bb2c170-83c6-4111-8713-e4c81e02a95d] Swapping old allocation on [u'1e855f5b-9539-41b6-8b0f-9233f0b1ba3b'] held by migration 36b196ea-976e-48f1-9c2f-19b2d9820b72 for instance 2020-09-03 11:14:12.999 2144 WARNING nova.compute.manager [req-94da1d5a-bc8d-451b-878d-86337478d5af 1d920253b08e4e699469e7e89eed9c62 90db3dcd8d0d480ead7955670fb6e696 - default default] [instance: 1bb2c170-83c6-4111-8713-e4c81e02a95d] Received unexpected event network-vif-plugged-31109fb4-4c3b-4aec-931b-10f8de493de2 for instance with vm_state active and task_state None.
解决方法
##在计算节点添加以下配置
cat >>/etc/libvirt/libvirtd.conf<<EOF listen_tls = 0 listen_tcp = 1 unix_sock_group = "root" unix_sock_rw_perms = "0777" auth_unix_ro = "none" auth_unix_rw = "none" log_filters="2:qemu_monitor_json 2:qemu_driver" log_outputs="2:file:/var/log/libvirt/libvirtd.log" tcp_port = "16509" listen_addr = "0.0.0.0" auth_tcp = "none" EOF
cat >>/etc/sysconfig/libvirtd<<EOF LIBVIRTD_ARGS="--listen" EOF
systemctl restart libvirtd;systemctl status libvirtd
冷迁移计算节点报错:
2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server ResizeError: Resize error: not able to execute ssh command: Unexpected error while running command
2020-09-03 14:05:40.215 1153 INFO nova.compute.manager [req-267b11a1-f3d8-4528-a8b5-6c5ea915b8bd 8de78fc493384b34b96203a8b63ab356 90db3dcd8d0d480ead7955670fb6e696 - default default] [instance: 12214e65-31aa-4552-b03e-4dcf97ccd009] Setting instance back to stopped after: Instance rollback performed due to: Resize error: not able to execute ssh command: Unexpected error while running command. Command: ssh -o BatchMode=yes 10.1.10.153 mkdir -p /var/lib/nova/instances/12214e65-31aa-4552-b03e-4dcf97ccd009 Exit code: 255 Stdout: u'' Stderr: u'Host key verification failed.\r\n' 2020-09-03 14:05:40.316 1153 INFO nova.compute.manager [req-267b11a1-f3d8-4528-a8b5-6c5ea915b8bd 8de78fc493384b34b96203a8b63ab356 90db3dcd8d0d480ead7955670fb6e696 - default default] [instance: 12214e65-31aa-4552-b03e-4dcf97ccd009] Swapping old allocation on [u'e04b06f3-17a3-452a-bbc1-63e9ec0c9834'] held by migration c2e45483-a20e-4e7b-a456-b835b0a95231 for instance 2020-09-03 14:05:40.502 1153 INFO nova.compute.manager [req-267b11a1-f3d8-4528-a8b5-6c5ea915b8bd 8de78fc493384b34b96203a8b63ab356 90db3dcd8d0d480ead7955670fb6e696 - default default] [instance: 12214e65-31aa-4552-b03e-4dcf97ccd009] Successfully reverted task state from None on failure for instance. 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server [req-267b11a1-f3d8-4528-a8b5-6c5ea915b8bd 8de78fc493384b34b96203a8b63ab356 90db3dcd8d0d480ead7955670fb6e696 - default default] Exception during message handling: ResizeError: Resize error: not able to execute ssh command: Unexpected error while running command. Command: ssh -o BatchMode=yes 10.1.10.153 mkdir -p /var/lib/nova/instances/12214e65-31aa-4552-b03e-4dcf97ccd009 Exit code: 255 Stdout: u'' Stderr: u'Host key verification failed.\r\n' 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server Traceback (most recent call last): 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 165, in _process_incoming 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server res = self.dispatcher.dispatch(message) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 274, in dispatch 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server return self._do_dispatch(endpoint, method, ctxt, args) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 194, in _do_dispatch 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server result = func(ctxt, **new_args) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/nova/exception_wrapper.py", line 79, in wrapped 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server function_name, call_dict, binary, tb) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__ 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server self.force_reraise() 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server six.reraise(self.type_, self.value, self.tb) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/nova/exception_wrapper.py", line 69, in wrapped 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server return f(self, context, *args, **kw) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 191, in decorated_function 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server "Error: %s", e, instance=instance) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__ 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server self.force_reraise() 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server six.reraise(self.type_, self.value, self.tb) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 161, in decorated_function 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server return function(self, context, *args, **kwargs) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/nova/compute/utils.py", line 1372, in decorated_function 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server return function(self, context, *args, **kwargs) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 219, in decorated_function 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server kwargs['instance'], e, sys.exc_info()) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__ 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server self.force_reraise() 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server six.reraise(self.type_, self.value, self.tb) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 207, in decorated_function 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server return function(self, context, *args, **kwargs) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 4887, in resize_instance 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server self._revert_allocation(context, instance, migration) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__ 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server self.force_reraise() 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server six.reraise(self.type_, self.value, self.tb) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 4884, in resize_instance 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server instance_type, clean_shutdown, request_spec) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 4943, in _resize_instance 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server request_spec) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib64/python2.7/contextlib.py", line 35, in __exit__ 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server self.gen.throw(type, value, traceback) 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 8987, in _error_out_instance_on_exception 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server raise error.inner_exception 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server ResizeError: Resize error: not able to execute ssh command: Unexpected error while running command. 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server Command: ssh -o BatchMode=yes 10.1.10.153 mkdir -p /var/lib/nova/instances/12214e65-31aa-4552-b03e-4dcf97ccd009 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server Exit code: 255 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server Stdout: u'' 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server Stderr: u'Host key verification failed.\r\n' 2020-09-03 14:05:40.512 1153 ERROR oslo_messaging.rpc.server
解决方法
##1.在所有控制节点和计算节点配置免密钥通信
https://www.cnblogs.com/omgasw/p/13453462.html
##2.在计算节点添加以下配置
openstack-config --set /etc/nova/nova.conf DEFAULT allow_resize_to_same_host True
openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_default_filters RetryFilter,AvailabilityZoneFilter,RamFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter
##3.重启服务
systemctl restart openstack-nova-compute.service
使用快照跨平台迁移实例
https://docs.openstack.org/nova/train/admin/migrate-instance-with-snapshot.html