Re: [PATCH Libvirt v2 00/10] Support dirty page rate upper limit

2023-08-14 Thread Yong Huang
Ping. On Mon, Aug 7, 2023 at 11:56 PM ~hyman wrote: > Hi, This is the latest version for the series, comparing with version > 1, there are some key modifications has made inspired and > suggested by Peter, see as follows: > 1. Introduce XML for dirty limit persistent configuration > 2. Merge

Does libvirt support intra-host migration?

2023-08-14 Thread Eric Wheeler
Hello all: I looked around for documentation on intra-host KVM migration but haven't found much. For example, this could be useful to "migrate" VM to run on an upgraded version of `qemu-kvm` without migrating to a different host and migrating back. We tested migrating a VM to the same host

[libvirt PATCH v3 13/25] qemu_snapshot: rename qemuSnapshotDeleteExternalPrepare

2023-08-14 Thread Pavel Hrdina
The new name reflects that we prepare data for external snapshot deletion and the old name will be used later for different part of code. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff

[libvirt PATCH v3 06/25] qemu_snapshot: introduce qemuSnapshotDomainDefUpdateDisk

2023-08-14 Thread Pavel Hrdina
Extract the code that updates disks in domain definition while creating external snapshots. We will use it later in the external snapshot revert code. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 63 1 file

[libvirt PATCH v3 08/25] qemu_snapshot: introduce qemuSnapshotCreateQcow2Files

2023-08-14 Thread Pavel Hrdina
Extract creation of qcow2 files for external snapshots to separate function as we will need it for external snapshot revert code. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 85 ++-- 1 file changed, 56 insertions(+), 29 deletions(-) diff --git

[libvirt PATCH v3 16/25] qemu_snapshot: prepare data for non-active leaf external snapshot deletion

2023-08-14 Thread Pavel Hrdina
In this case there is no need to run block commit and using qemu process at all. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 55 +++- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git

[libvirt PATCH v3 10/25] qemu_snapshot: move external disk prepare to single function

2023-08-14 Thread Pavel Hrdina
We will need to reuse the functionality when reverting external snapshots. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 38 +++--- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_snapshot.c

[libvirt PATCH v3 25/25] qemu_snapshot: allow snapshot revert for external snapshots

2023-08-14 Thread Pavel Hrdina
Now that the support to revert external snapshots is implemented we can drop this check. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index

[libvirt PATCH v3 22/25] qemu_snapshot: update backing store after deleting external snapshot

2023-08-14 Thread Pavel Hrdina
With introduction of external snapshot revert we will have to update backing store of qcow images not actively used be QEMU manually. The need for this patch comes from the fact that we stop and start QEMU process therefore after revert not all existing snapshots will be known to that QEMU process

[libvirt PATCH v3 11/25] qemu_snapshot: use VIR_ASYNC_JOB_SNAPSHOT when reverting snapshot

2023-08-14 Thread Pavel Hrdina
Both creating and deleting snapshot are using VIR_ASYNC_JOB_SNAPSHOT but reverting is using VIR_ASYNC_JOB_START. Let's unify it to make it consistent for all snapshot operations. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 19 ++- 1 file changed, 10 insertions(+),

[libvirt PATCH v3 21/25] qemuDomainGetImageIds: pass domain definition directly

2023-08-14 Thread Pavel Hrdina
We only need the domain definition from domain object. This will allow us to use it from snapshot code where we need to pass different domain definition. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_backup.c | 2 +- src/qemu/qemu_blockjob.c | 2 +- src/qemu/qemu_domain.c | 8

[libvirt PATCH v3 09/25] qemuSnapshotCreateQcow2Files: use domain definition directly

2023-08-14 Thread Pavel Hrdina
To create new overlay files when external snapshot revert support is introduced we will be using different domain definition than what is currently used by the domain. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 13 +++-- 1 file changed, 7

[libvirt PATCH v3 17/25] qemu_snapshot: add support to delete external snapshot without block commit

2023-08-14 Thread Pavel Hrdina
When block commit is not needed we can just simply unlink the disk files. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 56 ++-- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/src/qemu/qemu_snapshot.c

[libvirt PATCH v3 23/25] qemu_snapshot: check only once if snapshot is external

2023-08-14 Thread Pavel Hrdina
There will be more external snapshot checks introduced by following patch so group them together. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git

[libvirt PATCH v3 01/25] libvirt_private: list virDomainMomentDefPostParse

2023-08-14 Thread Pavel Hrdina
We will need to call this function from qemu_snapshot when introducing external snapshot revert support. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/libvirt_private.syms | 4 1 file changed, 4 insertions(+) diff --git a/src/libvirt_private.syms

[libvirt PATCH v3 12/25] qemu_snapshot: introduce external snapshot revert support

2023-08-14 Thread Pavel Hrdina
When reverting to external snapshot we need to create new overlay qcow2 files from the disk files the VM had when the snapshot was taken. There are some specifics and limitations when reverting to a snapshot: 1) When reverting to last snapshot we need to first create new overlay files before

[libvirt PATCH v3 20/25] virdomainmomentobjlist: introduce virDomainMomentIsAncestor

2023-08-14 Thread Pavel Hrdina
This new helper will allow us to check if we are able to delete external snapshot after user did revert to non-leaf snapshot. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/conf/virdomainmomentobjlist.c | 17 + src/conf/virdomainmomentobjlist.h | 4

[libvirt PATCH v3 02/25] snapshot_conf: export virDomainSnapshotDiskDefClear

2023-08-14 Thread Pavel Hrdina
We will need to call this function from qemu_snapshot when introducing external snapshot revert support. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/conf/snapshot_conf.c | 2 +- src/conf/snapshot_conf.h | 3 +++ src/libvirt_private.syms | 1 + 3 files changed, 5

[libvirt PATCH v3 19/25] qemu_snapshot: remove revertdisks when creating new snapshot

2023-08-14 Thread Pavel Hrdina
When user creates a new snapshot after reverting to non-leaf snapshot we no longer need to store the temporary overlays as they will be part of the VM XMLs stored in the newly created snapshot. Signed-off-by: Pavel Hrdina --- src/qemu/qemu_snapshot.c | 28 +++- 1 file

[libvirt PATCH v3 00/25] introduce external snapshot revert support

2023-08-14 Thread Pavel Hrdina
This implements virDomainRevertToSnapshot to work with external snapshots. In addition it modifies virDomainSnapshotDelete to work correctly when we revert to non-leaf snapshot or when there is non-linear snapshot tree with multiple branches. Gitlab repo with the patches:

[libvirt PATCH v3 03/25] snapshot_conf: use alternate domain definition in virDomainSnapshotDefAssignExternalNames

2023-08-14 Thread Pavel Hrdina
Commit introduced new argument for virDomainSnapshotAlignDisks() that allows passing alternate domain definition in case the snapshot parent.dom is NULL. In case of redefining snapshot it will not hit the part of code that unconditionally uses parent.dom as there will not be need to generate

[libvirt PATCH v3 05/25] virDomainSnapshotAlignDisks: Allow overriding user-configured snapshot default

2023-08-14 Thread Pavel Hrdina
This new option will be used by external snapshot revert code. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/conf/snapshot_conf.c | 15 --- src/conf/snapshot_conf.h | 3 ++- src/qemu/qemu_snapshot.c | 2 +- src/test/test_driver.c | 2 +- 4 files changed, 16

[libvirt PATCH v3 04/25] snapshot_conf: introduce metadata element

2023-08-14 Thread Pavel Hrdina
This new element will hold the new disk overlay created when reverting to non-leaf snapshot in order to remember the files libvirt created. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/conf/schemas/domainsnapshot.rng | 7 +++ src/conf/snapshot_conf.c| 30

[libvirt PATCH v3 24/25] qemu_snapshot: add checks for external snapshot deletion

2023-08-14 Thread Pavel Hrdina
With the introduction of external snapshot revert support we need to error out in some cases when trying to delete some snapshots. If users reverts to non-leaf snapshots and would try to delete it after the revert is done it would not work currently as this operation would require using

[libvirt PATCH v3 18/25] qemu_snapshot: delete: properly update parent snapshot with revert data

2023-08-14 Thread Pavel Hrdina
When deleting external snapshot and parent snapshot is the currently active snapshot as user reverted to it we need to properly update the parent snapshot metadata. After the delete is done the new overlay files will be the currently used files created when snapshot revert was done, replacing the

[libvirt PATCH v3 15/25] qemu_snapshot: add merge to external snapshot delete prepare data

2023-08-14 Thread Pavel Hrdina
Before external snapshot revert every delete operation did block commit in order to delete a snapshot. But now when user reverts to non-leaf snapshot deleting leaf snapshot will not have any overlay files so we can just simply delete the snapshot images. Signed-off-by: Pavel Hrdina Reviewed-by:

[libvirt PATCH v3 14/25] qemu_snapshot: extract external snapshot delete prepare to function

2023-08-14 Thread Pavel Hrdina
This part of code is about to grow to make deletion work when user reverts to non-leaf snapshot. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 104 ++- 1 file changed, 70 insertions(+), 34 deletions(-) diff --git

[libvirt PATCH v3 07/25] qemu_snapshot: use virDomainDiskByName while updating domain def

2023-08-14 Thread Pavel Hrdina
When creating external snapshot this function is called only when the VM is not running so there is only one definition to care about. However, it will be used by external snapshot revert code for active and inactive definition and they may be different if a disk was (un)plugged only for the