Friday 23 April 2010

VM migration call stack (libvirt and qemu-KVM)

libvirt-0.7.7/tools/virsh.c: cmdMigrate() -> virDomainMigrate() -> virDomainMigrateVersion2() -> domain->conn->driver->domainMigratePerform() ->

libvirt-0.7.7/src/qemu/qemu_driver.c: qemudDomainMigratePerform() -> doNativeMigrate() -> qemuMonitorMigrateToHost() -> qemuMonitorTextMigrateToHost() -> qemuMonitorCommandWithHandler:230:
Send command 'migrate -d "tcp:tsurugi8.il.is.s.u-tokyo.ac.jp:49157"'

qemu-kvm-0.12.3/migration.c: do_migrate() -> tcp_start_outgoing_migration() -> migrate_fd_connect()

migrate_fd_connect():

qemu_fopen_ops_buffered(): creates a QEMUFileBuffered object and sets up a timer in qemu_new_timer(), where buffered_rate_tick() is the actual callback function.

buffered_rate_tick(): sets the new timer deadline and calls the QEMUFileBuffered obj's put_buffer() and put_ready() functions that were registered as migrate_fd_put_buffer() and migrate_fd_put_ready() respectively.

migrate_fd_put_ready(): calls qemu_savevm_state_iterate() that iterates the savevm_handlers and calls save_live_state() on each.

two live save handlers are registered: ram_save_live() and block_save_live() for the memory and the disk respectively.

ram_save_live():

No comments:

Post a Comment