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 <pkre...@redhat.com>
---
 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

Reply via email to