[libvirt] [PATCH 03/34] phyp: Refactor extraction of vcpu count

Peter Krempa pkrempa at redhat.com
Fri Nov 20 15:21:53 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/phyp/phyp_driver.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 2912fc4..14264c0 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -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));

-- 
2.6.2




More information about the libvir-list mailing list