[PATCH 06/13] qemu: Simplify qemuDomainGetEmulatorPinInfo by using virDomainObjGetOneDef

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

 



virDomainObjGetOneDef is simpler to use than virDomainObjGetDefs
---
 src/qemu/qemu_driver.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f3c53f5..c878409 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5400,7 +5400,6 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,
 {
     virDomainObjPtr vm = NULL;
     virDomainDefPtr def;
-    virDomainDefPtr targetDef;
     int ret = -1;
     int hostcpus;
     virBitmapPtr cpumask = NULL;
@@ -5415,19 +5414,16 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,
     if (virDomainGetEmulatorPinInfoEnsureACL(dom->conn, vm->def) < 0)
         goto cleanup;

-    if (virDomainObjGetDefs(vm, flags, &def, &targetDef) < 0)
+    if (!(def = virDomainObjGetOneDef(vm, flags)))
         goto cleanup;

-    if (def)
-        targetDef = def;
-
     if ((hostcpus = nodeGetCPUCount()) < 0)
         goto cleanup;

-    if (targetDef->cputune.emulatorpin) {
-        cpumask = targetDef->cputune.emulatorpin;
-    } else if (targetDef->cpumask) {
-        cpumask = targetDef->cpumask;
+    if (def->cputune.emulatorpin) {
+        cpumask = def->cputune.emulatorpin;
+    } else if (def->cpumask) {
+        cpumask = def->cpumask;
     } else {
         if (!(bitmap = virBitmapNew(hostcpus)))
             goto cleanup;
-- 
2.4.1

--
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]