[libvirt] [PATCH 2/2] conf: Provide error on undefined vcpusched entry

John Ferlan jferlan at redhat.com
Mon Aug 15 14:55:34 UTC 2016


Commit id '9cc931f0b' removed the error message; however, it was reachable
via the virsh edit of a domain and attempting to add a vcpusched element
for "undefined" vcpu values.  Without the error, the generic message
"An error occurred, but the cause is unknown" is displayed.

This is similar to bz 1366484 for the iothreadsched element.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/conf/domain_conf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9037304..caebe99 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1467,8 +1467,12 @@ virDomainVcpuDefPtr
 virDomainDefGetVcpu(virDomainDefPtr def,
                     unsigned int vcpu)
 {
-    if (vcpu >= def->maxvcpus)
+    if (vcpu >= def->maxvcpus) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("vCPU '%u' is not present in domain definition"),
+                       vcpu);
         return NULL;
+    }
 
     return def->vcpus[vcpu];
 }
-- 
2.7.4




More information about the libvir-list mailing list