mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
virDomainDiskDefValidateStartupPolicy: Validate disk type better
Our startup policy checkers work only for local paths, so disk sources such as NVMe, or vhost-user can't be used with startup policy. Unfortunately the validation did not catch these cases. Fix it. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3603a18bce
commit
b90d0f0a1e
@ -638,7 +638,10 @@ virDomainDiskDefValidateStartupPolicy(const virDomainDiskDef *disk)
|
||||
if (disk->startupPolicy == VIR_DOMAIN_STARTUP_POLICY_DEFAULT)
|
||||
return 0;
|
||||
|
||||
if (disk->src->type == VIR_STORAGE_TYPE_NETWORK) {
|
||||
/* We want to allow any startup policy for un-translated _TYPE_VOLUME disks.
|
||||
* virStorageSourceGetActualType returns _TYPE_VOLUME in such case */
|
||||
if (virStorageSourceGetActualType(disk->src) != VIR_STORAGE_TYPE_VOLUME &&
|
||||
!virStorageSourceIsLocalStorage(disk->src)) {
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("disk startupPolicy '%s' is not allowed for disk of '%s' type"),
|
||||
virDomainStartupPolicyTypeToString(disk->startupPolicy),
|
||||
|
Loading…
Reference in New Issue
Block a user