Introduced in previous commit, QEMU driver needs to be taught how
to set VIR_DOMAIN_IOTHREAD_THREAD_POOL_MIN and
VIR_DOMAIN_IOTHREAD_THREAD_POOL_MAX parameters on given IOThread.
Fortunately, this is fairly trivial to do and since these two
parameters are exposed in domain XML too the update of inactive
XML can be wired up too.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_driver.c | 63 +++++++++++++++++++++++++++++++++---
src/qemu/qemu_monitor.h | 4 +++
src/qemu/qemu_monitor_json.c | 2 ++
3 files changed, 64 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fb63e6550f..d6f9fa99a8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5313,6 +5313,26 @@ qemuDomainHotplugModIOThread(virQEMUDriver *driver,
}
+static int
+qemuDomainHotplugModIOThreadIDDef(virDomainIOThreadIDDef *def,
+ qemuMonitorIOThreadInfo mondef)
+{
+ if (mondef.set_thread_pool_min)
+ def->pool_min = mondef.thread_pool_min;
+
+ if (mondef.set_thread_pool_max)
+ def->pool_max = mondef.thread_pool_max;
+
+ /* These have no representation in domain XML */
+ if (mondef.set_poll_grow ||
+ mondef.set_poll_max_ns ||
+ mondef.set_poll_shrink)
+ return -1;
+
+ return 0;
+}
+
+
static int
qemuDomainHotplugDelIOThread(virQEMUDriver *driver,
virDomainObj *vm,
@@ -5420,6 +5440,10 @@ qemuDomainIOThreadParseParams(virTypedParameterPtr params,
VIR_TYPED_PARAM_UINT,
VIR_DOMAIN_IOTHREAD_POLL_SHRINK,
VIR_TYPED_PARAM_UINT,
+ VIR_DOMAIN_IOTHREAD_THREAD_POOL_MIN,
+ VIR_TYPED_PARAM_LLONG,
+ VIR_DOMAIN_IOTHREAD_THREAD_POOL_MAX,
+ VIR_TYPED_PARAM_LLONG,
NULL) < 0)
return -1;
@@ -5444,6 +5468,20 @@ qemuDomainIOThreadParseParams(virTypedParameterPtr params,
if (rc == 1)
iothread->set_poll_shrink = true;
+ if ((rc = virTypedParamsGetLLong(params, nparams,
+ VIR_DOMAIN_IOTHREAD_THREAD_POOL_MIN,
+ &iothread->thread_pool_min)) < 0)
+ return -1;
+ if (rc == 1)
+ iothread->set_thread_pool_min = true;
+
+ if ((rc = virTypedParamsGetLLong(params, nparams,
+ VIR_DOMAIN_IOTHREAD_THREAD_POOL_MAX,
+ &iothread->thread_pool_max)) < 0)
+ return -1;
+ if (rc == 1)
+ iothread->set_thread_pool_max = true;
+
if (iothread->set_poll_max_ns && iothread->poll_max_ns > INT_MAX) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("poll-max-ns (%llu) must be less than or equal to
%d"),
@@ -5486,6 +5524,7 @@ qemuDomainChgIOThread(virQEMUDriver *driver,
qemuDomainObjPrivate *priv;
virDomainDef *def;
virDomainDef *persistentDef;
+ virDomainIOThreadIDDef *iothreaddef = NULL;
int ret = -1;
cfg = virQEMUDriverGetConfig(driver);
@@ -5525,7 +5564,9 @@ qemuDomainChgIOThread(virQEMUDriver *driver,
break;
case VIR_DOMAIN_IOTHREAD_ACTION_MOD:
- if (!(virDomainIOThreadIDFind(def, iothread.iothread_id))) {
+ iothreaddef = virDomainIOThreadIDFind(def, iothread.iothread_id);
+
+ if (!iothreaddef) {
virReportError(VIR_ERR_INVALID_ARG,
_("cannot find IOThread '%u' in
iothreadids"),
iothread.iothread_id);
@@ -5535,6 +5576,8 @@ qemuDomainChgIOThread(virQEMUDriver *driver,
if (qemuDomainHotplugModIOThread(driver, vm, iothread) < 0)
goto endjob;
+
+ qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread);
break;
}
@@ -5562,10 +5605,20 @@ qemuDomainChgIOThread(virQEMUDriver *driver,
break;
case VIR_DOMAIN_IOTHREAD_ACTION_MOD:
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
- _("configuring persistent polling values is "
- "not supported"));
- goto endjob;
+ iothreaddef = virDomainIOThreadIDFind(def, iothread.iothread_id);
+
+ if (!iothreaddef) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("cannot find IOThread '%u' in
iothreadids"),
+ iothread.iothread_id);
+ goto endjob;
+ }
+
+ if (qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread) < 0) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("configuring persistent polling values is not
supported"));
+ goto endjob;
+ }
break;
}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index be341d5196..6ce38ffe86 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1308,9 +1308,13 @@ struct _qemuMonitorIOThreadInfo {
unsigned long long poll_max_ns;
unsigned int poll_grow;
unsigned int poll_shrink;
+ long long thread_pool_min;
+ long long thread_pool_max;
bool set_poll_max_ns;
bool set_poll_grow;
bool set_poll_shrink;
+ bool set_thread_pool_min;
+ bool set_thread_pool_max;
};
int qemuMonitorGetIOThreads(qemuMonitor *mon,
qemuMonitorIOThreadInfo ***iothreads,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index dc05dfd047..e8fe1eceae 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -7431,6 +7431,8 @@ qemuMonitorJSONSetIOThread(qemuMonitor *mon,
VIR_IOTHREAD_SET_PROP("poll-max-ns", poll_max_ns);
VIR_IOTHREAD_SET_PROP("poll-grow", poll_grow);
VIR_IOTHREAD_SET_PROP("poll-shrink", poll_shrink);
+ VIR_IOTHREAD_SET_PROP("thread-pool-min", thread_pool_min);
+ VIR_IOTHREAD_SET_PROP("thread-pool-max", thread_pool_max);
#undef VIR_IOTHREAD_SET_PROP
--
2.35.1