From nobody Mon Sep 16 19:24:17 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 1719387848420207.6378925273774; Wed, 26 Jun 2024 00:44:08 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 220B6136D; Wed, 26 Jun 2024 03:44:07 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 6A7191352; Wed, 26 Jun 2024 03:43:49 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 58556C33; Wed, 26 Jun 2024 03:43:44 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 DE1239F6 for ; Wed, 26 Jun 2024 03:43:43 -0400 (EDT) Received: from mx-prod-mc-04.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-592-ZJ4mtihQN4mlkfOCxSSNZg-1; Wed, 26 Jun 2024 03:43:41 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 00FEA19560B0 for ; Wed, 26 Jun 2024 07:43:41 +0000 (UTC) Received: from ajulis-thinkpadt14gen4.remote.csb (unknown [10.39.193.230]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 283141956087 for ; Wed, 26 Jun 2024 07:43:39 +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=3.0 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719387823; 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=qj/3TwD7kgz6aPTiSD9dcPtQqr5RHAX/qDhmkqBxb6g=; b=ETD64qP3OMAMkY8F9oz2t9GzGpb/tx1IW0vo6Mj0VX+gkDN6zl9rw01WO6Wy9SArcUx9Hg VnHkKak0nRsZQ5KQ0BNw/jBFvLdK7J7ZSmmxceNm1E8QBd0zZqx98ZH6Akv5VQbm3gMx4P MTURWrm75uPjwXeb6J53m+aJCz5OS8E= X-MC-Unique: ZJ4mtihQN4mlkfOCxSSNZg-1 From: Adam Julis To: devel@lists.libvirt.org Subject: [PATCH] qemuDomainDiskChangeSupported: Fill in missing check Date: Wed, 26 Jun 2024 09:43:28 +0200 Message-ID: <45ab7897e5db231c1723895c3c8253af02352036.1719387798.git.ajulis@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: WLENRRM72XQYSB4HSLZV4TAJ52VE3NGV X-Message-ID-Hash: WLENRRM72XQYSB4HSLZV4TAJ52VE3NGV 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: 1719387848975100001 Content-Type: text/plain; charset="utf-8"; x-default="true" 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 --- 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); =20 + /* check if new or original disk contains iothreads information + * if yes, they must be identical, any changes are prohibit*/ + + if (!!disk->iothreads !=3D !!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 =3D disk->iothreads; + + for (n =3D orig_disk->iothreads; n; n =3D n->next) { + size_t i; + virDomainDiskIothreadDef *n_data =3D (virDomainDiskIothreadDef= *) n->data; + virDomainDiskIothreadDef *m_data =3D (virDomainDiskIothreadDef= *) m->data; + + if (n_data->id !=3D m_data->id || n_data->nqueues !=3D m_data-= >nqueues) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("cannot modify field '%1$s' of the disk"), + "iothreads"); + return false; + } + + for (i =3D 0; i < n_data->nqueues; i++) { + if (n_data->queues[i] !=3D m_data->queues[i]) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("cannot modify field '%1$s' of the di= sk"), + "iothreads"); + return false; + } + } + + m =3D 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"); =20 --=20 2.45.2