On Mon, Mar 03, 2025 at 02:35:10PM +0100, Raman Dzehtsiar wrote: > 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.dzehts...@gmail.com> > ---
> +++ b/blockdev.c > @@ -2752,6 +2752,7 @@ static BlockJob *do_backup_common(BackupCommon *backup, > &perf, > backup->on_source_error, > backup->on_target_error, > + backup->has_on_cbw_error ? backup->on_cbw_error > : ON_CBW_ERROR_BREAK_GUEST_WRITE, Is there a way to avoid this long line, perhaps by using assignment into a temporary variable prior to the function call? > job_flags, NULL, NULL, txn, errp); > return job; > } > +++ b/qapi/block-core.json > @@ -1622,6 +1622,9 @@ > # @discard-source: Discard blocks on source which have already been > # copied to the target. (Since 9.1) > # > +# @on-cbw-error: optional policy defining behavior on I/O errors in > +# copy-before-write jobs; defaults to break-guest-write. (Since 9.3) The next release is 10.0, not 9.3. > +# > # @x-perf: Performance options. (Since 6.0) > # > # Features: > @@ -1641,6 +1644,7 @@ > '*compress': 'bool', > '*on-source-error': 'BlockdevOnError', > '*on-target-error': 'BlockdevOnError', > + '*on-cbw-error': 'OnCbwError', > '*auto-finalize': 'bool', '*auto-dismiss': 'bool', > '*filter-node-name': 'str', > '*discard-source': 'bool', > -- > 2.43.0 > -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org