]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Convert iothread hotplug to qemuMonitorCreateObjectProps
authorPeter Krempa <pkrempa@redhat.com>
Wed, 30 May 2018 16:24:26 +0000 (18:24 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 5 Jun 2018 06:13:59 +0000 (08:13 +0200)
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c

index 09f90320e83ae44ae3bcf1cf88859d9ddc8dba27..a86b22284239b8b419d6f84f32580d8c3013b1fd 100644 (file)
@@ -5806,24 +5806,27 @@ qemuDomainHotplugAddIOThread(virQEMUDriverPtr driver,
     qemuDomainObjPrivatePtr priv = vm->privateData;
     char *alias = NULL;
     size_t idx;
-    int rc = -1;
     int ret = -1;
     unsigned int orig_niothreads = vm->def->niothreadids;
     unsigned int exp_niothreads = vm->def->niothreadids;
     int new_niothreads = 0;
     qemuMonitorIOThreadInfoPtr *new_iothreads = NULL;
     virDomainIOThreadIDDefPtr iothrid;
+    virJSONValuePtr props = NULL;
 
     if (virAsprintf(&alias, "iothread%u", iothread_id) < 0)
         return -1;
 
+    if (qemuMonitorCreateObjectProps(&props, "iothread", alias, NULL) < 0)
+        goto cleanup;
+
     qemuDomainObjEnterMonitor(driver, vm);
 
-    rc = qemuMonitorAddObjectType(priv->mon, "iothread", alias, NULL);
-    exp_niothreads++;
-    if (rc < 0)
+    if (qemuMonitorAddObject(priv->mon, &props, NULL) < 0)
         goto exit_monitor;
 
+    exp_niothreads++;
+
     /* After hotplugging the IOThreads we need to re-detect the
      * IOThreads thread_id's, adjust the cgroups, thread affinity,
      * and add the thread_id to the vm->def->iothreadids list.
@@ -5876,8 +5879,9 @@ qemuDomainHotplugAddIOThread(virQEMUDriverPtr driver,
         VIR_FREE(new_iothreads);
     }
     virDomainAuditIOThread(vm, orig_niothreads, new_niothreads,
-                           "update", rc == 0);
+                           "update", ret == 0);
     VIR_FREE(alias);
+    virJSONValueFree(props);
     return ret;
 
  exit_monitor: