]> git.proxmox.com Git - qemu.git/blob - block-migration.c
block-migration: add reference to target DriveInfo
[qemu.git] / block-migration.c
1 /*
2 * QEMU live block migration
3 *
4 * Copyright IBM, Corp. 2009
5 *
6 * Authors:
7 * Liran Schour <lirans@il.ibm.com>
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
11 *
12 */
13
14 #include "qemu-common.h"
15 #include "block_int.h"
16 #include "hw/hw.h"
17 #include "qemu-queue.h"
18 #include "qemu-timer.h"
19 #include "monitor.h"
20 #include "block-migration.h"
21 #include "migration.h"
22 #include "blockdev.h"
23 #include <assert.h>
24
25 #define BLOCK_SIZE (BDRV_SECTORS_PER_DIRTY_CHUNK << BDRV_SECTOR_BITS)
26
27 #define BLK_MIG_FLAG_DEVICE_BLOCK 0x01
28 #define BLK_MIG_FLAG_EOS 0x02
29 #define BLK_MIG_FLAG_PROGRESS 0x04
30
31 #define MAX_IS_ALLOCATED_SEARCH 65536
32
33 //#define DEBUG_BLK_MIGRATION
34
35 #ifdef DEBUG_BLK_MIGRATION
36 #define DPRINTF(fmt, ...) \
37 do { printf("blk_migration: " fmt, ## __VA_ARGS__); } while (0)
38 #else
39 #define DPRINTF(fmt, ...) \
40 do { } while (0)
41 #endif
42
43 typedef struct BlkMigDevState {
44 BlockDriverState *bs;
45 int bulk_completed;
46 int shared_base;
47 int64_t cur_sector;
48 int64_t cur_dirty;
49 int64_t completed_sectors;
50 int64_t total_sectors;
51 int64_t dirty;
52 QSIMPLEQ_ENTRY(BlkMigDevState) entry;
53 unsigned long *aio_bitmap;
54 } BlkMigDevState;
55
56 typedef struct BlkMigBlock {
57 uint8_t *buf;
58 BlkMigDevState *bmds;
59 int64_t sector;
60 int nr_sectors;
61 struct iovec iov;
62 QEMUIOVector qiov;
63 BlockDriverAIOCB *aiocb;
64 int ret;
65 int64_t time;
66 QSIMPLEQ_ENTRY(BlkMigBlock) entry;
67 } BlkMigBlock;
68
69 typedef struct BlkMigState {
70 int blk_enable;
71 int shared_base;
72 QSIMPLEQ_HEAD(bmds_list, BlkMigDevState) bmds_list;
73 QSIMPLEQ_HEAD(blk_list, BlkMigBlock) blk_list;
74 int submitted;
75 int read_done;
76 int transferred;
77 int64_t total_sector_sum;
78 int prev_progress;
79 int bulk_completed;
80 long double total_time;
81 int reads;
82 } BlkMigState;
83
84 static BlkMigState block_mig_state;
85
86 static void blk_send(QEMUFile *f, BlkMigBlock * blk)
87 {
88 int len;
89
90 /* sector number and flags */
91 qemu_put_be64(f, (blk->sector << BDRV_SECTOR_BITS)
92 | BLK_MIG_FLAG_DEVICE_BLOCK);
93
94 /* device name */
95 len = strlen(blk->bmds->bs->device_name);
96 qemu_put_byte(f, len);
97 qemu_put_buffer(f, (uint8_t *)blk->bmds->bs->device_name, len);
98
99 qemu_put_buffer(f, blk->buf, BLOCK_SIZE);
100 }
101
102 int blk_mig_active(void)
103 {
104 return !QSIMPLEQ_EMPTY(&block_mig_state.bmds_list);
105 }
106
107 uint64_t blk_mig_bytes_transferred(void)
108 {
109 BlkMigDevState *bmds;
110 uint64_t sum = 0;
111
112 QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
113 sum += bmds->completed_sectors;
114 }
115 return sum << BDRV_SECTOR_BITS;
116 }
117
118 uint64_t blk_mig_bytes_remaining(void)
119 {
120 return blk_mig_bytes_total() - blk_mig_bytes_transferred();
121 }
122
123 uint64_t blk_mig_bytes_total(void)
124 {
125 BlkMigDevState *bmds;
126 uint64_t sum = 0;
127
128 QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
129 sum += bmds->total_sectors;
130 }
131 return sum << BDRV_SECTOR_BITS;
132 }
133
134 static inline void add_avg_read_time(int64_t time)
135 {
136 block_mig_state.reads++;
137 block_mig_state.total_time += time;
138 }
139
140 static inline long double compute_read_bwidth(void)
141 {
142 assert(block_mig_state.total_time != 0);
143 return (block_mig_state.reads * BLOCK_SIZE)/ block_mig_state.total_time;
144 }
145
146 static int bmds_aio_inflight(BlkMigDevState *bmds, int64_t sector)
147 {
148 int64_t chunk = sector / (int64_t)BDRV_SECTORS_PER_DIRTY_CHUNK;
149
150 if ((sector << BDRV_SECTOR_BITS) < bdrv_getlength(bmds->bs)) {
151 return !!(bmds->aio_bitmap[chunk / (sizeof(unsigned long) * 8)] &
152 (1UL << (chunk % (sizeof(unsigned long) * 8))));
153 } else {
154 return 0;
155 }
156 }
157
158 static void bmds_set_aio_inflight(BlkMigDevState *bmds, int64_t sector_num,
159 int nb_sectors, int set)
160 {
161 int64_t start, end;
162 unsigned long val, idx, bit;
163
164 start = sector_num / BDRV_SECTORS_PER_DIRTY_CHUNK;
165 end = (sector_num + nb_sectors - 1) / BDRV_SECTORS_PER_DIRTY_CHUNK;
166
167 for (; start <= end; start++) {
168 idx = start / (sizeof(unsigned long) * 8);
169 bit = start % (sizeof(unsigned long) * 8);
170 val = bmds->aio_bitmap[idx];
171 if (set) {
172 val |= 1UL << bit;
173 } else {
174 val &= ~(1UL << bit);
175 }
176 bmds->aio_bitmap[idx] = val;
177 }
178 }
179
180 static void alloc_aio_bitmap(BlkMigDevState *bmds)
181 {
182 BlockDriverState *bs = bmds->bs;
183 int64_t bitmap_size;
184
185 bitmap_size = (bdrv_getlength(bs) >> BDRV_SECTOR_BITS) +
186 BDRV_SECTORS_PER_DIRTY_CHUNK * 8 - 1;
187 bitmap_size /= BDRV_SECTORS_PER_DIRTY_CHUNK * 8;
188
189 bmds->aio_bitmap = qemu_mallocz(bitmap_size);
190 }
191
192 static void blk_mig_read_cb(void *opaque, int ret)
193 {
194 BlkMigBlock *blk = opaque;
195
196 blk->ret = ret;
197
198 blk->time = qemu_get_clock_ns(rt_clock) - blk->time;
199
200 add_avg_read_time(blk->time);
201
202 QSIMPLEQ_INSERT_TAIL(&block_mig_state.blk_list, blk, entry);
203 bmds_set_aio_inflight(blk->bmds, blk->sector, blk->nr_sectors, 0);
204
205 block_mig_state.submitted--;
206 block_mig_state.read_done++;
207 assert(block_mig_state.submitted >= 0);
208 }
209
210 static int mig_save_device_bulk(Monitor *mon, QEMUFile *f,
211 BlkMigDevState *bmds)
212 {
213 int64_t total_sectors = bmds->total_sectors;
214 int64_t cur_sector = bmds->cur_sector;
215 BlockDriverState *bs = bmds->bs;
216 BlkMigBlock *blk;
217 int nr_sectors;
218
219 if (bmds->shared_base) {
220 while (cur_sector < total_sectors &&
221 !bdrv_is_allocated(bs, cur_sector, MAX_IS_ALLOCATED_SEARCH,
222 &nr_sectors)) {
223 cur_sector += nr_sectors;
224 }
225 }
226
227 if (cur_sector >= total_sectors) {
228 bmds->cur_sector = bmds->completed_sectors = total_sectors;
229 return 1;
230 }
231
232 bmds->completed_sectors = cur_sector;
233
234 cur_sector &= ~((int64_t)BDRV_SECTORS_PER_DIRTY_CHUNK - 1);
235
236 /* we are going to transfer a full block even if it is not allocated */
237 nr_sectors = BDRV_SECTORS_PER_DIRTY_CHUNK;
238
239 if (total_sectors - cur_sector < BDRV_SECTORS_PER_DIRTY_CHUNK) {
240 nr_sectors = total_sectors - cur_sector;
241 }
242
243 blk = qemu_malloc(sizeof(BlkMigBlock));
244 blk->buf = qemu_malloc(BLOCK_SIZE);
245 blk->bmds = bmds;
246 blk->sector = cur_sector;
247 blk->nr_sectors = nr_sectors;
248
249 blk->iov.iov_base = blk->buf;
250 blk->iov.iov_len = nr_sectors * BDRV_SECTOR_SIZE;
251 qemu_iovec_init_external(&blk->qiov, &blk->iov, 1);
252
253 blk->time = qemu_get_clock_ns(rt_clock);
254
255 blk->aiocb = bdrv_aio_readv(bs, cur_sector, &blk->qiov,
256 nr_sectors, blk_mig_read_cb, blk);
257 if (!blk->aiocb) {
258 goto error;
259 }
260 block_mig_state.submitted++;
261
262 bdrv_reset_dirty(bs, cur_sector, nr_sectors);
263 bmds->cur_sector = cur_sector + nr_sectors;
264
265 return (bmds->cur_sector >= total_sectors);
266
267 error:
268 monitor_printf(mon, "Error reading sector %" PRId64 "\n", cur_sector);
269 qemu_file_set_error(f);
270 qemu_free(blk->buf);
271 qemu_free(blk);
272 return 0;
273 }
274
275 static void set_dirty_tracking(int enable)
276 {
277 BlkMigDevState *bmds;
278
279 QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
280 bdrv_set_dirty_tracking(bmds->bs, enable);
281 }
282 }
283
284 static void init_blk_migration_it(void *opaque, BlockDriverState *bs)
285 {
286 Monitor *mon = opaque;
287 BlkMigDevState *bmds;
288 int64_t sectors;
289
290 if (!bdrv_is_read_only(bs)) {
291 sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
292 if (sectors <= 0) {
293 return;
294 }
295
296 bmds = qemu_mallocz(sizeof(BlkMigDevState));
297 bmds->bs = bs;
298 bmds->bulk_completed = 0;
299 bmds->total_sectors = sectors;
300 bmds->completed_sectors = 0;
301 bmds->shared_base = block_mig_state.shared_base;
302 alloc_aio_bitmap(bmds);
303 drive_get_ref(drive_get_by_blockdev(bs));
304
305 block_mig_state.total_sector_sum += sectors;
306
307 if (bmds->shared_base) {
308 monitor_printf(mon, "Start migration for %s with shared base "
309 "image\n",
310 bs->device_name);
311 } else {
312 monitor_printf(mon, "Start full migration for %s\n",
313 bs->device_name);
314 }
315
316 QSIMPLEQ_INSERT_TAIL(&block_mig_state.bmds_list, bmds, entry);
317 }
318 }
319
320 static void init_blk_migration(Monitor *mon, QEMUFile *f)
321 {
322 block_mig_state.submitted = 0;
323 block_mig_state.read_done = 0;
324 block_mig_state.transferred = 0;
325 block_mig_state.total_sector_sum = 0;
326 block_mig_state.prev_progress = -1;
327 block_mig_state.bulk_completed = 0;
328 block_mig_state.total_time = 0;
329 block_mig_state.reads = 0;
330
331 bdrv_iterate(init_blk_migration_it, mon);
332 }
333
334 static int blk_mig_save_bulked_block(Monitor *mon, QEMUFile *f)
335 {
336 int64_t completed_sector_sum = 0;
337 BlkMigDevState *bmds;
338 int progress;
339 int ret = 0;
340
341 QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
342 if (bmds->bulk_completed == 0) {
343 if (mig_save_device_bulk(mon, f, bmds) == 1) {
344 /* completed bulk section for this device */
345 bmds->bulk_completed = 1;
346 }
347 completed_sector_sum += bmds->completed_sectors;
348 ret = 1;
349 break;
350 } else {
351 completed_sector_sum += bmds->completed_sectors;
352 }
353 }
354
355 if (block_mig_state.total_sector_sum != 0) {
356 progress = completed_sector_sum * 100 /
357 block_mig_state.total_sector_sum;
358 } else {
359 progress = 100;
360 }
361 if (progress != block_mig_state.prev_progress) {
362 block_mig_state.prev_progress = progress;
363 qemu_put_be64(f, (progress << BDRV_SECTOR_BITS)
364 | BLK_MIG_FLAG_PROGRESS);
365 monitor_printf(mon, "Completed %d %%\r", progress);
366 monitor_flush(mon);
367 }
368
369 return ret;
370 }
371
372 static void blk_mig_reset_dirty_cursor(void)
373 {
374 BlkMigDevState *bmds;
375
376 QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
377 bmds->cur_dirty = 0;
378 }
379 }
380
381 static int mig_save_device_dirty(Monitor *mon, QEMUFile *f,
382 BlkMigDevState *bmds, int is_async)
383 {
384 BlkMigBlock *blk;
385 int64_t total_sectors = bmds->total_sectors;
386 int64_t sector;
387 int nr_sectors;
388
389 for (sector = bmds->cur_dirty; sector < bmds->total_sectors;) {
390 if (bmds_aio_inflight(bmds, sector)) {
391 qemu_aio_flush();
392 }
393 if (bdrv_get_dirty(bmds->bs, sector)) {
394
395 if (total_sectors - sector < BDRV_SECTORS_PER_DIRTY_CHUNK) {
396 nr_sectors = total_sectors - sector;
397 } else {
398 nr_sectors = BDRV_SECTORS_PER_DIRTY_CHUNK;
399 }
400 blk = qemu_malloc(sizeof(BlkMigBlock));
401 blk->buf = qemu_malloc(BLOCK_SIZE);
402 blk->bmds = bmds;
403 blk->sector = sector;
404 blk->nr_sectors = nr_sectors;
405
406 if (is_async) {
407 blk->iov.iov_base = blk->buf;
408 blk->iov.iov_len = nr_sectors * BDRV_SECTOR_SIZE;
409 qemu_iovec_init_external(&blk->qiov, &blk->iov, 1);
410
411 blk->time = qemu_get_clock_ns(rt_clock);
412
413 blk->aiocb = bdrv_aio_readv(bmds->bs, sector, &blk->qiov,
414 nr_sectors, blk_mig_read_cb, blk);
415 if (!blk->aiocb) {
416 goto error;
417 }
418 block_mig_state.submitted++;
419 bmds_set_aio_inflight(bmds, sector, nr_sectors, 1);
420 } else {
421 if (bdrv_read(bmds->bs, sector, blk->buf,
422 nr_sectors) < 0) {
423 goto error;
424 }
425 blk_send(f, blk);
426
427 qemu_free(blk->buf);
428 qemu_free(blk);
429 }
430
431 bdrv_reset_dirty(bmds->bs, sector, nr_sectors);
432 break;
433 }
434 sector += BDRV_SECTORS_PER_DIRTY_CHUNK;
435 bmds->cur_dirty = sector;
436 }
437
438 return (bmds->cur_dirty >= bmds->total_sectors);
439
440 error:
441 monitor_printf(mon, "Error reading sector %" PRId64 "\n", sector);
442 qemu_file_set_error(f);
443 qemu_free(blk->buf);
444 qemu_free(blk);
445 return 0;
446 }
447
448 static int blk_mig_save_dirty_block(Monitor *mon, QEMUFile *f, int is_async)
449 {
450 BlkMigDevState *bmds;
451 int ret = 0;
452
453 QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
454 if (mig_save_device_dirty(mon, f, bmds, is_async) == 0) {
455 ret = 1;
456 break;
457 }
458 }
459
460 return ret;
461 }
462
463 static void flush_blks(QEMUFile* f)
464 {
465 BlkMigBlock *blk;
466
467 DPRINTF("%s Enter submitted %d read_done %d transferred %d\n",
468 __FUNCTION__, block_mig_state.submitted, block_mig_state.read_done,
469 block_mig_state.transferred);
470
471 while ((blk = QSIMPLEQ_FIRST(&block_mig_state.blk_list)) != NULL) {
472 if (qemu_file_rate_limit(f)) {
473 break;
474 }
475 if (blk->ret < 0) {
476 qemu_file_set_error(f);
477 break;
478 }
479 blk_send(f, blk);
480
481 QSIMPLEQ_REMOVE_HEAD(&block_mig_state.blk_list, entry);
482 qemu_free(blk->buf);
483 qemu_free(blk);
484
485 block_mig_state.read_done--;
486 block_mig_state.transferred++;
487 assert(block_mig_state.read_done >= 0);
488 }
489
490 DPRINTF("%s Exit submitted %d read_done %d transferred %d\n", __FUNCTION__,
491 block_mig_state.submitted, block_mig_state.read_done,
492 block_mig_state.transferred);
493 }
494
495 static int64_t get_remaining_dirty(void)
496 {
497 BlkMigDevState *bmds;
498 int64_t dirty = 0;
499
500 QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
501 dirty += bdrv_get_dirty_count(bmds->bs);
502 }
503
504 return dirty * BLOCK_SIZE;
505 }
506
507 static int is_stage2_completed(void)
508 {
509 int64_t remaining_dirty;
510 long double bwidth;
511
512 if (block_mig_state.bulk_completed == 1) {
513
514 remaining_dirty = get_remaining_dirty();
515 if (remaining_dirty == 0) {
516 return 1;
517 }
518
519 bwidth = compute_read_bwidth();
520
521 if ((remaining_dirty / bwidth) <=
522 migrate_max_downtime()) {
523 /* finish stage2 because we think that we can finish remaing work
524 below max_downtime */
525
526 return 1;
527 }
528 }
529
530 return 0;
531 }
532
533 static void blk_mig_cleanup(Monitor *mon)
534 {
535 BlkMigDevState *bmds;
536 BlkMigBlock *blk;
537
538 set_dirty_tracking(0);
539
540 while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) {
541 QSIMPLEQ_REMOVE_HEAD(&block_mig_state.bmds_list, entry);
542 drive_put_ref(drive_get_by_blockdev(bmds->bs));
543 qemu_free(bmds->aio_bitmap);
544 qemu_free(bmds);
545 }
546
547 while ((blk = QSIMPLEQ_FIRST(&block_mig_state.blk_list)) != NULL) {
548 QSIMPLEQ_REMOVE_HEAD(&block_mig_state.blk_list, entry);
549 qemu_free(blk->buf);
550 qemu_free(blk);
551 }
552
553 monitor_printf(mon, "\n");
554 }
555
556 static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
557 {
558 DPRINTF("Enter save live stage %d submitted %d transferred %d\n",
559 stage, block_mig_state.submitted, block_mig_state.transferred);
560
561 if (stage < 0) {
562 blk_mig_cleanup(mon);
563 return 0;
564 }
565
566 if (block_mig_state.blk_enable != 1) {
567 /* no need to migrate storage */
568 qemu_put_be64(f, BLK_MIG_FLAG_EOS);
569 return 1;
570 }
571
572 if (stage == 1) {
573 init_blk_migration(mon, f);
574
575 /* start track dirty blocks */
576 set_dirty_tracking(1);
577 }
578
579 flush_blks(f);
580
581 if (qemu_file_has_error(f)) {
582 blk_mig_cleanup(mon);
583 return 0;
584 }
585
586 blk_mig_reset_dirty_cursor();
587
588 if (stage == 2) {
589 /* control the rate of transfer */
590 while ((block_mig_state.submitted +
591 block_mig_state.read_done) * BLOCK_SIZE <
592 qemu_file_get_rate_limit(f)) {
593 if (block_mig_state.bulk_completed == 0) {
594 /* first finish the bulk phase */
595 if (blk_mig_save_bulked_block(mon, f) == 0) {
596 /* finished saving bulk on all devices */
597 block_mig_state.bulk_completed = 1;
598 }
599 } else {
600 if (blk_mig_save_dirty_block(mon, f, 1) == 0) {
601 /* no more dirty blocks */
602 break;
603 }
604 }
605 }
606
607 flush_blks(f);
608
609 if (qemu_file_has_error(f)) {
610 blk_mig_cleanup(mon);
611 return 0;
612 }
613 }
614
615 if (stage == 3) {
616 /* we know for sure that save bulk is completed and
617 all async read completed */
618 assert(block_mig_state.submitted == 0);
619
620 while (blk_mig_save_dirty_block(mon, f, 0) != 0);
621 blk_mig_cleanup(mon);
622
623 /* report completion */
624 qemu_put_be64(f, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS);
625
626 if (qemu_file_has_error(f)) {
627 return 0;
628 }
629
630 monitor_printf(mon, "Block migration completed\n");
631 }
632
633 qemu_put_be64(f, BLK_MIG_FLAG_EOS);
634
635 return ((stage == 2) && is_stage2_completed());
636 }
637
638 static int block_load(QEMUFile *f, void *opaque, int version_id)
639 {
640 static int banner_printed;
641 int len, flags;
642 char device_name[256];
643 int64_t addr;
644 BlockDriverState *bs, *bs_prev = NULL;
645 uint8_t *buf;
646 int64_t total_sectors = 0;
647 int nr_sectors;
648
649 do {
650 addr = qemu_get_be64(f);
651
652 flags = addr & ~BDRV_SECTOR_MASK;
653 addr >>= BDRV_SECTOR_BITS;
654
655 if (flags & BLK_MIG_FLAG_DEVICE_BLOCK) {
656 int ret;
657 /* get device name */
658 len = qemu_get_byte(f);
659 qemu_get_buffer(f, (uint8_t *)device_name, len);
660 device_name[len] = '\0';
661
662 bs = bdrv_find(device_name);
663 if (!bs) {
664 fprintf(stderr, "Error unknown block device %s\n",
665 device_name);
666 return -EINVAL;
667 }
668
669 if (bs != bs_prev) {
670 bs_prev = bs;
671 total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
672 if (total_sectors <= 0) {
673 error_report("Error getting length of block device %s\n",
674 device_name);
675 return -EINVAL;
676 }
677 }
678
679 if (total_sectors - addr < BDRV_SECTORS_PER_DIRTY_CHUNK) {
680 nr_sectors = total_sectors - addr;
681 } else {
682 nr_sectors = BDRV_SECTORS_PER_DIRTY_CHUNK;
683 }
684
685 buf = qemu_malloc(BLOCK_SIZE);
686
687 qemu_get_buffer(f, buf, BLOCK_SIZE);
688 ret = bdrv_write(bs, addr, buf, nr_sectors);
689
690 qemu_free(buf);
691 if (ret < 0) {
692 return ret;
693 }
694 } else if (flags & BLK_MIG_FLAG_PROGRESS) {
695 if (!banner_printed) {
696 printf("Receiving block device images\n");
697 banner_printed = 1;
698 }
699 printf("Completed %d %%%c", (int)addr,
700 (addr == 100) ? '\n' : '\r');
701 fflush(stdout);
702 } else if (!(flags & BLK_MIG_FLAG_EOS)) {
703 fprintf(stderr, "Unknown flags\n");
704 return -EINVAL;
705 }
706 if (qemu_file_has_error(f)) {
707 return -EIO;
708 }
709 } while (!(flags & BLK_MIG_FLAG_EOS));
710
711 return 0;
712 }
713
714 static void block_set_params(int blk_enable, int shared_base, void *opaque)
715 {
716 block_mig_state.blk_enable = blk_enable;
717 block_mig_state.shared_base = shared_base;
718
719 /* shared base means that blk_enable = 1 */
720 block_mig_state.blk_enable |= shared_base;
721 }
722
723 void blk_mig_init(void)
724 {
725 QSIMPLEQ_INIT(&block_mig_state.bmds_list);
726 QSIMPLEQ_INIT(&block_mig_state.blk_list);
727
728 register_savevm_live(NULL, "block", 0, 1, block_set_params,
729 block_save_live, NULL, block_load, &block_mig_state);
730 }