[PATCH v2] conf: Provide error on undefined vcpusched entry

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

 



Modify virDomainDefGetVcpuSched to emit an error message if
virDomainDefGetVcpu returns NULL meaning the vcpu could not
be found. Prior to commit id '9cc931f0b' the error message
would have been issued in virDomainDefGetVcpu.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 v1: http://www.redhat.com/archives/libvir-list/2016-August/msg00754.html

 Wasn't fully clear from the v1 discussion whether my proposal for vcpusched
 was acceptible or not, so I figured I'd generate a v2 and of course the
 example...

 Using a domain without <vcpusched> in a <cputune>, if there's:

   <vcpu placement='static' current='2'>4</vcpu>

 in the domain XML and one uses virsh edit to add:

   <vcpusched vcpus='7-8' scheduler='idle'/>

 then the generic error message is displayed.

 This only occurs as of v2.1 where the message was removed from
 virDomainDefGetVcpu.

 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..14d4f7d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1480,8 +1480,12 @@ virDomainDefGetVcpuSched(virDomainDefPtr def,
 {
     virDomainVcpuDefPtr vcpuinfo;
 
-    if (!(vcpuinfo = virDomainDefGetVcpu(def, vcpu)))
+    if (!(vcpuinfo = virDomainDefGetVcpu(def, vcpu))) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("vCPU '%u' is not present in domain definition"),
+                       vcpu);
         return NULL;
+    }
 
     return &vcpuinfo->sched;
 }
-- 
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]