blockdev.c (3ddf3efefa364505ee44582873612dd8f6abb838) | blockdev.c (71aa98678c2b5616de5453d55e12f8ea810fbefb) |
---|---|
1/* 2 * QEMU host block devices 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * 6 * This work is licensed under the terms of the GNU GPL, version 2 or 7 * later. See the COPYING file in the top-level directory. 8 * --- 3408 unchanged lines hidden (view full) --- 3417 has_on_source_error, on_source_error, 3418 has_on_target_error, on_target_error, 3419 NULL, errp); 3420} 3421 3422/* Parameter check and block job starting for drive mirroring. 3423 * Caller should hold @device and @target's aio context (must be the same). 3424 **/ | 1/* 2 * QEMU host block devices 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * 6 * This work is licensed under the terms of the GNU GPL, version 2 or 7 * later. See the COPYING file in the top-level directory. 8 * --- 3408 unchanged lines hidden (view full) --- 3417 has_on_source_error, on_source_error, 3418 has_on_target_error, on_target_error, 3419 NULL, errp); 3420} 3421 3422/* Parameter check and block job starting for drive mirroring. 3423 * Caller should hold @device and @target's aio context (must be the same). 3424 **/ |
3425static void blockdev_mirror_common(BlockDriverState *bs, | 3425static void blockdev_mirror_common(const char *job_id, BlockDriverState *bs, |
3426 BlockDriverState *target, 3427 bool has_replaces, const char *replaces, 3428 enum MirrorSyncMode sync, 3429 BlockMirrorBackingMode backing_mode, 3430 bool has_speed, int64_t speed, 3431 bool has_granularity, uint32_t granularity, 3432 bool has_buf_size, int64_t buf_size, 3433 bool has_on_source_error, --- 43 unchanged lines hidden (view full) --- 3477 3478 if (!bs->backing && sync == MIRROR_SYNC_MODE_TOP) { 3479 sync = MIRROR_SYNC_MODE_FULL; 3480 } 3481 3482 /* pass the node name to replace to mirror start since it's loose coupling 3483 * and will allow to check whether the node still exist at mirror completion 3484 */ | 3426 BlockDriverState *target, 3427 bool has_replaces, const char *replaces, 3428 enum MirrorSyncMode sync, 3429 BlockMirrorBackingMode backing_mode, 3430 bool has_speed, int64_t speed, 3431 bool has_granularity, uint32_t granularity, 3432 bool has_buf_size, int64_t buf_size, 3433 bool has_on_source_error, --- 43 unchanged lines hidden (view full) --- 3477 3478 if (!bs->backing && sync == MIRROR_SYNC_MODE_TOP) { 3479 sync = MIRROR_SYNC_MODE_FULL; 3480 } 3481 3482 /* pass the node name to replace to mirror start since it's loose coupling 3483 * and will allow to check whether the node still exist at mirror completion 3484 */ |
3485 mirror_start(bs, target, | 3485 mirror_start(job_id, bs, target, |
3486 has_replaces ? replaces : NULL, 3487 speed, granularity, buf_size, sync, backing_mode, 3488 on_source_error, on_target_error, unmap, 3489 block_job_cb, bs, errp); 3490} 3491 | 3486 has_replaces ? replaces : NULL, 3487 speed, granularity, buf_size, sync, backing_mode, 3488 on_source_error, on_target_error, unmap, 3489 block_job_cb, bs, errp); 3490} 3491 |
3492void qmp_drive_mirror(const char *device, const char *target, 3493 bool has_format, const char *format, | 3492void qmp_drive_mirror(bool has_job_id, const char *job_id, const char *device, 3493 const char *target, bool has_format, const char *format, |
3494 bool has_node_name, const char *node_name, 3495 bool has_replaces, const char *replaces, 3496 enum MirrorSyncMode sync, 3497 bool has_mode, enum NewImageMode mode, 3498 bool has_speed, int64_t speed, 3499 bool has_granularity, uint32_t granularity, 3500 bool has_buf_size, int64_t buf_size, 3501 bool has_on_source_error, BlockdevOnError on_source_error, --- 127 unchanged lines hidden (view full) --- 3629 target_bs = bdrv_open(target, NULL, options, flags | BDRV_O_NO_BACKING, 3630 errp); 3631 if (!target_bs) { 3632 goto out; 3633 } 3634 3635 bdrv_set_aio_context(target_bs, aio_context); 3636 | 3494 bool has_node_name, const char *node_name, 3495 bool has_replaces, const char *replaces, 3496 enum MirrorSyncMode sync, 3497 bool has_mode, enum NewImageMode mode, 3498 bool has_speed, int64_t speed, 3499 bool has_granularity, uint32_t granularity, 3500 bool has_buf_size, int64_t buf_size, 3501 bool has_on_source_error, BlockdevOnError on_source_error, --- 127 unchanged lines hidden (view full) --- 3629 target_bs = bdrv_open(target, NULL, options, flags | BDRV_O_NO_BACKING, 3630 errp); 3631 if (!target_bs) { 3632 goto out; 3633 } 3634 3635 bdrv_set_aio_context(target_bs, aio_context); 3636 |
3637 blockdev_mirror_common(bs, target_bs, | 3637 blockdev_mirror_common(has_job_id ? job_id : NULL, bs, target_bs, |
3638 has_replaces, replaces, sync, backing_mode, 3639 has_speed, speed, 3640 has_granularity, granularity, 3641 has_buf_size, buf_size, 3642 has_on_source_error, on_source_error, 3643 has_on_target_error, on_target_error, 3644 has_unmap, unmap, 3645 &local_err); 3646 bdrv_unref(target_bs); 3647 error_propagate(errp, local_err); 3648out: 3649 aio_context_release(aio_context); 3650} 3651 | 3638 has_replaces, replaces, sync, backing_mode, 3639 has_speed, speed, 3640 has_granularity, granularity, 3641 has_buf_size, buf_size, 3642 has_on_source_error, on_source_error, 3643 has_on_target_error, on_target_error, 3644 has_unmap, unmap, 3645 &local_err); 3646 bdrv_unref(target_bs); 3647 error_propagate(errp, local_err); 3648out: 3649 aio_context_release(aio_context); 3650} 3651 |
3652void qmp_blockdev_mirror(const char *device, const char *target, | 3652void qmp_blockdev_mirror(bool has_job_id, const char *job_id, 3653 const char *device, const char *target, |
3653 bool has_replaces, const char *replaces, 3654 MirrorSyncMode sync, 3655 bool has_speed, int64_t speed, 3656 bool has_granularity, uint32_t granularity, 3657 bool has_buf_size, int64_t buf_size, 3658 bool has_on_source_error, 3659 BlockdevOnError on_source_error, 3660 bool has_on_target_error, --- 24 unchanged lines hidden (view full) --- 3685 return; 3686 } 3687 3688 aio_context = bdrv_get_aio_context(bs); 3689 aio_context_acquire(aio_context); 3690 3691 bdrv_set_aio_context(target_bs, aio_context); 3692 | 3654 bool has_replaces, const char *replaces, 3655 MirrorSyncMode sync, 3656 bool has_speed, int64_t speed, 3657 bool has_granularity, uint32_t granularity, 3658 bool has_buf_size, int64_t buf_size, 3659 bool has_on_source_error, 3660 BlockdevOnError on_source_error, 3661 bool has_on_target_error, --- 24 unchanged lines hidden (view full) --- 3686 return; 3687 } 3688 3689 aio_context = bdrv_get_aio_context(bs); 3690 aio_context_acquire(aio_context); 3691 3692 bdrv_set_aio_context(target_bs, aio_context); 3693 |
3693 blockdev_mirror_common(bs, target_bs, | 3694 blockdev_mirror_common(has_job_id ? job_id : NULL, bs, target_bs, |
3694 has_replaces, replaces, sync, backing_mode, 3695 has_speed, speed, 3696 has_granularity, granularity, 3697 has_buf_size, buf_size, 3698 has_on_source_error, on_source_error, 3699 has_on_target_error, on_target_error, 3700 true, true, 3701 &local_err); --- 643 unchanged lines hidden --- | 3695 has_replaces, replaces, sync, backing_mode, 3696 has_speed, speed, 3697 has_granularity, granularity, 3698 has_buf_size, buf_size, 3699 has_on_source_error, on_source_error, 3700 has_on_target_error, on_target_error, 3701 true, true, 3702 &local_err); --- 643 unchanged lines hidden --- |