{
virDomainIOThreadIDDefPtr iothrid = NULL;
- if (virDomainIOThreadIDFind(def, iothread_id)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot duplicate iothread_id '%u' in iothreadids"),
- iothread_id);
- return NULL;
- }
-
if (VIR_ALLOC(iothrid) < 0)
goto error;
qemuMonitorIOThreadInfoPtr *new_iothreads = NULL;
virDomainIOThreadIDDefPtr iothrid;
- if (virDomainIOThreadIDFind(vm->def, iothread_id)) {
- virReportError(VIR_ERR_INVALID_ARG,
- _("an IOThread is already using iothread_id '%u'"),
- iothread_id);
- goto cleanup;
- }
-
if (virAsprintf(&alias, "iothread%u", iothread_id) < 0)
return -1;
goto cleanup;
}
+
+static int
+qemuDomainAddIOThreadCheck(virDomainDefPtr def,
+ unsigned int iothread_id)
+{
+ if (virDomainIOThreadIDFind(def, iothread_id)) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("an IOThread is already using iothread_id '%u'"),
+ iothread_id);
+ return -1;
+ }
+
+ return 0;
+}
+
+
static int
qemuDomainDelIOThreadCheck(virDomainDefPtr def,
unsigned int iothread_id)
}
if (add) {
+ if (qemuDomainAddIOThreadCheck(def, iothread_id) < 0)
+ goto endjob;
+
if (qemuDomainHotplugAddIOThread(driver, vm, iothread_id) < 0)
goto endjob;
} else {
if (persistentDef) {
if (add) {
+ if (qemuDomainAddIOThreadCheck(persistentDef, iothread_id) < 0)
+ goto endjob;
+
if (!virDomainIOThreadIDAdd(persistentDef, iothread_id))
goto endjob;