From 9a480737c8adf92c332aa850c5269191ceb04eb9 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 14 Jun 2022 13:13:48 +0200 Subject: [PATCH] virDomainDiskDefValidate: Improve error messages for 'startupPolicy' checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove linebreak and mention the attribute name. Also prepare the error messages for future by substituting the type of offending access. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/conf/domain_validate.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 1e18826bc1..3e11e00ee4 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -855,9 +855,9 @@ virDomainDiskDefValidate(const virDomainDef *def, if (disk->startupPolicy != VIR_DOMAIN_STARTUP_POLICY_DEFAULT) { if (disk->src->type == VIR_STORAGE_TYPE_NETWORK) { virReportError(VIR_ERR_XML_ERROR, - _("Setting disk %s is not allowed for " - "disk of network type"), - virDomainStartupPolicyTypeToString(disk->startupPolicy)); + _("disk startupPolicy '%s' is not allowed for disk of '%s' type"), + virDomainStartupPolicyTypeToString(disk->startupPolicy), + virStorageTypeToString(disk->src->type)); return -1; } @@ -865,8 +865,7 @@ virDomainDiskDefValidate(const virDomainDef *def, disk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY && disk->startupPolicy == VIR_DOMAIN_STARTUP_POLICY_REQUISITE) { virReportError(VIR_ERR_XML_ERROR, "%s", - _("Setting disk 'requisite' is allowed only for " - "cdrom or floppy")); + _("disk startupPolicy 'requisite' is allowed only for cdrom or floppy")); return -1; } }