qemu: Fix logic in qemuDomainBlockCopyCommonValidateUserMirrorBackingStore
Allow reusing original backing chain when doing a shallow copy without reuse of external image. The existing logic didn't allow it but it will be possible. Also add a note to explain that logic. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
734352d434
commit
32bd092b49
@ -18304,19 +18304,23 @@ qemuDomainBlockCopyCommonValidateUserMirrorBackingStore(virStorageSourcePtr mirr
|
|||||||
{
|
{
|
||||||
/* note that if original disk does not have backing chain, shallow is cleared */
|
/* note that if original disk does not have backing chain, shallow is cleared */
|
||||||
bool shallow = flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW;
|
bool shallow = flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW;
|
||||||
bool reuse = flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT;
|
|
||||||
|
|
||||||
if (!mirror->backingStore) {
|
if (!virStorageSourceHasBacking(mirror)) {
|
||||||
/* deep copy won't need backing store so we can terminate it */
|
/* for deep copy there won't be backing chain so we can terminate it */
|
||||||
if (!shallow &&
|
if (!mirror->backingStore &&
|
||||||
|
!shallow &&
|
||||||
!(mirror->backingStore = virStorageSourceNew()))
|
!(mirror->backingStore = virStorageSourceNew()))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
/* When reusing an external image we document that the user must ensure
|
||||||
}
|
* that the <mirror> image must expose data as the original image did
|
||||||
|
* either by providing correct chain or prepopulating the image. This
|
||||||
/* validate user provided backing store */
|
* means we can't validate this any more regardless of whether shallow
|
||||||
if (virStorageSourceHasBacking(mirror)) {
|
* copy is requested.
|
||||||
|
*
|
||||||
|
* For a copy when we are not reusing external image requesting shallow
|
||||||
|
* is okay and will inherit the original backing chain */
|
||||||
|
} else {
|
||||||
if (!blockdev) {
|
if (!blockdev) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("backingStore of mirror target is not supported by this qemu"));
|
_("backingStore of mirror target is not supported by this qemu"));
|
||||||
@ -18328,13 +18332,6 @@ qemuDomainBlockCopyCommonValidateUserMirrorBackingStore(virStorageSourcePtr mirr
|
|||||||
_("backingStore of mirror without VIR_DOMAIN_BLOCK_COPY_SHALLOW doesn't make sense"));
|
_("backingStore of mirror without VIR_DOMAIN_BLOCK_COPY_SHALLOW doesn't make sense"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* shallow copy without reuse requires some kind of backing data */
|
|
||||||
if (!reuse && shallow) {
|
|
||||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
|
||||||
_("VIR_DOMAIN_BLOCK_COPY_SHALLOW implies backing chain for mirror"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user