用qemu做迁移

参考 http://www.linux-kvm.org/page/Migration


同一台机器:


启动原guest:

~/git/qemu/i386-softmmu/qemu-system-i386 -enable-kvm -drive file=ubuntu.qcow2 -boot dc -m 512  -monitor stdio -netdev user,id=usernet -device rtl8139,netdev=usernet


启动目的guest:

~/git/qemu/i386-softmmu/qemu-system-i386 -enable-kvm -drive file=ubuntu.qcow2 -boot dc -m 512  -monitor stdio -netdev user,id=usernet -device rtl8139,netdev=usernet -incoming tcp:0:4444


在原机器的monitor中输入:

migrate -d tcp:0:4444


查看迁移情况:

info migrate


算法

参考 http://www.linux-kvm.org/page/Migration

1. Setup

  • Start guest on destination, connect, enable dirty page logging and more

2. Transfer Memory

  • Guest continues to run
  • Bandwidth limitation (controlled by the user)
  • First transfer the whole memory
  • Iteratively transfer all dirty pages (pages that were written to by the guest).

3. Stop the guest

  • And sync VM image(s) (guest's hard drives).

4. Transfer State

  • As fast as possible (no bandwidth limitation)
  • All VM devices' state and dirty pages yet to be transferred

5. Continue the guest

  • On destination upon success
    • Broadcast "I'm over here" Ethernet packet to announce new location of NIC(s).
  • On source upon failure (with one exception).


一些log


htab_save_iterate(): first_pass=1
htab_save_iterate(): first_pass=1
htab_save_iterate(): first_pass=1
htab_save_iterate(): first_pass=0
htab_save_iterate(): first_pass=0
htab_save_iterate(): first_pass=0
htab_save_iterate(): first_pass=0
Hash table migration complete
First pass (3 iterations): 34147 chunks, 34997 valid, 489291 invalid
Middle passes (4 iterations): 0 chunks, 0 valid, 0 invalid
Final transfer: 0 chunks, 0 valid, 0 invalid



Qemu的一些接口

http://www.linux-kvm.org/page/MigrationQemu0.8.2


和例子中的接口是两套。

你可能感兴趣的:(kvm)