qemu: Convert iothread hotplug to qemuMonitorCreateObjectProps

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-05-30 18:24:26 +02:00
parent c2f71bb295
commit 805da1d577
1 changed files with 9 additions and 5 deletions

View 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: