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(a)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(a)redhat.com>
Jano