]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Simplify qemuDomainGetEmulatorPinInfo by using virDomainObjGetOneDef
authorPeter Krempa <pkrempa@redhat.com>
Mon, 15 Jun 2015 17:10:49 +0000 (19:10 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 18 Jun 2015 13:13:45 +0000 (15:13 +0200)
virDomainObjGetOneDef is simpler to use than virDomainObjGetDefs

src/qemu/qemu_driver.c

index f3c53f517d66f924bd665d70dffeea775a0bf62e..c8784093d7132c26ad0309dedb12f82c0fddc46a 100644 (file)
@@ -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;