[PATCH 0/9] qemu: Fix few bugs in snapshot/save code (background snapshot saga part 1)

Peter Krempa via Devel posted 9 patches 3 days, 2 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1765272832.git.pkrempa@redhat.com
include/libvirt/libvirt-domain.h | 87 ++++++++++++++++++++++++++++++--
src/qemu/qemu_conf.c             | 48 ++++++++++++------
src/qemu/qemu_conf.h             |  7 +--
src/qemu/qemu_driver.c           | 29 +++++++----
src/qemu/qemu_migration.c        | 14 ++---
src/qemu/qemu_migration.h        |  2 +-
src/qemu/qemu_migration_params.c |  4 +-
src/qemu/qemu_migration_params.h |  2 +-
src/qemu/qemu_saveimage.c        | 22 ++++----
src/qemu/qemu_saveimage.h        | 24 ++-------
src/qemu/qemu_saveimage_format.h | 25 +++++++++
src/qemu/qemu_snapshot.c         | 14 +++--
tools/virsh-domain.c             | 21 ++++++++
13 files changed, 224 insertions(+), 75 deletions(-)
create mode 100644 src/qemu/qemu_saveimage_format.h
[PATCH 0/9] qemu: Fix few bugs in snapshot/save code (background snapshot saga part 1)
Posted by Peter Krempa via Devel 3 days, 2 hours ago
While looking trhough the snapshot code I've noticed a few bugs:

 - memleak in cleanup code of migration to file (1/9)
 - wrong place where 'manual' external disk snapshot is taken (2/9)
 - bad interaction between 'manual' snapshot and the _QUIESCE flag (3/9)
 - constants for save image types not exposed (6/9)
 - use of wrong 'flags' in migration to file code (8/9)

The series contains also few cleanups and improvements:
 - bash completion for save image type (7/9)
 - use of proper types for save image type (4,5/9)
 - avoid problems with 'flags' in qemuMigrationParamsForSave (9/9)

Part 2 will focus on some code cleanups.

Peter Krempa (9):
  qemuMigrationSrcToFile: Don't leak 'qemuFDPass' in cleanup path
  qemu: snapshot: Setup disks for manual snapshot only when the VM is
    actually paused
  qemuSnapshotPrepare: Prohibit 'manual' disk snapshot mode with
    VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE flag
  qemu: Use 'virQEMUSaveFormat' type everywhere except qemu_conf
  qemu: conf: Use proper type for (save|dump|snapshot)ImageFormat
  include: Create constants for save image format values
  virsh: Add completer for '--image-format' option of 'save' command
  qemuMigrationSrcToFile: Don't cross-contaminate 'flags' variable
  qemuMigrationParamsForSave: Don't take opaque 'flags'

 include/libvirt/libvirt-domain.h | 87 ++++++++++++++++++++++++++++++--
 src/qemu/qemu_conf.c             | 48 ++++++++++++------
 src/qemu/qemu_conf.h             |  7 +--
 src/qemu/qemu_driver.c           | 29 +++++++----
 src/qemu/qemu_migration.c        | 14 ++---
 src/qemu/qemu_migration.h        |  2 +-
 src/qemu/qemu_migration_params.c |  4 +-
 src/qemu/qemu_migration_params.h |  2 +-
 src/qemu/qemu_saveimage.c        | 22 ++++----
 src/qemu/qemu_saveimage.h        | 24 ++-------
 src/qemu/qemu_saveimage_format.h | 25 +++++++++
 src/qemu/qemu_snapshot.c         | 14 +++--
 tools/virsh-domain.c             | 21 ++++++++
 13 files changed, 224 insertions(+), 75 deletions(-)
 create mode 100644 src/qemu/qemu_saveimage_format.h

-- 
2.52.0
Re: [PATCH 0/9] qemu: Fix few bugs in snapshot/save code (background snapshot saga part 1)
Posted by Michal Prívozník via Devel 2 days, 22 hours ago
On 12/9/25 10:46, Peter Krempa via Devel wrote:
> While looking trhough the snapshot code I've noticed a few bugs:
> 
>  - memleak in cleanup code of migration to file (1/9)
>  - wrong place where 'manual' external disk snapshot is taken (2/9)
>  - bad interaction between 'manual' snapshot and the _QUIESCE flag (3/9)
>  - constants for save image types not exposed (6/9)
>  - use of wrong 'flags' in migration to file code (8/9)
> 
> The series contains also few cleanups and improvements:
>  - bash completion for save image type (7/9)
>  - use of proper types for save image type (4,5/9)
>  - avoid problems with 'flags' in qemuMigrationParamsForSave (9/9)
> 
> Part 2 will focus on some code cleanups.
> 
> Peter Krempa (9):
>   qemuMigrationSrcToFile: Don't leak 'qemuFDPass' in cleanup path
>   qemu: snapshot: Setup disks for manual snapshot only when the VM is
>     actually paused
>   qemuSnapshotPrepare: Prohibit 'manual' disk snapshot mode with
>     VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE flag
>   qemu: Use 'virQEMUSaveFormat' type everywhere except qemu_conf
>   qemu: conf: Use proper type for (save|dump|snapshot)ImageFormat
>   include: Create constants for save image format values
>   virsh: Add completer for '--image-format' option of 'save' command
>   qemuMigrationSrcToFile: Don't cross-contaminate 'flags' variable
>   qemuMigrationParamsForSave: Don't take opaque 'flags'
> 
>  include/libvirt/libvirt-domain.h | 87 ++++++++++++++++++++++++++++++--
>  src/qemu/qemu_conf.c             | 48 ++++++++++++------
>  src/qemu/qemu_conf.h             |  7 +--
>  src/qemu/qemu_driver.c           | 29 +++++++----
>  src/qemu/qemu_migration.c        | 14 ++---
>  src/qemu/qemu_migration.h        |  2 +-
>  src/qemu/qemu_migration_params.c |  4 +-
>  src/qemu/qemu_migration_params.h |  2 +-
>  src/qemu/qemu_saveimage.c        | 22 ++++----
>  src/qemu/qemu_saveimage.h        | 24 ++-------
>  src/qemu/qemu_saveimage_format.h | 25 +++++++++
>  src/qemu/qemu_snapshot.c         | 14 +++--
>  tools/virsh-domain.c             | 21 ++++++++
>  13 files changed, 224 insertions(+), 75 deletions(-)
>  create mode 100644 src/qemu/qemu_saveimage_format.h
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal