From nobody Mon Sep 8 21:40:31 2025 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=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1748246310; cv=none; d=zohomail.com; s=zohoarc; b=NGy9ODr8kBLc5AZB46d24VPis3+Ojfs/ZecF6YDx1eWB2OIXtk2STSJqgYOWl+NhOC3dXREUQ0EB8LR7FZhhW4BM+ZQvJlfbz52HpzVpisVD0701KASilNg6QHZPgasHzHXyCwPOYJgMQHHIQxZMWjPuYiZ7AVZ1W4Qt3CIvcuU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748246310; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=idE+mEbaQXL4uTrg7FKBkQIJPfM4LL9wBgUgEaL03AA=; b=Xn3kqji84MLeqFyi801b+QvzSJdK4Kb/jsF2u5oNBcjsi2TZ+N5suNQ6/U2wTkvrm0fO8jyJD2KacvoMCr2isdLfUWtBdzx4cLvNcWeUFDQf1zcBQ84v6l1bWwLJr7OLZoidLKQNci3Fp5tZs/P9VtJvLulGuD07JqEP52FwHso= ARC-Authentication-Results: i=1; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1748246310488466.7874592489725; Mon, 26 May 2025 00:58:30 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 8162017C3; Mon, 26 May 2025 03:58:29 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id E184814D7; Mon, 26 May 2025 03:57:38 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 429711443; Mon, 26 May 2025 03:57:34 -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 BA2BD1443 for ; Mon, 26 May 2025 03:57: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-495-HBkI9WQBN_CwIh7GzHoIPQ-1; Mon, 26 May 2025 03:57:31 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 9EFEE19560AD for ; Mon, 26 May 2025 07:57:30 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.3]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B6807195608D for ; Mon, 26 May 2025 07:57: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, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,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=1748246253; 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: in-reply-to:in-reply-to:references:references; bh=laOYGpXTBnayh0mMy+wB3ZdhcusTq8egwTLQ+rIOaCs=; b=TWgyfgyO1hC939hGYEhRkG0NGuAQhTaCf5YKMjaeGGSXy0u4pRImN8v6mDeo7yL1hnXyTc YVbEVgFeI2KbtJD7FMKGkBB0lDQWyJrijN9C1nUbxisGqT8OnUcygdeoob38HtoC8S88JQ 81CawIHo8RT+haplfeD6OaEB9sOeNGA= X-MC-Unique: HBkI9WQBN_CwIh7GzHoIPQ-1 X-Mimecast-MFC-AGG-ID: HBkI9WQBN_CwIh7GzHoIPQ_1748246250 To: devel@lists.libvirt.org Subject: [PATCH 1/4] qemu: domain: Introduce qemuDomainMachineSupportsFloppy Date: Mon, 26 May 2025 09:57:23 +0200 Message-ID: <9bcac0ea22e07d572fd0163e464923dc0a976088.1748246185.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: OcxXObyEAMfxfUN1BwTzQ7vPTaoXqBofORm5WevOgzQ_1748246250 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 5FRWIXPCO7BYTT35BCRSLNPMI53NOFDE X-Message-ID-Hash: 5FRWIXPCO7BYTT35BCRSLNPMI53NOFDE X-MailFrom: pkrempa@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: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1748246313099116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Add a helper that will collect the logic for determinin whether a VM supports floppy disks. Use it in the capabilities code and when validating the VM definition at startup. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 3 +-- src/qemu/qemu_domain.c | 12 ++++++++++++ src/qemu/qemu_domain.h | 4 ++++ src/qemu/qemu_process.c | 5 ++--- .../disk-floppy-pseries.ppc64-latest.err | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b600dd38b8..19716497d8 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -6450,8 +6450,7 @@ virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCaps *qemu= Caps, VIR_DOMAIN_DISK_DEVICE_CDROM, VIR_DOMAIN_DISK_DEVICE_LUN); - /* PowerPC pseries based VMs do not support floppy device */ - if (!qemuDomainMachineIsPSeries(machine, qemuCaps->arch)) { + if (qemuDomainMachineSupportsFloppy(machine, qemuCaps)) { VIR_DOMAIN_CAPS_ENUM_SET(disk->diskDevice, VIR_DOMAIN_DISK_DEVICE_= FLOPPY); VIR_DOMAIN_CAPS_ENUM_SET(disk->bus, VIR_DOMAIN_DISK_BUS_FDC); } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a7e4198316..7a308d488b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11525,3 +11525,15 @@ qemuDomainCheckCPU(virArch arch, return virCPUCompareUnusable(arch, hypervisorCPU, cpu, blockers, failIncompatible); } + + +bool +qemuDomainMachineSupportsFloppy(const char *machine, + virQEMUCaps *qemuCaps) +{ + /* PowerPC pseries based VMs do not support floppy device */ + if (qemuDomainMachineIsPSeries(machine, virQEMUCapsGetArch(qemuCaps))) + return false; + + return true; +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index ee6074c9f6..c7287eb669 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1167,3 +1167,7 @@ qemuDomainCheckCPU(virArch arch, virCPUDef *cpu, virQEMUCapsHostCPUType compatCPU, bool failIncompatible); + +bool +qemuDomainMachineSupportsFloppy(const char *machine, + virQEMUCaps *qemuCaps); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 04e5c005a0..7e444bb8b4 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5620,11 +5620,10 @@ qemuProcessStartValidateDisks(virDomainObj *vm, return -1; } - /* PowerPC pseries based VMs do not support floppy device */ if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_FLOPPY && - qemuDomainIsPSeries(vm->def)) { + !qemuDomainMachineSupportsFloppy(vm->def->os.machine, qemuCaps= )) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("PowerPC pseries machines do not support flop= py device")); + _("this machine type do not support floppy devi= ces")); return -1; } diff --git a/tests/qemuxmlconfdata/disk-floppy-pseries.ppc64-latest.err b/t= ests/qemuxmlconfdata/disk-floppy-pseries.ppc64-latest.err index b4b580a684..e00287728d 100644 --- a/tests/qemuxmlconfdata/disk-floppy-pseries.ppc64-latest.err +++ b/tests/qemuxmlconfdata/disk-floppy-pseries.ppc64-latest.err @@ -1 +1 @@ -unsupported configuration: PowerPC pseries machines do not support floppy = device +unsupported configuration: this machine type do not support floppy devices --=20 2.49.0 From nobody Mon Sep 8 21:40:31 2025 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=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1748246336; cv=none; d=zohomail.com; s=zohoarc; b=B5DFcikZBGPnR3HB2c3omqXqnZJO4sobFyjDP3SAfF4wTEgHqpPhTRuSpzWA1OELasMN2YpowfRCzuoYANr9BMnCwRfB0nE10XEIJBrLmtNiuI1dvZ6cjx09pCsQXudO8TO7CqqA+3k9V/TxQiJ2Yne/FsMAuSbp9RDhfZQaxW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748246336; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=EcXGcpSOQoMjDM3qFnxtNH3LA4fwREbOchZFBoIOvF8=; b=L7Ep32CPQLfnGUNZmL3YMB4rZp0GB5Zx2X1IkDhiojUski2mP8cAWUdMUw2eYjhFcngffLq95ujQ670pqYtnaJOKsJ259YEWamEMq1wjwwg6g4nIsqtkWP6F9E2pvRk8EV6lQicVs+tvCXdQTh3AOExmVho/uefSyH3LTxcM2Ls= ARC-Authentication-Results: i=1; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1748246336820517.3221211897659; Mon, 26 May 2025 00:58:56 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id DE8A21635; Mon, 26 May 2025 03:58:55 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2E4A8173E; Mon, 26 May 2025 03:57:41 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id BF41E13B4; Mon, 26 May 2025 03:57:34 -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 3E447147D for ; Mon, 26 May 2025 03:57:34 -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-47-vIo9q3cBO86FcMnFfM-iSA-1; Mon, 26 May 2025 03:57:32 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 9EDD019560A1 for ; Mon, 26 May 2025 07:57:31 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.3]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E1DC6195608D for ; Mon, 26 May 2025 07:57:30 +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, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,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=1748246254; 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: in-reply-to:in-reply-to:references:references; bh=irGPuSqPSodIJWUaNKfqm4hN8LBKI1yp6uFi923WjQE=; b=FNIAGpK6t8Xpx/7HDkl2JnLKkzyoY/s25Z7q+5gG4lVKr4dgs+2TUuy3AJbSgo5ESeW36e OTfk1y0fLUyW6o8XjMdDxtM9eQvvSS+1RvO6QE40rg76eK9Oh4cpsau26mOXiWEPsQX5Sm ncRHh0SSesoWIuyOyYjQuTeWrBmBm5s= X-MC-Unique: vIo9q3cBO86FcMnFfM-iSA-1 X-Mimecast-MFC-AGG-ID: vIo9q3cBO86FcMnFfM-iSA_1748246251 To: devel@lists.libvirt.org Subject: [PATCH 2/4] qemu: Move floppy device support validation to validation code Date: Mon, 26 May 2025 09:57:24 +0200 Message-ID: <001ad864011b954e645cc72783d9d5b18dc2d225.1748246185.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: iVc14GHF_EgIMx7wFKt2SbYoeZnUc5M6XR8ROUkHAZM_1748246251 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: HGDMSHMDDEFZ4DJXF3KPP5RJGMK2JRNX X-Message-ID-Hash: HGDMSHMDDEFZ4DJXF3KPP5RJGMK2JRNX X-MailFrom: pkrempa@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: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1748246337355116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Move the validation from qemuProcessStartValidateDisks to qemuValidateDomainDeviceDefDiskFrontend and adjust the test case which now fails a bit earlier, thus no output XML is needed. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_process.c | 7 --- src/qemu/qemu_validate.c | 7 +++ .../disk-floppy-pseries.ppc64-latest.xml | 44 ------------------- tests/qemuxmlconftest.c | 2 +- 4 files changed, 8 insertions(+), 52 deletions(-) delete mode 100644 tests/qemuxmlconfdata/disk-floppy-pseries.ppc64-latest.= xml diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 7e444bb8b4..54b84922d6 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5620,13 +5620,6 @@ qemuProcessStartValidateDisks(virDomainObj *vm, return -1; } - if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_FLOPPY && - !qemuDomainMachineSupportsFloppy(vm->def->os.machine, qemuCaps= )) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this machine type do not support floppy devi= ces")); - return -1; - } - if (src->type =3D=3D VIR_STORAGE_TYPE_NVME && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_NVME)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 87588024ce..e45f636418 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3008,6 +3008,13 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDom= ainDiskDef *disk, return -1; } + if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_FLOPPY && + !qemuDomainMachineSupportsFloppy(def->os.machine, qemuCaps)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this machine type do not support floppy devices"= )); + return -1; + } + if (disk->copy_on_read =3D=3D VIR_TRISTATE_SWITCH_ON) { if (disk->src->readonly) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, diff --git a/tests/qemuxmlconfdata/disk-floppy-pseries.ppc64-latest.xml b/t= ests/qemuxmlconfdata/disk-floppy-pseries.ppc64-latest.xml deleted file mode 100644 index 9a5490c9fe..0000000000 --- a/tests/qemuxmlconfdata/disk-floppy-pseries.ppc64-latest.xml +++ /dev/null @@ -1,44 +0,0 @@ - - QEMUGuest1 - c7a5fdbd-edaf-9455-926a-d65c16db1809 - 219136 - 219136 - 1 - - hvm - - - - POWER10 - - - destroy - restart - destroy - - /usr/bin/qemu-system-ppc64 - - - - -
- - - - - -
- - -
- - - - - - -