[PATCH 02/11] qemu: extract helper to gather vcpu data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Extracts an helper to gether the VCpu
information.

Signed-off-by: Francesco Romani <fromani@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bbd16ed..1842e60 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -172,6 +172,12 @@ static int qemuDomainGetBalloonMemory(virQEMUDriverPtr driver,
                                       virDomainObjPtr vm,
                                       unsigned long *memory);
 
+static int qemuDomainHelperGetVcpus(virDomainObjPtr vm,
+                                    virVcpuInfoPtr info,
+                                    int maxinfo,
+                                    unsigned char *cpumaps,
+                                    int maplen);
+
 virQEMUDriverPtr qemu_driver = NULL;
 
 
@@ -4974,10 +4980,7 @@ qemuDomainGetVcpus(virDomainPtr dom,
                    int maplen)
 {
     virDomainObjPtr vm;
-    size_t i;
-    int v, maxcpu, hostcpus;
     int ret = -1;
-    qemuDomainObjPrivatePtr priv;
 
     if (!(vm = qemuDomObjFromDomain(dom)))
         goto cleanup;
@@ -4992,7 +4995,25 @@ qemuDomainGetVcpus(virDomainPtr dom,
         goto cleanup;
     }
 
-    priv = vm->privateData;
+    ret = qemuDomainHelperGetVcpus(vm, info, maxinfo, cpumaps, maplen);
+
+ cleanup:
+    if (vm)
+        virObjectUnlock(vm);
+    return ret;
+}
+
+static int
+qemuDomainHelperGetVcpus(virDomainObjPtr vm,
+                         virVcpuInfoPtr info,
+                         int maxinfo,
+                         unsigned char *cpumaps,
+                         int maplen)
+{
+    int ret = -1;
+    int v, maxcpu, hostcpus;
+    size_t i;
+    qemuDomainObjPrivatePtr priv = vm->privateData;
 
     if ((hostcpus = nodeGetCPUCount()) < 0)
         goto cleanup;
-- 
1.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]