]> xenbits.xensource.com Git - libvirt.git/commitdiff
openvz: Refactor extraction of vcpu count
authorPeter Krempa <pkrempa@redhat.com>
Fri, 16 Oct 2015 13:38:48 +0000 (15:38 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 24 Nov 2015 12:16:55 +0000 (13:16 +0100)
To simplify further refactors change the way the vcpu count is extracted
to use a temp variable rather than juggling with def->maxvcpus.

src/openvz/openvz_conf.c

index db0a9a777620ddee57ba03010f5100b423716874..c0f65c918e1f431477f112ea5f98207fe981c7cd 100644 (file)
@@ -522,6 +522,7 @@ int openvzLoadDomains(struct openvz_driver *driver)
     char *outbuf = NULL;
     char *line;
     virCommandPtr cmd = NULL;
+    unsigned int vcpus = 0;
 
     if (openvzAssignUUIDs() < 0)
         return -1;
@@ -575,12 +576,14 @@ int openvzLoadDomains(struct openvz_driver *driver)
                            veid);
             goto cleanup;
         } else if (ret > 0) {
-            def->maxvcpus = strtoI(temp);
+            vcpus = strtoI(temp);
         }
 
-        if (ret == 0 || def->maxvcpus == 0)
-            def->maxvcpus = openvzGetNodeCPUs();
-        def->vcpus = def->maxvcpus;
+        if (ret == 0 || vcpus == 0)
+            vcpus = openvzGetNodeCPUs();
+
+        def->maxvcpus = vcpus;
+        def->vcpus = vcpus;
 
         /* XXX load rest of VM config data .... */