mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
blockdev-backup: Add error handling option for copy-before-write jobs
This patch extends the blockdev-backup QMP command to allow users to specify how to behave when IO errors occur during copy-before-write operations. Previously, the behavior was fixed and could not be controlled by the user. The new 'on-cbw-error' option can be set to one of two values: - 'break-guest-write': Forwards the IO error to the guest and triggers the on-source-error policy. This preserves snapshot integrity at the expense of guest IO operations. - 'break-snapshot': Allows the guest OS to continue running normally, but invalidates the snapshot and aborts related jobs. This prioritizes guest operation over backup consistency. This enhancement provides more flexibility for backup operations in different environments where requirements for guest availability versus backup consistency may vary. The default behavior remains unchanged to maintain backward compatibility. Signed-off-by: Raman Dzehtsiar <Raman.Dzehtsiar@gmail.com> Message-ID: <20250414090025.828660-1-Raman.Dzehtsiar@gmail.com> Acked-by: Markus Armbruster <armbru@redhat.com> [vsementsov: fix long lines] Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Tested-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
This commit is contained in:
parent
b836bf2ab6
commit
3d3911f16b
9 changed files with 117 additions and 4 deletions
|
@ -2641,6 +2641,7 @@ static BlockJob *do_backup_common(BackupCommon *backup,
|
|||
BdrvDirtyBitmap *bmap = NULL;
|
||||
BackupPerf perf = { .max_workers = 64 };
|
||||
int job_flags = JOB_DEFAULT;
|
||||
OnCbwError on_cbw_error = ON_CBW_ERROR_BREAK_GUEST_WRITE;
|
||||
|
||||
if (!backup->has_speed) {
|
||||
backup->speed = 0;
|
||||
|
@ -2745,6 +2746,10 @@ static BlockJob *do_backup_common(BackupCommon *backup,
|
|||
job_flags |= JOB_MANUAL_DISMISS;
|
||||
}
|
||||
|
||||
if (backup->has_on_cbw_error) {
|
||||
on_cbw_error = backup->on_cbw_error;
|
||||
}
|
||||
|
||||
job = backup_job_create(backup->job_id, bs, target_bs, backup->speed,
|
||||
backup->sync, bmap, backup->bitmap_mode,
|
||||
backup->compress, backup->discard_source,
|
||||
|
@ -2752,6 +2757,7 @@ static BlockJob *do_backup_common(BackupCommon *backup,
|
|||
&perf,
|
||||
backup->on_source_error,
|
||||
backup->on_target_error,
|
||||
on_cbw_error,
|
||||
job_flags, NULL, NULL, txn, errp);
|
||||
return job;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue