]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
phyp: 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/phyp/phyp_driver.c

index 2912fc40294dbd276d9d9b1d6104719571522136..14264c0ce24c75c9d3e5f020c685b325920a4d88 100644 (file)
@@ -3255,6 +3255,7 @@ phypDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
     virDomainDef def;
     char *managed_system = phyp_driver->managed_system;
     unsigned long long memory;
+    unsigned int vcpus;
 
     /* Flags checked by virDomainDefFormat */
 
@@ -3289,12 +3290,14 @@ phypDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
         goto err;
     }
 
-    if ((def.maxvcpus = def.vcpus =
-         phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0) {
+    if ((vcpus = phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0) {
         VIR_ERROR(_("Unable to determine domain's CPU."));
         goto err;
     }
 
+    def.maxvcpus = vcpus;
+    def.vcpus = vcpus;
+
     return virDomainDefFormat(&def,
                               virDomainDefFormatConvertXMLFlags(flags));