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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]