From nobody Mon Sep 16 19:12:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1721983974650295.12181584879534; Fri, 26 Jul 2024 01:52:54 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id A00641173; Fri, 26 Jul 2024 04:52:53 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 02190110C; Fri, 26 Jul 2024 04:52:37 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 87DBDE78; Fri, 26 Jul 2024 04:52:33 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 11285DCF for ; Fri, 26 Jul 2024 04:52:33 -0400 (EDT) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-635-PgK819PBNAGBxk0mcPhDeQ-1; Fri, 26 Jul 2024 04:52:30 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2255E1955D4D for ; Fri, 26 Jul 2024 08:52:30 +0000 (UTC) Received: from ajulis-thinkpadt14gen4.remote.csb (unknown [10.43.2.246]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6FE9D19560AE for ; Fri, 26 Jul 2024 08:52:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721983952; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DXNOvWuA5/dz9nDYNXuz6Y5epPYw8avvLIhruRxsEqY=; b=J2MoXaDM79g6yTQ2rKPFDM9C32lhkDn6xn/VAbHXFbJY+IQ9JmoCUXUTYMxXUqXaNxlxI+ lD/Lut0gfjB12yqpJ8AVQq53bKX4QEoNmd2e/p1AzocLljRBvc/k9xn2JGUJJF4Mke/VQE ZifOc+3d6IQCyPiz3tiloAsolkS97qc= X-MC-Unique: PgK819PBNAGBxk0mcPhDeQ-1 From: Adam Julis To: devel@lists.libvirt.org Subject: [PATCH] qemuDomainDiskChangeSupported: Add missing iothreads check Date: Fri, 26 Jul 2024 10:52:18 +0200 Message-ID: <8f092a7f20fb2ea34807a73089d908667412fd5a.1721982565.git.ajulis@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: KXEXHWJXGMLKLI46YAHUQASXYD4W2S7B X-Message-ID-Hash: KXEXHWJXGMLKLI46YAHUQASXYD4W2S7B X-MailFrom: ajulis@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1721983976007116600 Content-Type: text/plain; charset="utf-8"; x-default="true" GSList of iothreads is not allowed to be changed while the virtual machine is running. Resolves: https://issues.redhat.com/browse/RHEL-23607 Signed-off-by: Adam Julis --- While the qemuDomainDiskChangeSupported() design primarily uses its macros (CHECK_EQ and CHECK_STREQ_NULLABLE), the logic for comparing 2 GSList of iothreads could perhaps be extracted into a separate function (e.g. IothreadsGslistCompare(GSList *first, GSList *second)). I am absolutely not sure about this idea so feel free to comment. src/qemu/qemu_domain.c | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 298f4bfb9e..2b5222c685 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8505,6 +8505,59 @@ qemuDomainDiskChangeSupported(virDomainDiskDef *disk, CHECK_EQ(discard, "discard", true); CHECK_EQ(iothread, "iothread", true); =20 + /* compare list of iothreads, no change allowed */ + if (orig_disk->iothreads !=3D disk->iothreads) { + GSList *old; + GSList *new =3D disk->iothreads; + bool print_err =3D true; + + for (old =3D orig_disk->iothreads; old; old =3D old->next) { + virDomainDiskIothreadDef *orig =3D old->data; + virDomainDiskIothreadDef *update; + print_err =3D false; + + if (new =3D=3D NULL) { + print_err =3D true; + break; + } + + update =3D new->data; + + if (orig->id !=3D update->id) { + print_err =3D true; + break; + } + + if (orig->nqueues !=3D update->nqueues) { + print_err =3D true; + break; + } + + if (orig->nqueues !=3D 0) { + ssize_t i =3D 0; + + while (i < orig->nqueues) { + if (orig->queues[i] !=3D update->queues[i]) { + print_err =3D true; + break; + } + } + } + + new =3D new->next; + if (new) + print_err =3D true; + } + + if (print_err) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("cannot modify field '%1$s' (or it's parts) o= f the disk"), + "iothreads"); + return false; + } + } + + CHECK_STREQ_NULLABLE(domain_name, "backenddomain"); =20 --=20 2.45.2