[PATCH 0/2] Two incremental backup related fixes

Peter Krempa (2): qemuCheckpointDelete: Check VM liveness first qemuBackupBegin: Fix monitor access when rolling back due to failure src/qemu/qemu_backup.c | 2 +- src/qemu/qemu_checkpoint.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) -- 2.24.1

Move the liveness check prior to the capability check. If the VM is offline the capabilities are not initialized and thus we'd report the wrong error. https://bugzilla.redhat.com/show_bug.cgi?id=1812531 Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_checkpoint.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 76f10a701e..62b6e87b53 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -771,15 +771,15 @@ qemuCheckpointDelete(virDomainObjPtr vm, return -1; if (!metadata_only) { - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) { + if (!virDomainObjIsActive(vm)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("incremental backup is not supported yet")); + _("cannot delete checkpoint for inactive domain")); goto endjob; } - if (!virDomainObjIsActive(vm)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("cannot delete checkpoint for inactive domain")); + _("incremental backup is not supported yet")); goto endjob; } } -- 2.24.1

On 3/26/20 9:54 AM, Peter Krempa wrote:
Move the liveness check prior to the capability check. If the VM is offline the capabilities are not initialized and thus we'd report the wrong error.
https://bugzilla.redhat.com/show_bug.cgi?id=1812531
Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_checkpoint.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 76f10a701e..62b6e87b53 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -771,15 +771,15 @@ qemuCheckpointDelete(virDomainObjPtr vm, return -1;
if (!metadata_only) { - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) { + if (!virDomainObjIsActive(vm)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("incremental backup is not supported yet")); + _("cannot delete checkpoint for inactive domain")); goto endjob; }
- if (!virDomainObjIsActive(vm)) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_INCREMENTAL_BACKUP)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("cannot delete checkpoint for inactive domain")); + _("incremental backup is not supported yet")); goto endjob; } }
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org

The code attempting to clean up after a failed pull mode backup job wrongly entered monitor but didn't clean up nor exit monitor due to a logic bug. Fix the condition. https://bugzilla.redhat.com/show_bug.cgi?id=1817327 Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_backup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 8b66ee8d1f..9a056fa407 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -894,7 +894,7 @@ qemuBackupBegin(virDomainObjPtr vm, qemuCheckpointRollbackMetadata(vm, chk); if (!job_started && nbd_running && - qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) < 0) { + qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) == 0) { ignore_value(qemuMonitorNBDServerStop(priv->mon)); ignore_value(qemuDomainObjExitMonitor(priv->driver, vm)); } -- 2.24.1

On 3/26/20 9:54 AM, Peter Krempa wrote:
The code attempting to clean up after a failed pull mode backup job wrongly entered monitor but didn't clean up nor exit monitor due to a logic bug. Fix the condition.
https://bugzilla.redhat.com/show_bug.cgi?id=1817327
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Would be nice to mention which commit id introduced the bug.
--- src/qemu/qemu_backup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 8b66ee8d1f..9a056fa407 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -894,7 +894,7 @@ qemuBackupBegin(virDomainObjPtr vm, qemuCheckpointRollbackMetadata(vm, chk);
if (!job_started && nbd_running && - qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) < 0) { + qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BACKUP) == 0) { ignore_value(qemuMonitorNBDServerStop(priv->mon)); ignore_value(qemuDomainObjExitMonitor(priv->driver, vm)); }
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org

On Thu, Mar 26, 2020 at 11:21:37 -0500, Eric Blake wrote:
On 3/26/20 9:54 AM, Peter Krempa wrote:
The code attempting to clean up after a failed pull mode backup job wrongly entered monitor but didn't clean up nor exit monitor due to a logic bug. Fix the condition.
https://bugzilla.redhat.com/show_bug.cgi?id=1817327
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Would be nice to mention which commit id introduced the bug.
Well, in this case you'll be fishing it out of a ~1k line additions patch as it was introduced right together when the backup api implementation was added in a1521f84a53. I'll add the mention, but I didn't find it useful in this case.
participants (2)
-
Eric Blake
-
Peter Krempa