Any modification of iothreads attribute is prohibit, the original setup must be identical with updated version of xml. Resolves: https://issues.redhat.com/browse/RHEL-23607 Signed-off-by: Adam Julis <ajulis@xxxxxxxxxx> --- src/qemu/qemu_domain.c | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1a90311ca5..6d7b939a31 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8484,6 +8484,53 @@ qemuDomainDiskChangeSupported(virDomainDiskDef *disk, CHECK_EQ(discard, "discard", true); CHECK_EQ(iothread, "iothread", true); + /* check if new or original disk contains iothreads information + * if yes, they must be identical, any changes are prohibit*/ + + if (!!disk->iothreads != !!orig_disk->iothreads) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("cannot modify field '%1$s' of the disk"), + "iothreads"); + return false; + } + + if (disk->iothreads && orig_disk->iothreads) { + GSList *n, *m; + + m = disk->iothreads; + + for (n = orig_disk->iothreads; n; n = n->next) { + size_t i; + virDomainDiskIothreadDef *n_data = (virDomainDiskIothreadDef *) n->data; + virDomainDiskIothreadDef *m_data = (virDomainDiskIothreadDef *) m->data; + + if (n_data->id != m_data->id || n_data->nqueues != m_data->nqueues) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("cannot modify field '%1$s' of the disk"), + "iothreads"); + return false; + } + + for (i = 0; i < n_data->nqueues; i++) { + if (n_data->queues[i] != m_data->queues[i]) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("cannot modify field '%1$s' of the disk"), + "iothreads"); + return false; + } + } + + m = m->next; + + if (!m && n->next) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("cannot modify field '%1$s' of the disk"), + "iothreads"); + return false; + } + } + } + CHECK_STREQ_NULLABLE(domain_name, "backenddomain"); -- 2.45.2