[libvirt] [PATCH 04/34] xenapi: Refactor extraction of vcpu count

Peter Krempa pkrempa at redhat.com
Fri Nov 20 15:21:54 UTC 2015


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 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 3045c5a..e503974 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -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);
-- 
2.6.2




More information about the libvir-list mailing list