mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 04:55:18 +00:00
virDomainDiskTranslateSourcePool: Fix check of 'startupPolicy' definition
The check was historically done only for _TYPE_VOLUME disks, but refactors to allow _TYPE_VOLUME disks in the backing chain caused a regression where we'd reject startupPolicy also for _TYPE_BLOCK disks which historically worked well. Fix it by using the 'virDomainDiskDefValidateStartupPolicy' helper and use it only when the top level image is a _TYPE_VOLUME as in other cases it was already validated. This also allows _TYPE_BLOCK volumes to use startup policy. Fixes: 37f01262eed9f37dd5eb7de8b83edd2fea741054 Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2095758 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b90d0f0a1e
commit
ed8984306e
@ -31517,13 +31517,13 @@ virDomainDiskTranslateSourcePool(virDomainDiskDef *def)
|
||||
|
||||
if (virDomainStorageSourceTranslateSourcePool(n, conn) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (def->startupPolicy != 0 &&
|
||||
virStorageSourceGetActualType(def->src) != VIR_STORAGE_TYPE_FILE) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("'startupPolicy' is only valid for 'file' type volume"));
|
||||
return -1;
|
||||
/* The validity of 'startupPolicy' setting is checked only for the top
|
||||
* level image. For any other subsequent images we honour it only if
|
||||
* possible */
|
||||
if (n == def->src &&
|
||||
virDomainDiskDefValidateStartupPolicy(def) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user