[PATCH v2 07/27] conf: Move vcpu count check into helper

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

 



---
 src/conf/domain_conf.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ab2048b..a2cb894 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1461,6 +1461,13 @@ int
 virDomainDefSetVcpus(virDomainDefPtr def,
                      unsigned int vcpus)
 {
+    if (vcpus > def->maxvcpus) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("maxvcpus must not be less than current vcpus (%u < %u)"),
+                       vcpus, def->maxvcpus);
+        return -1;
+    }
+
     def->vcpus = vcpus;

     return 0;
@@ -14758,13 +14765,6 @@ virDomainVcpuParse(virDomainDefPtr def,
     if (virDomainDefSetVcpus(def, vcpus) < 0)
         goto cleanup;

-    if (maxvcpus < def->vcpus) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("maxvcpus must not be less than current vcpus "
-                         "(%u < %u)"), maxvcpus, def->vcpus);
-        goto cleanup;
-    }
-
     tmp = virXPathString("string(./vcpu[1]/@placement)", ctxt);
     if (tmp) {
         if ((def->placement_mode =
-- 
2.6.2

--
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]