qemu: Make checks in qemuDomainBlockPivot depend on data of the job
Do decisions based on the configuration of the job rather than the data stored with the disk. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
e6f38fdbe5
commit
dd9dc7bfe1
@ -16979,17 +16979,30 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
|
|
||||||
if (!disk->mirror) {
|
switch ((qemuBlockJobType) job->type) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
case QEMU_BLOCKJOB_TYPE_NONE:
|
||||||
_("pivot of disk '%s' requires an active copy job"),
|
case QEMU_BLOCKJOB_TYPE_LAST:
|
||||||
disk->dst);
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("invalid job type '%d'"), job->type);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
case QEMU_BLOCKJOB_TYPE_PULL:
|
||||||
|
case QEMU_BLOCKJOB_TYPE_COMMIT:
|
||||||
|
case QEMU_BLOCKJOB_TYPE_INTERNAL:
|
||||||
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||||
|
_("job type '%s' does not support pivot"),
|
||||||
|
qemuBlockjobTypeToString(job->type));
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
case QEMU_BLOCKJOB_TYPE_COPY:
|
||||||
|
case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (disk->mirrorState != VIR_DOMAIN_DISK_MIRROR_STATE_READY) {
|
if (job->state != QEMU_BLOCKJOB_STATE_READY) {
|
||||||
virReportError(VIR_ERR_BLOCK_COPY_ACTIVE,
|
virReportError(VIR_ERR_BLOCK_COPY_ACTIVE,
|
||||||
_("disk '%s' not ready for pivot yet"),
|
_("block job '%s' not ready for pivot yet"),
|
||||||
disk->dst);
|
job->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17014,7 +17027,8 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT;
|
if (disk && disk->mirror)
|
||||||
|
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user