我使用Arch Linux x86_64 qemu 2.11.1和Zhang Chen(https://github.com/zhangckid/qemu/commits/colo-with-virtio-net-internal-jul10)以下文档'qemu/COLO-FT.txt',我在我的主机上测试colo功能

我运行此命令主要:

sudo qemu-system-x86_64 -boot c -enable-kvm -m 2048 -smp 2 -qmp stdio -name primary \
-device piix3-usb-uhci \
-device usb-tablet -netdev tap,id=hn0,vhost=off \
-device virtio-net-pci,id=net-pci0,netdev=hn0 \
-drive if=virtio,id=colo-disk0,driver=quorum,read-pattern=fifo,vote-threshold=1,children.0.file.filename=/var/lib/libvirt/images/1.raw,children.0.driver=raw -S

二级:

sudo qemu-system-x86_64 -boot c -enable-kvm -m 2048 -smp 2 -qmp stdio -name secondary \
-device piix3-usb-uhci \
-device usb-tablet -netdev tap,id=hn0,vhost=off \
-device virtio-net-pci,id=net-pci0,netdev=hn0 \
-drive if=none,id=colo-disk0,file.filename=/var/lib/libvirt/images/2.raw,driver=raw,node-name=node0 \
-drive if=virtio,id=active-disk0,driver=replication,mode=secondary,\
file.driver=qcow2,top-id=active-disk0,\
file.file.filename=/mnt/ramfs/active_disk.img,\
file.backing.driver=qcow2,\
file.backing.file.filename=/mnt/ramfs/hidden_disk.img,\
file.backing.backing=colo-disk0 \
-incoming tcp:0:8888

二级:

{'execute':'qmp_capabilities'}
{ 'execute': 'nbd-server-start',
  'arguments': {'addr': {'type': 'inet', 'data': {'host': '192.168.0.33', 'port': '8889'} } }
}
{'execute': 'nbd-server-add', 'arguments': {'device': 'colo-disk0', 'writable': true } }

主:

{'execute':'qmp_capabilities'}
{ 'execute': 'human-monitor-command',
  'arguments': {'command-line': 'drive_add -n buddy driver=replication,mode=primary,file.driver=nbd,file.host=192.168.0.34,file.port=8889,file.export=colo-disk0,node-name=nbd_client0'}}
{ 'execute':'x-blockdev-change', 'arguments':{'parent': 'colo-disk0', 'node': 'nbd_client0' } }
{ 'execute': 'migrate-set-capabilities',
      'arguments': {'capabilities': [ {'capability': 'x-colo', 'state': true } ] } }
{ 'execute': 'migrate', 'arguments': {'uri': 'tcp:192.168.0.34:8888' } }

以上都OK.Two VM同步 .

主:

{ 'execute': 'x-blockdev-change', 'arguments': {'parent': 'colo-disk0', 'child': 'children.1'}}
{ 'execute': 'human-monitor-command','arguments': {'command-line': 'drive_del blk-buddy0'}}

二级:

{ 'execute': 'nbd-server-stop' }
{ 'execute': 'x-colo-lost-heartbeat' }

但是当我执行x-colo-lost-heartbeat.Primary运行二级现金时

{'execute':'nbd-server-stop'} {"return":{}} qemu-system-x86_64:断开客户端,原因是:在读取所有字节之前出现意外的文件结束{'execute':'x-colo-lost-heartbeat'} {"return":{}} qemu-system-x86_64 :无法接收COLO消息 enter code here e:输入/输出错误**错误:/build/qemu/src/qemu-2.11.1/qom/object.c:907:object_unref:断言失败(obj-> ref> 0 ):( 0> 0)[1] 2972 abort sudo / usr / bin / qemu-system-x86_64 -boot c -enable-kvm -m 2048 -smp 2 -qmp stdi