render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
6ae9ed
From 6c04a4844d053c51238b5b1c47df95b0d6cba677 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <6c04a4844d053c51238b5b1c47df95b0d6cba677@dist-git>
6ae9ed
From: John Ferlan <jferlan@redhat.com>
6ae9ed
Date: Wed, 24 Aug 2016 16:11:16 -0400
6ae9ed
Subject: [PATCH] conf: Provide error on undefined vcpusched entry
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1097930
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1224341
6ae9ed
6ae9ed
Modify virDomainDefGetVcpuSched to emit an error message if
6ae9ed
virDomainDefGetVcpu returns NULL meaning the vcpu could not
6ae9ed
be found. Prior to commit id '9cc931f0b' the error message
6ae9ed
would have been issued in virDomainDefGetVcpu.
6ae9ed
6ae9ed
(cherry picked from commit 4b15fd0d1f3b63c0feb847b1bfe93cee46813601)
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 8e5afe7..4e703d9 100644
6ae9ed
--- a/src/conf/domain_conf.c
6ae9ed
+++ b/src/conf/domain_conf.c
6ae9ed
@@ -1477,8 +1477,12 @@ virDomainDefGetVcpuSched(virDomainDefPtr def,
6ae9ed
 {
6ae9ed
     virDomainVcpuDefPtr vcpuinfo;
6ae9ed
 
6ae9ed
-    if (!(vcpuinfo = virDomainDefGetVcpu(def, vcpu)))
6ae9ed
+    if (!(vcpuinfo = virDomainDefGetVcpu(def, vcpu))) {
6ae9ed
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
6ae9ed
+                       _("vCPU '%u' is not present in domain definition"),
6ae9ed
+                       vcpu);
6ae9ed
         return NULL;
6ae9ed
+    }
6ae9ed
 
6ae9ed
     return &vcpuinfo->sched;
6ae9ed
 }
6ae9ed
-- 
6ae9ed
2.10.0
6ae9ed