6ae9ed
From 1a6ed7e15d95b976797a30f1f8b76817765c6e64 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <1a6ed7e15d95b976797a30f1f8b76817765c6e64@dist-git>
6ae9ed
From: John Ferlan <jferlan@redhat.com>
6ae9ed
Date: Tue, 16 Aug 2016 11:43:52 -0400
6ae9ed
Subject: [PATCH] conf: Provide error on undefined iothreadsched entry
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1366484
6ae9ed
6ae9ed
When commit id '6dfb4507' refactored where the iothreadsched data was
6ae9ed
stored, the error message for when the virDomainIOThreadIDFind failed
6ae9ed
to find an iothreadid ("iothreadsched attribute 'iothreads' uses
6ae9ed
undefined iothread ids") was lost. This led to the possibility that
6ae9ed
someone would try to use it, but receive the generic message "An error
6ae9ed
occurred, but the cause is unknown".
6ae9ed
6ae9ed
This patch adds the error message back so that someone will know that
6ae9ed
they have an invalid configuration.
6ae9ed
6ae9ed
Signed-off-by: John Ferlan <jferlan@redhat.com>
6ae9ed
(cherry picked from commit 8c6b29e7b41d678ab9c5542efd607b28776e4f24)
6ae9ed
---
6ae9ed
 src/conf/domain_conf.c | 6 +++++-
6ae9ed
 1 file changed, 5 insertions(+), 1 deletion(-)
6ae9ed
6ae9ed
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
6ae9ed
index 33954f7..ffafef3 100644
6ae9ed
--- a/src/conf/domain_conf.c
6ae9ed
+++ b/src/conf/domain_conf.c
6ae9ed
@@ -15532,8 +15532,12 @@ virDomainDefGetIOThreadSched(virDomainDefPtr def,
6ae9ed
 {
6ae9ed
     virDomainIOThreadIDDefPtr iothrinfo;
6ae9ed
 
6ae9ed
-    if (!(iothrinfo = virDomainIOThreadIDFind(def, iothread)))
6ae9ed
+    if (!(iothrinfo = virDomainIOThreadIDFind(def, iothread))) {
6ae9ed
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
6ae9ed
+                       _("Cannot find 'iothread' : %u"),
6ae9ed
+                       iothread);
6ae9ed
         return NULL;
6ae9ed
+    }
6ae9ed
 
6ae9ed
     return &iothrinfo->sched;
6ae9ed
 }
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed