[PATCH 3/4] virDomainDiskDefValidateStartupPolicy: Validate disk type better

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/conf/domain_validate.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 70e9167eac..9c55d05cac 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -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),
-- 
2.36.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux