From nobody Fri Oct 18 06:17:39 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 1721819055647393.20302425073726; Wed, 24 Jul 2024 04:04:15 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 8912FBF7; Wed, 24 Jul 2024 07:04:14 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id CD074BD5; Wed, 24 Jul 2024 07:03:56 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 58C5CA27; Wed, 24 Jul 2024 07:03:54 -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 F1FFFC84 for ; Wed, 24 Jul 2024 07:03:51 -0400 (EDT) Received: from mx-prod-mc-03.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-575-U1ITxSdZNyWD-aEV96xAMw-1; Wed, 24 Jul 2024 07:02:27 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 625811955D48 for ; Wed, 24 Jul 2024 11:02:26 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.45.225.102]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 61E4819560AE for ; Wed, 24 Jul 2024 11:02:25 +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=1721819031; 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=oCI8CPjb5hgKVS28VOBPoGLdpl4dS44cCHyNTWKunD4=; b=brtTht+ETivd5dl7K9plFX8xgBOT3CZLo4r9EFrrjxcTx/XcopV91JP6+KTuVfbXlBUgnF XBAKPiPtVKNOH77aqy2Yxw4IGS2ZGxGUQIJB8pmbbG3NLvhLxm991LXJzJCiC3VNTaIJJ6 9jRZm77CQ2AyS3IxoN9NteqHOAfO/JU= X-MC-Unique: U1ITxSdZNyWD-aEV96xAMw-1 From: Kristina Hanicova To: devel@lists.libvirt.org Subject: [PATCH] qemu_hotplug: Do not allow absent values in rom settings Date: Wed, 24 Jul 2024 13:02:15 +0200 Message-ID: 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: 34W4GR5VNTDXBHAKFC6M7FEL7LHQ5EMR X-Message-ID-Hash: 34W4GR5VNTDXBHAKFC6M7FEL7LHQ5EMR X-MailFrom: khanicov@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: 1721819056838116600 Content-Type: text/plain; charset="utf-8"; x-default="true" If there are absent values in an already existing element specifying rom settings, we simply use the old ones. This behaviour is not desired, as users might think that deleting the element from XML would delete the setting (because the hotplug succeeds) - which does not happen. Because of that, we should not accept an interface without elements that cannot be changed. Therefore, we should not allow absent values for already existing rom setting during hotplug. Resolves: https://issues.redhat.com/browse/RHEL-7109 Signed-off-by: Kristina Hanicova Reviewed-by: Michal Privoznik --- src/qemu/qemu_hotplug.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 1f4620d833..7f158ddcd5 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3838,16 +3838,12 @@ qemuDomainChangeNet(virQEMUDriver *driver, =20 /* device alias is checked already in virDomainDefCompatibleDevice */ =20 - if (newdev->info.rombar =3D=3D VIR_TRISTATE_SWITCH_ABSENT) - newdev->info.rombar =3D olddev->info.rombar; if (olddev->info.rombar !=3D newdev->info.rombar) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("cannot modify network device rom bar setting")); goto cleanup; } =20 - if (!newdev->info.romfile) - newdev->info.romfile =3D g_strdup(olddev->info.romfile); if (STRNEQ_NULLABLE(olddev->info.romfile, newdev->info.romfile)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("cannot modify network rom file")); @@ -3860,8 +3856,6 @@ qemuDomainChangeNet(virQEMUDriver *driver, goto cleanup; } =20 - if (newdev->info.romenabled =3D=3D VIR_TRISTATE_BOOL_ABSENT) - newdev->info.romenabled =3D olddev->info.romenabled; if (olddev->info.romenabled !=3D newdev->info.romenabled) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("cannot modify network device rom enabled setting= ")); --=20 2.45.1