]> xenbits.xensource.com Git - libvirt.git/commitdiff
xenapi: 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/xenapi/xenapi_driver.c

index 3045c5ac5e2da4c6267499fe35f2a58d04126519..e503974c24b50185eaa7308baa6731c2465ccab4 100644 (file)
@@ -1403,6 +1403,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
     char *val = NULL;
     struct xen_vif_set *vif_set = NULL;
     char *xml;
+    unsigned int vcpus;
 
     /* Flags checked by virDomainDefFormat */
 
@@ -1498,7 +1499,12 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
     } else {
         defPtr->mem.cur_balloon = memory;
     }
-    defPtr->maxvcpus = defPtr->vcpus = xenapiDomainGetMaxVcpus(dom);
+
+    vcpus = xenapiDomainGetMaxVcpus(dom);
+
+    defPtr->maxvcpus = vcpus;
+    defPtr->vcpus = vcpus;
+
     enum xen_on_normal_exit action;
     if (xen_vm_get_actions_after_shutdown(session, &action, vm))
         defPtr->onPoweroff = xenapiNormalExitEnum2virDomainLifecycle(action);