题 libvirt qemu / kvm迁移问题


我在戴尔服务器上使用kvm和libvirt。现在我正在尝试将一个虚拟机从物理服务器迁移到另一个虚拟机。但是,我每次都失败了。

在物理服务器1上的virsh中,我键入:

virsh # migrate virtualmachine1 qemu+ssh://username@physicalServer2/system
error: operation failed: migration to 'tcp:physicalServer2:49163' failed: migration failed

然后我搜索了 关于libvirt.org的FAQ部分。它说:

error: operation failed: migration to '...' failed: migration failed

This is an error often encountered when trying to migrate with QEMU/KVM. This typically happens with plain migration, when the source VM cannot connect to the destination host. You will want to make sure your hosts are properly configured for migration (see the migration section of this FAQ)

我成功了 ssh physicalServer2 来自virtualmachine1上的shell,所以上面的红色部分没有解释我的失败。

我也在physicalServer2上打开端口, iptables -L 显示以下信息:

Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpt:domain
ACCEPT tcp -- anywhere anywhere tcp dpt:domain
ACCEPT udp -- anywhere anywhere udp dpt:bootps
ACCEPT tcp -- anywhere anywhere tcp dpt:bootps
ACCEPT udp -- anywhere anywhere udp dpt:domain
ACCEPT tcp -- anywhere anywhere tcp dpt:domain
ACCEPT udp -- anywhere anywhere udp dpt:bootps
ACCEPT tcp -- anywhere anywhere tcp dpt:bootps
ACCEPT tcp -- anywhere anywhere state NEW tcp dpts:49152:49215


Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere 192.168.122.0/24 state RELATED,ESTABLISHED
ACCEPT all -- 192.168.122.0/24 anywhere
ACCEPT all -- anywhere anywhere
REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
ACCEPT all -- anywhere 192.168.122.0/24 state RELATED,ESTABLISHED
ACCEPT all -- 192.168.122.0/24 anywhere
ACCEPT all -- anywhere anywhere
REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
REJECT all -- anywhere anywhere reject-with icmp-port-unreachable


Chain OUTPUT (policy ACCEPT)
target prot opt source destination

physicalServer2上的/var/log/libvirt/qemu/virtualmachine1.log:

2011-05-06 13:37:30.708: starting up
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin QEMU_AUDIO_DRV=none /usr/bin/kvm -S -M pc-0.14 -enable-kvm -m 2048 -smp 1,sockets=1,cores=1,threads=1 -name openjudge-test -uuid a8c704bc-a4f9-90db-3e57-40e60b00aac1 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/virtualmachine1.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -rtc base=utc -boot c -drive file=/media/nfs/virtualmachine1.img,if=none,id=drive-ide0-0-0,format=raw -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=20,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=00:16:36:8a:22 :a0,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -vnc 127.0.0.1:2 -vga cirrus -incoming tcp:0.0.0.0:49163 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
char device redirected to /dev/pts/0
2011-05-06 13:37:30.915: shutting down

physicalServer1上的/var/log/libvirt/qemu/virtualmachine1.log为空。

两台物理服务器都使用Ubuntu 11.04。使用的libvirt和kvm由apt-get安装。 libvirt版本是0.8.8。


5
2018-05-07 05:58




VM的图像在哪里?两个服务器都可以访问此图像并在同一路径上看到它吗? physicalServer2有完整的rw访问权限吗? - smintz
另外,确保libvirt用户可以ssh到physicalServer2(在其known_hosts中有服务器的rsa密钥,最好为libvirt用户设置ssh密钥) - smintz
作为测试,我还试图完全摆脱防火墙 - dyasny


答案:


确保在主机和DNS或彼此的/ etc / hosts文件中的每个主机名之间打开TCP 49152-49261。出于某种原因,KVM迁移取决于主机名而不是IP地址。


2
2017-07-06 01:57





确保两台主机服务器位于同一物理交换机(或VLAN)上。


1
2017-07-27 06:24