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

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