xen+drbd (partial?) success story
We are trying to migrate a domain from a xen box to another transparently, using drbd to ensure the smallest "freezetime" possible.
The method described here allows to do that ; the affected domain will be suspended 3 times (a few seconds each time), and doesn't have to be destroyed/recreated whatsoever.
The following explanations assume you know about xen domain creation, are familiar with "xm save" and "xm restore", and know what is drbd (if you don't know exactly how to use it, refer to its documentation ; all operations described here are "basic" drbd functions).
Long story made short : the migrated domain root device is a symlink, which gets changed between a xm save/xm restore bracked, to switch from a plain root device to a drbd. BUT, we get strange kernel messages on dom0 when running drbd-backed domain ...
Phase A: some extra steps to take at domain creation
1) create a logical volume to host the domain rootfs (for instance, /dev/vg/mydomain)
2) create a symlink to this domain rootfs (for instance, /dev/xenlvs/mydomain -> /dev/vg/mydomain)
3) mkfs the logical volume and populate it with a filesystem
4) start the domain (the configuration should use xenlvs/mydomain as block device, NOT vg/mydomain)
Phase B: substitute the real root block device with drbd
5) compile drbd module and utils on both xen boxes
6) xm save mydomain (this suspends the domain, saving its state)
7) setup a drbd pseudo-disk on the source box, using the domain logical volume as data disk (and some external temporary storage as meta-data disk) ; let's assume the drbd will be /dev/drbd0 ; and switch this drbd to "primary" operation (=source for synchronization in drbd terms)
8) change the symlink /dev/xenlvs/mydomain so it points to /dev/drbd0
9) xm restore mydomain (this will resume operation on the domain)
Steps 7 and 8 are very short, so this first save/restore should not be noticable.
Phase C: synchronize drbd state
10) on the target xen box, create the target logical volume (/dev/vg/mydomaintoo for instance) - it should obviously have the same size as the source logical volume
11) associate it with a drbd device and setup a symlink with the SAME NAME as on the source box - e.g. /dev/xenlvs/mydomain -> /dev/vg/mydomaintoo
12) synchronize both drbd devices ; wait for synchronization to complete (this can take some time, but the domain stills run on the source box unaffected meanwhile)
Phase D: actual migration
13) when synchronization is complete, "xm save" the domain on the source box
14) transfer the saved image (size is dependent of xen domain memory size) to the target box
15) tear down drbd on the target box
16) "xm restore" the saved image on the target box
transfer speed is limited by your network or disks ; drbd detach is very quick (a few seconds again) ; so those steps won't freeze your domain for a long time !
Phase E: cleanup
17) you can tear down the drbd on the source box (as well as the now unused logical volume)
This works well, *but* when operating a xen domain over drbd, we see a lot of "suspicious" messages in xen0 domain (see attached log). Those messages *seem* harmless, but they certainly indicate something is going wrong under the hood. If someone is familiar with xen and drbd internals and has a clue about what they mean, I will be very happy to learn from them ...
All tests were made with xen-testing (as of apr, 27 bk source), compiled
with gcc 3.3.4 (from Debian), on a Dual Xeon system (running "pure 32
bits" kernel).
Quoted 6 lines
Are you sure you attached the error message log? I'm interested in seeing what dom0 is complaining about. Could you send me a copy?
I hope it will get thru this time ...
Badness in blk_plug_device at drivers/block/ll_rw_blk.c:1217
[<c02270d0>] blk_plug_device+0x80/0x90 [<c7101a27>] drbd_make_request_common+0x727/0x8f0 [drbd] [<c0227314>] blk_run_queue+0x34/0x80 [<c027ccfd>] netif_rx+0x9d/0x1f0 [<c708085f>] br_pass_frame_up_finish+0xf/0x20 [bridge] [<c0288561>] nf_hook_slow+0xf1/0x130 [<c7080850>] br_pass_frame_up_finish+0x0/0x20 [bridge] [<c7101cd6>] drbd_make_request_26+0xe6/0x29d [drbd] [<c012fd70>] autoremove_wake_function+0x0/0x60 [<c0228f4d>] generic_make_request+0x17d/0x220 [<c0296e30>] ip_rcv_finish+0x0/0x280 [<c012fd70>] autoremove_wake_function+0x0/0x60 [<c012fd70>] autoremove_wake_function+0x0/0x60 [<c013a5b3>] mempool_alloc+0x73/0x1b0 [<c012fd70>] autoremove_wake_function+0x0/0x60 [<c0229052>] submit_bio+0x62/0x100 [<c015d414>] bio_add_page+0x34/0x40 [<c02445cd>] dispatch_rw_block_io+0x39d/0x450 [<c011aa72>] __call_console_drivers+0x62/0x70 [<c011ab70>] call_console_drivers+0x60/0x120 [<c01f1466>] vsnprintf+0x256/0x4d0 [<c011afb7>] release_console_sem+0x67/0x120 [<c011ae4e>] vprintk+0x12e/0x1b0 [<c011ad17>] printk+0x17/0x20 [<c0134f07>] __print_symbol+0x87/0xe0 [<c0296e30>] ip_rcv_finish+0x0/0x280 [<c0255ac8>] ata_check_status+0x28/0x30 [<c0255616>] ata_tf_load_pio+0x126/0x1b0 [<c0255ac8>] ata_check_status+0x28/0x30 [<c01f2132>] __delay+0x12/0x20 [<c0258b03>] ata_bmdma_setup_pio+0x43/0x60 [<c0258a08>] ata_qc_issue_prot+0x108/0x150 [<c02588c1>] ata_qc_issue+0x61/0xa0 [<c025a890>] ata_scsi_translate+0xe0/0x130 [<c024b0b0>] scsi_done+0x0/0x30 [<c025a570>] ata_scsi_rw_xlat+0x0/0x1f0 [<c024b0b0>] scsi_done+0x0/0x30 [<c024b0b0>] scsi_done+0x0/0x30 [<c025b35b>] ata_scsi_queuecmd+0x5b/0x120 [<c0107c2a>] __switch_to+0x2a/0x380 [<c0224d1b>] elv_next_request+0x1b/0x100 [<c01e7ff0>] .text.lock.shm+0xc/0x11c [<c0224d50>] elv_next_request+0x50/0x100 [<c022718e>] __generic_unplug_device+0x3e/0x40 [<c02271b7>] generic_unplug_device+0x27/0x60 [<c0116448>] recalc_task_prio+0x88/0x150 [<c02eebc9>] schedule+0x2e9/0x520 [<c0244131>] do_block_io_op+0x111/0x120 [<c0243df7>] blkio_schedule+0x127/0x180 [<c01170d0>] default_wake_function+0x0/0x20 [<c01094b2>] ret_from_fork+0x6/0x1c [<c01170d0>] default_wake_function+0x0/0x20 [<c0243cd0>] blkio_schedule+0x0/0x180 [<c0107525>] kernel_thread_helper+0x5/0x10 Badness in blk_remove_plug at drivers/block/ll_rw_blk.c:1238 [<c022714e>] blk_remove_plug+0x6e/0x70 [<c71077b2>] drbd_unplug_fn+0x22/0x220 [drbd] [<c0243dd6>] blkio_schedule+0x106/0x180 [<c01170d0>] default_wake_function+0x0/0x20 [<c01094b2>] ret_from_fork+0x6/0x1c [<c01170d0>] default_wake_function+0x0/0x20 [<c0243cd0>] blkio_schedule+0x0/0x180 [<c0107525>] kernel_thread_helper+0x5/0x10 Badness in blk_plug_device at drivers/block/ll_rw_blk.c:1217 [<c02270d0>] blk_plug_device+0x80/0x90 [<c7101a27>] drbd_make_request_common+0x727/0x8f0 [drbd] [<c0227314>] blk_run_queue+0x34/0x80 [<c027ccfd>] netif_rx+0x9d/0x1f0 [<c708085f>] br_pass_frame_up_finish+0xf/0x20 [bridge] [<c0288561>] nf_hook_slow+0xf1/0x130 [<c7080850>] br_pass_frame_up_finish+0x0/0x20 [bridge] [<c7101cd6>] drbd_make_request_26+0xe6/0x29d [drbd] [<c012fd70>] autoremove_wake_function+0x0/0x60 [<c0228f4d>] generic_make_request+0x17d/0x220 [<c0296e30>] ip_rcv_finish+0x0/0x280 [<c012fd70>] autoremove_wake_function+0x0/0x60 [<c012fd70>] autoremove_wake_function+0x0/0x60 [<c013a5b3>] mempool_alloc+0x73/0x1b0 [<c012fd70>] autoremove_wake_function+0x0/0x60 [<c0229052>] submit_bio+0x62/0x100 [<c015d414>] bio_add_page+0x34/0x40 [<c02445cd>] dispatch_rw_block_io+0x39d/0x450 [<c011aa72>] __call_console_drivers+0x62/0x70 [<c011ab70>] call_console_drivers+0x60/0x120 [<c01f1466>] vsnprintf+0x256/0x4d0 [<c011afb7>] release_console_sem+0x67/0x120 [<c011ae4e>] vprintk+0x12e/0x1b0 [<c011ad17>] printk+0x17/0x20 [<c0134f07>] __print_symbol+0x87/0xe0 [<c0296e30>] ip_rcv_finish+0x0/0x280 [<c0255ac8>] ata_check_status+0x28/0x30 [<c0255616>] ata_tf_load_pio+0x126/0x1b0 [<c0255ac8>] ata_check_status+0x28/0x30 [<c01f2132>] __delay+0x12/0x20 [<c0258b03>] ata_bmdma_setup_pio+0x43/0x60 [<c0258a08>] ata_qc_issue_prot+0x108/0x150 [<c02588c1>] ata_qc_issue+0x61/0xa0 [<c025a890>] ata_scsi_translate+0xe0/0x130 [<c024b0b0>] scsi_done+0x0/0x30 [<c025a570>] ata_scsi_rw_xlat+0x0/0x1f0 [<c024b0b0>] scsi_done+0x0/0x30 [<c024b0b0>] scsi_done+0x0/0x30 [<c025b35b>] ata_scsi_queuecmd+0x5b/0x120 [<c0107c2a>] __switch_to+0x2a/0x380 [<c0224d1b>] elv_next_request+0x1b/0x100 [<c01e7ff0>] .text.lock.shm+0xc/0x11c [<c0224d50>] elv_next_request+0x50/0x100 [<c022718e>] __generic_unplug_device+0x3e/0x40 [<c02271b7>] generic_unplug_device+0x27/0x60 [<c0116448>] recalc_task_prio+0x88/0x150 [<c02eebc9>] schedule+0x2e9/0x520 [<c0244131>] do_block_io_op+0x111/0x120 [<c0243df7>] blkio_schedule+0x127/0x180 [<c01170d0>] default_wake_function+0x0/0x20 [<c01094b2>] ret_from_fork+0x6/0x1c [<c01170d0>] default_wake_function+0x0/0x20 [<c0243cd0>] blkio_schedule+0x0/0x180 [<c0107525>] kernel_thread_helper+0x5/0x10 Badness in blk_remove_plug at drivers/block/ll_rw_blk.c:1238 [<c022714e>] blk_remove_plug+0x6e/0x70 [<c71077b2>] drbd_unplug_fn+0x22/0x220 [drbd] [<c0243dd6>] blkio_schedule+0x106/0x180 [<c01170d0>] default_wake_function+0x0/0x20 [<c01094b2>] ret_from_fork+0x6/0x1c [<c01170d0>] default_wake_function+0x0/0x20 [<c0243cd0>] blkio_schedule+0x0/0x180 [<c0107525>] kernel_thread_helper+0x5/0x10 Badness in blk_plug_device at drivers/block/ll_rw_blk.c:1217 [<c02270d0>] blk_plug_device+0x80/0x90 [<c7101a27>] drbd_make_request_common+0x727/0x8f0 [drbd] [<c0227314>] blk_run_queue+0x34/0x80 [<c027ccfd>] netif_rx+0x9d/0x1f0 [<c708085f>] br_pass_frame_up_finish+0xf/0x20 [bridge] [<c0288561>] nf_hook_slow+0xf1/0x130 [<c7080850>] br_pass_frame_up_finish+0x0/0x20 [bridge] [<c7101cd6>] drbd_make_request_26+0xe6/0x29d [drbd] [<c012fd70>] autoremove_wake_function+0x0/0x60 [<c0228f4d>] generic_make_request+0x17d/0x220 [<c0296e30>] ip_rcv_finish+0x0/0x280 [<c012fd70>] autoremove_wake_function+0x0/0x60 [<c012fd70>] autoremove_wake_function+0x0/0x60 [<c013a5b3>] mempool_alloc+0x73/0x1b0 [<c012fd70>] autoremove_wake_function+0x0/0x60 [<c0229052>] submit_bio+0x62/0x100 [<c015d414>] bio_add_page+0x34/0x40 [<c02445cd>] dispatch_rw_block_io+0x39d/0x450 [<c011aa72>] __call_console_drivers+0x62/0x70 [<c011ab70>] call_console_drivers+0x60/0x120 [<c01f1466>] vsnprintf+0x256/0x4d0 [<c011afb7>] release_console_sem+0x67/0x120 [<c011ae4e>] vprintk+0x12e/0x1b0 [<c011ad17>] printk+0x17/0x20 [<c0134f07>] __print_symbol+0x87/0xe0 [<c0296e30>] ip_rcv_finish+0x0/0x280 [<c0255ac8>] ata_check_status+0x28/0x30 [<c0255616>] ata_tf_load_pio+0x126/0x1b0 [<c0255ac8>] ata_check_status+0x28/0x30 [<c01f2132>] __delay+0x12/0x20 [<c0258b03>] ata_bmdma_setup_pio+0x43/0x60 [<c0258a08>] ata_qc_issue_prot+0x108/0x150 [<c02588c1>] ata_qc_issue+0x61/0xa0 [<c025a890>] ata_scsi_translate+0xe0/0x130 [<c024b0b0>] scsi_done+0x0/0x30 [<c025a570>] ata_scsi_rw_xlat+0x0/0x1f0 [<c024b0b0>] scsi_done+0x0/0x30 [<c024b0b0>] scsi_done+0x0/0x30 [<c025b35b>] ata_scsi_queuecmd+0x5b/0x120 [<c0107c2a>] __switch_to+0x2a/0x380 [<c0224d1b>] elv_next_request+0x1b/0x100 [<c01e7ff0>] .text.lock.shm+0xc/0x11c [<c0224d50>] elv_next_request+0x50/0x100 [<c022718e>] __generic_unplug_device+0x3e/0x40 [<c02271b7>] generic_unplug_device+0x27/0x60 [<c0116448>] recalc_task_prio+0x88/0x150 [<c02eebc9>] schedule+0x2e9/0x520 [<c0244131>] do_block_io_op+0x111/0x120 [<c0243df7>] blkio_schedule+0x127/0x180 [<c01170d0>] default_wake_function+0x0/0x20 [<c01094b2>] ret_from_fork+0x6/0x1c [<c01170d0>] default_wake_function+0x0/0x20 [<c0243cd0>] blkio_schedule+0x0/0x180 [<c0107525>] kernel_thread_helper+0x5/0x10 Badness in blk_remove_plug at drivers/block/ll_rw_blk.c:1238 [<c022714e>] blk_remove_plug+0x6e/0x70 [<c71077b2>] drbd_unplug_fn+0x22/0x220 [drbd] [<c0243dd6>] blkio_schedule+0x106/0x180 [<c01170d0>] default_wake_function+0x0/0x20 [<c01094b2>] ret_from_fork+0x6/0x1c [<c01170d0>] default_wake_function+0x0/0x20 [<c0243cd0>] blkio_schedule+0x0/0x180 [<c0107525>] kernel_thread_helper+0x5/0x10
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 11 lines · Jérôme Petazzoni
Quoted 4 lines
Are you sure you attached the error message log? I'm interested in seeing what dom0 is complaining about. Could you send me a copy?
I hope it will get thru this time ...
______________________________________________________________________
Badness in
blk_plug_deviceatdrivers/block/ll_rw_blk.c:1217[<c02270d0>] blk_plug_device+0x80/0x90 [<c7101a27>] drbd_make_request_common+0x727/0x8f0 [drbd]
Did you compile the drbd module with ARCH=xen?
Quoted 10 lines
Quoted 6 lines
Badness in
blk_plug_deviceatdrivers/block/ll_rw_blk.c:1217[<c02270d0>] blk_plug_device+0x80/0x90 [<c7101a27>] drbd_make_request_common+0x727/0x8f0 [drbd]Did you compile the drbd module with ARCH=xen?
That's it ! Thanks a lot.
I had compiled with Debian's module-assistant and dumbly assumed that it would reuse the correct ARCH setting from the specified source tree. I was wrong, andre-building the module package the correct flags (MAKEFLAGS="ARCH=xen") gave me a different module, which worked perfectly, without those messages.
By the way, performance of drbd-backed root device in a domU seems now equal to performance of raw access in dom0. Great !