Blame SOURCES/libvirt-virDomainDiskDefValidate-Improve-error-messages-for-startupPolicy-checks.patch

4372d3
From 41247c87fd47f2e55825d62c697da810ba5062f5 Mon Sep 17 00:00:00 2001
4372d3
Message-Id: <41247c87fd47f2e55825d62c697da810ba5062f5@dist-git>
11fcb6
From: Peter Krempa <pkrempa@redhat.com>
11fcb6
Date: Tue, 14 Jun 2022 13:13:48 +0200
11fcb6
Subject: [PATCH] virDomainDiskDefValidate: Improve error messages for
11fcb6
 'startupPolicy' checks
11fcb6
MIME-Version: 1.0
11fcb6
Content-Type: text/plain; charset=UTF-8
11fcb6
Content-Transfer-Encoding: 8bit
11fcb6
11fcb6
Remove linebreak and mention the attribute name. Also prepare the error
11fcb6
messages for future by substituting the type of offending access.
11fcb6
11fcb6
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
11fcb6
Reviewed-by: Ján Tomko <jtomko@redhat.com>
11fcb6
(cherry picked from commit 9a480737c8adf92c332aa850c5269191ceb04eb9)
11fcb6
https://bugzilla.redhat.com/show_bug.cgi?id=2095758
11fcb6
---
11fcb6
 src/conf/domain_validate.c | 9 ++++-----
11fcb6
 1 file changed, 4 insertions(+), 5 deletions(-)
11fcb6
11fcb6
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
11fcb6
index a4271f1247..452742e67c 100644
11fcb6
--- a/src/conf/domain_validate.c
11fcb6
+++ b/src/conf/domain_validate.c
11fcb6
@@ -778,9 +778,9 @@ virDomainDiskDefValidate(const virDomainDef *def,
11fcb6
     if (disk->startupPolicy != VIR_DOMAIN_STARTUP_POLICY_DEFAULT) {
11fcb6
         if (disk->src->type == VIR_STORAGE_TYPE_NETWORK) {
11fcb6
             virReportError(VIR_ERR_XML_ERROR,
11fcb6
-                           _("Setting disk %s is not allowed for "
11fcb6
-                             "disk of network type"),
11fcb6
-                           virDomainStartupPolicyTypeToString(disk->startupPolicy));
11fcb6
+                           _("disk startupPolicy '%s' is not allowed for disk of '%s' type"),
11fcb6
+                           virDomainStartupPolicyTypeToString(disk->startupPolicy),
11fcb6
+                           virStorageTypeToString(disk->src->type));
11fcb6
             return -1;
11fcb6
         }
11fcb6
 
11fcb6
@@ -788,8 +788,7 @@ virDomainDiskDefValidate(const virDomainDef *def,
11fcb6
             disk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
11fcb6
             disk->startupPolicy == VIR_DOMAIN_STARTUP_POLICY_REQUISITE) {
11fcb6
             virReportError(VIR_ERR_XML_ERROR, "%s",
11fcb6
-                           _("Setting disk 'requisite' is allowed only for "
11fcb6
-                             "cdrom or floppy"));
11fcb6
+                           _("disk startupPolicy 'requisite' is allowed only for cdrom or floppy"));
11fcb6
             return -1;
11fcb6
         }
11fcb6
     }
11fcb6
-- 
11fcb6
2.35.1
11fcb6