[libvirt] [PATCH 2/8] qemu: Make checks in qemuDomainBlockPivot depend on data of the job

Ján Tomko jtomko at redhat.com
Mon Jul 22 12:08:41 UTC 2019


On Thu, Jul 18, 2019 at 06:31:37PM +0200, Peter Krempa wrote:
>Do decisions based on the configuration of the job rather than the data
>stored with the disk.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/qemu/qemu_driver.c | 24 +++++++++++++++++-------
> 1 file changed, 17 insertions(+), 7 deletions(-)
>
>diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>index 739cbc5ed3..fa9e3c2bfc 100644
>--- a/src/qemu/qemu_driver.c
>+++ b/src/qemu/qemu_driver.c
>@@ -16982,17 +16982,26 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
>     int ret = -1;
>     qemuDomainObjPrivatePtr priv = vm->privateData;
>
>-    if (!disk->mirror) {
>+    switch ((qemuBlockJobType) job->type) {
>+    case QEMU_BLOCKJOB_TYPE_NONE:
>+    case QEMU_BLOCKJOB_TYPE_PULL:
>+    case QEMU_BLOCKJOB_TYPE_COMMIT:
>+    case QEMU_BLOCKJOB_TYPE_INTERNAL:
>+    case QEMU_BLOCKJOB_TYPE_LAST:

Strictly speaking, TYPE_LAST in an enum error, not a correct block job
type

>         virReportError(VIR_ERR_OPERATION_INVALID,
>-                       _("pivot of disk '%s' requires an active copy job"),
>-                       disk->dst);
>+                       _("job type '%s' does not support pivot"),
>+                       NULLSTR(qemuBlockjobTypeToString(job->type)));

That would remove the need for this NULLSTR

>         goto cleanup;
>+
>+    case QEMU_BLOCKJOB_TYPE_COPY:
>+    case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT:
>+        break;
>     }
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190722/d3e86578/attachment-0001.sig>


More information about the libvir-list mailing list