From nobody Thu Mar 28 15:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634037164; cv=none; d=zohomail.com; s=zohoarc; b=N2rlyyv2STpK5vdFYSYIhWa7w0yj2NduqRnRudB1ExFIs/L19dBr67jo8FtcFTxb+3aWJZpmCr87fOyEv4mDepD/fbJsDKPMj8492qDVV16zHPwHDgqdqjkt2oLOH/NJ2b1vXVHXiUwDYO3Kx6fI3bRpTKe4aKof/4EXNGjC3o0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037164; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AuAVc/7JBKIvQtE6crVBFnnPcuwXYbhschv3lXG9NTk=; b=YKvwgROH+DWj3ezgCNUynCoxGV8etdJJHgQSM3gQxEQQzcUAzwdBNY10cgQXHqyoFQSgaHRampdOw/0z5e/ATeXUCSiXImfzKcW5+Lj1xgupmNHI9UdbPlmZ8pwL+HynKK8PYx7mzNGquT3vIS5IcR8YhN7MMZAcgSh2VrXP5Ts= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634037164261532.604130738435; Tue, 12 Oct 2021 04:12:44 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-393-5p4H1qJgMe2gUfApzGzQtw-1; Tue, 12 Oct 2021 07:12:39 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2A4B110A8E01; Tue, 12 Oct 2021 11:12:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D6FEE19E7E; Tue, 12 Oct 2021 11:12:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6D5B94E58F; Tue, 12 Oct 2021 11:12:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBCUbu008212 for ; Tue, 12 Oct 2021 07:12:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id D5C2F5D9D5; Tue, 12 Oct 2021 11:12:30 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44D4E5D9F0 for ; Tue, 12 Oct 2021 11:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037163; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=AuAVc/7JBKIvQtE6crVBFnnPcuwXYbhschv3lXG9NTk=; b=ACDtlVz0+8LknybjLXAu5YLsevuHQmGNAX1HmOZIRaD8wrSTAS6KNFqlshoYLHa2TpeASk AGtL+OHPdEf5HxCXqkYkTcpGHYHYnt8Ed5Sa8tMcBzcv/Vu0LFkgRhkaiaT1chlwTZEhyC FTF52GDSCwkfuhDUxO91W3ofB9ES8CY= X-MC-Unique: 5p4H1qJgMe2gUfApzGzQtw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/14] qemuBuildStorageSourceAttachPrepareDrive: Fix function comment Date: Tue, 12 Oct 2021 13:12:07 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634037165987100002 Content-Type: text/plain; charset="utf-8" Remove mention of argument which no longer exists. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index cc8fd68680..ade82eef22 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -11063,7 +11063,6 @@ qemuBuildHotpluggableCPUProps(const virDomainVcpuDe= f *vcpu) * qemuBuildStorageSourceAttachPrepareDrive: * @disk: disk object to prepare * @qemuCaps: qemu capabilities object - * @driveBoot: bootable flag for disks which don't have -device part * * Prepare qemuBlockStorageSourceAttachData *for use with the old approach * using -drive/drive_add. See qemuBlockStorageSourceAttachPrepareBlockdev. --=20 2.31.1 From nobody Thu Mar 28 15:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634037172; cv=none; d=zohomail.com; s=zohoarc; b=eo8Wa1lA7qOL+Igb8GV5b1L/gQZ/L2NXssFyqUILAPR2mId4VtsLh30TTDslUQgGUtOHXPriMryIZN+w4smsGq5UtvStRU86CK3uCkzyUn+qv6kIogHME7wq85DXgsAay8YMyEZgByY0Ia9j1Fi/JxpPaL7XqQ35G5nDWLwhZF8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037172; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vHKOJDBJd/GL0EQL2bs3gC0vnuo2Hog7EJJER4bRRK8=; b=lW66+Lbw5RW/03mqYpPlEvQrbO0EgG44eaRjYu1PkC0j1Hy9mrjBoLLXzyPOr85yg2cKP1qJNPLRdvtgQTYJbEMsmwOdWgk8AO1Yj5JiUjcaRIsouanf8YmYmwlV4kZE8Y2b1CQNKRXD5RzB8YQvx/f3cxbMHavlQzb7hpxQtIw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634037172694354.13394547196776; Tue, 12 Oct 2021 04:12:52 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-257-mE_iRA2POI-UhTLf94rR9A-1; Tue, 12 Oct 2021 07:12:50 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2060D1006AA5; Tue, 12 Oct 2021 11:12:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 003895E268; Tue, 12 Oct 2021 11:12:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C03C51806D04; Tue, 12 Oct 2021 11:12:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBCVTv008217 for ; Tue, 12 Oct 2021 07:12:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id EEB0B5D9F0; Tue, 12 Oct 2021 11:12:31 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F1EA5D9D5 for ; Tue, 12 Oct 2021 11:12:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037171; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=vHKOJDBJd/GL0EQL2bs3gC0vnuo2Hog7EJJER4bRRK8=; b=ACh+9dRR46IQiLmegd18D2C8ZrPfawphTU2Pt5gLYBAi/mlqOmKym90PBCuh0fH3CBv5uh hEA1P+SJq5QA040pVkY+0XOJfCTLIxmlpLM4PIsVR5AceZFyEI6ZeAhkHo84tIVbbegaxh df5G9BlzP1A938roimmNC2JvhSP3Nrc= X-MC-Unique: mE_iRA2POI-UhTLf94rR9A-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/14] qemuBuildDeviceCommandlineFromJSON: Remove unused keyword Date: Tue, 12 Oct 2021 13:12:08 +0200 Message-Id: <91e7bfd6684ab4bad65b27ff558167543c93064e.1634037045.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634037174721100001 Content-Type: text/plain; charset="utf-8" Now that the code was converted to use this helper we can remove it. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ade82eef22..fae2d1569c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -221,7 +221,7 @@ qemuBuildNetdevCommandlineFromJSON(virCommand *cmd, } -static G_GNUC_UNUSED int +static int qemuBuildDeviceCommandlineFromJSON(virCommand *cmd, virJSONValue *props, virQEMUCaps *qemuCaps) --=20 2.31.1 From nobody Thu Mar 28 15:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634037163; cv=none; d=zohomail.com; s=zohoarc; b=KO7jkdFOJMDrwp3uwqDUDQ5fhrspURSFVVjP3yyBYwylNVt+5IFiw+8Mmmqrj+j3q6USvaybun3kf1KiSv2ZnHAuWTcoTpkps3onZCq+VIPw9qLWBfJg1P0kU+1QYqObU2z6nt55rq5yJFPWO/0g05K2tagRTk6ziRFihdCNA/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037163; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Rxrn7iO769uSg5OzID+6zVKOhACkXvE+JsLZwmgXmW4=; b=PK2dWBCcFLBwUySbmi2ogGUTxY14YWcjXtudsvZiLTfNl9AC3v65OSDncgxbnnMy2+IICR1UveHSX9DO4p5h8BZTieF/vxvkvaNkoU97l/0xcquBYvflsTvCWFgu9CnX5NgQ0b7nEO8nqT7vU+LINmNQ1k2fm5Im3BIjakeKpVU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634037163695807.2429490352544; Tue, 12 Oct 2021 04:12:43 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459-2y5kaq5hPAe0Bm8EKSmbwQ-1; Tue, 12 Oct 2021 07:12:41 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D370E10A8E0E; Tue, 12 Oct 2021 11:12:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9CD0369C83; Tue, 12 Oct 2021 11:12:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 63BF71806D00; Tue, 12 Oct 2021 11:12:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBCX9U008227 for ; Tue, 12 Oct 2021 07:12:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5C08F5D9F4; Tue, 12 Oct 2021 11:12:33 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0EC65D9F0 for ; Tue, 12 Oct 2021 11:12:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037162; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Rxrn7iO769uSg5OzID+6zVKOhACkXvE+JsLZwmgXmW4=; b=JnQMntBbYmQGte0NkLS14+4h/ezRnpcHysEhFvJt3gHAwyIdXq9afwCsVpqKmBCPEkySlH N5ZqJgXedsdup/j2qmfm8BzeYR0x4Dsk1zLKnJnnocHejqViYj6Gfa2EOKNCmG6g3Zf8ez 6/3VTPv8eSdav+Ygot1HBNJ3GcQAAN8= X-MC-Unique: 2y5kaq5hPAe0Bm8EKSmbwQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/14] qemuValidateDomainSmartcardDef: Unbreak error messages Date: Tue, 12 Oct 2021 13:12:09 +0200 Message-Id: <9a509617775b15ccbc483b172aaab3c91d4aca0d.1634037045.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634037165915100001 Content-Type: text/plain; charset="utf-8" https://www.libvirt.org/coding-style.html#error-message-format Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_validate.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 0e7684973e..5973f019d2 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2093,8 +2093,7 @@ qemuValidateDomainSmartcardDef(const virDomainSmartca= rdDef *def, case VIR_DOMAIN_SMARTCARD_TYPE_HOST: if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCID_EMULATED)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU binary lacks smartcard host " - "mode support")); + _("this QEMU binary lacks smartcard host mode s= upport")); return -1; } break; @@ -2102,8 +2101,7 @@ qemuValidateDomainSmartcardDef(const virDomainSmartca= rdDef *def, case VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES: if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCID_EMULATED)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU binary lacks smartcard host " - "mode support")); + _("this QEMU binary lacks smartcard host mode s= upport")); return -1; } break; @@ -2111,8 +2109,7 @@ qemuValidateDomainSmartcardDef(const virDomainSmartca= rdDef *def, case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH: if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCID_PASSTHRU)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU binary lacks smartcard " - "passthrough mode support")); + _("this QEMU binary lacks smartcard passthrough= mode support")); return -1; } break; --=20 2.31.1 From nobody Thu Mar 28 15:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634037239; cv=none; d=zohomail.com; s=zohoarc; b=VgOZ9VRkE1yHjTYQSdw+1k7NypWpdxo3KHYl+iMj1AV9JVuTimF0GinsuZuRXuvgQef8TzrdXcKI45ZWD0vzoQMjG+BADP1WUooiFG1tUXg9k0V0sx/KPqdmOXT3haYFcioPDm87O2Ye9z5jKLryEHm3JI+2ft6C7QxjwEzlH+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037239; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+cWBYRFIFhr7y0BVtGjkQYqWj38uorfqTpagvmn4dSE=; b=SVqtZbRGGbE+ObHus4WxOmsAOA9/vyYLiAm5nF9LI6l0QElJxybJL3V/jBro74B+YjdA1aJjuwhjw4eNviWls4TLEfT5Dx+IertcnyokPxtP6BXyuY3y9qEH3PFLlPUzWvaqbGjI00cCPnONoSKPm6Me+JseXczziVmRD0oZL7Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634037239017567.1201751888567; Tue, 12 Oct 2021 04:13:59 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-203-WfF90BC1NbCzLDnBOlWplg-1; Tue, 12 Oct 2021 07:12:50 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4FF9E801AE3; Tue, 12 Oct 2021 11:12:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0802E6911C; Tue, 12 Oct 2021 11:12:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C24274EA29; Tue, 12 Oct 2021 11:12:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBCaFi008244 for ; Tue, 12 Oct 2021 07:12:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6423A5D9F0; Tue, 12 Oct 2021 11:12:36 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id C023E5D9F4 for ; Tue, 12 Oct 2021 11:12:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037238; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=+cWBYRFIFhr7y0BVtGjkQYqWj38uorfqTpagvmn4dSE=; b=CmyN6cg+tAkl4/KoMWjlNbx6uwzfA4xUZQyRPUGJsUFpyjEtd1fm9fwofWYsFb1NQgpdLV mbm/9C8dVwOM+kbtb4jknMLPMc14D6w5wW/eV8BekTkOYhJ5ns7oV2XTXIZ8ncAM8Biz8G 0w1xF3U2/u4lBzDxwXrXn3Dm+IB/Dh4= X-MC-Unique: WfF90BC1NbCzLDnBOlWplg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/14] qemuValidateDomainSmartcardDef: Move chardev validation under VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH Date: Tue, 12 Oct 2021 13:12:10 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634037239601100001 Content-Type: text/plain; charset="utf-8" Don't check the type twice, move the chardev validation into the switch. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_validate.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 5973f019d2..9865e29637 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2112,6 +2112,9 @@ qemuValidateDomainSmartcardDef(const virDomainSmartca= rdDef *def, _("this QEMU binary lacks smartcard passthrough= mode support")); return -1; } + + if (qemuValidateDomainChrSourceDef(def->data.passthru, qemuCaps) <= 0) + return -1; break; default: @@ -2119,10 +2122,6 @@ qemuValidateDomainSmartcardDef(const virDomainSmartc= ardDef *def, return -1; } - if (def->type =3D=3D VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH && - qemuValidateDomainChrSourceDef(def->data.passthru, qemuCaps) < 0) - return -1; - return 0; } --=20 2.31.1 From nobody Thu Mar 28 15:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634037176; cv=none; d=zohomail.com; s=zohoarc; b=YNaIwhg2LWdKWmfHJHUJBYX8wmISRTrLIdDSzQX/Na2wbVdCKuiqE24HAwg+KZUW2C4yFPf+KpJ5RbGjZd0Rxo/wi/F7Veq05Rer05JYbrp5eTBv+7n/uR386lZOOpkOMNwAOnjVaWp/pwd08cjQp3La/xrpSckS1f0Xq2PLcWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037176; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wgBfzRywsSUpC1jNYO88ksqbrE/OkwiAXbXYiUFawUE=; b=exZ7tUmvq1PY09Wk9tx/uMT2umsAKS/n1+UAwvvPi2wrQvHxVLhPmQm75UM5keGMMKLShfzI2ZgszlEeMaGPNsCVFf8UhW6wXxpgduzcovKh4tWZUZfofP1ULtc3jus/AfM0t1OgvvQK/tRNuRYnhG36GL9oF7iyMa1ojks+14A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 163403717599016.71677468075825; Tue, 12 Oct 2021 04:12:55 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-228-zPkZeSHsNwmsyacOj3XEbA-1; Tue, 12 Oct 2021 07:12:53 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C9AF5801AFC; Tue, 12 Oct 2021 11:12:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AA61B60C5F; Tue, 12 Oct 2021 11:12:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7D3461818480; Tue, 12 Oct 2021 11:12:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBCfp9008258 for ; Tue, 12 Oct 2021 07:12:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5C5C7ADCA; Tue, 12 Oct 2021 11:12:41 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id C03DA5E267 for ; Tue, 12 Oct 2021 11:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037174; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wgBfzRywsSUpC1jNYO88ksqbrE/OkwiAXbXYiUFawUE=; b=D2bGgWNEYHIejlZzTikBRZqnCpAAUWJwqzbW92mKebbK4xbKzxikXz2rawcxRH/nJ+VZGX cL4dQz9ruv/0CYluezaZ34cE/qdongsIUaCjyC/qWccd9dAw7GZqj2GicN9A7Hzlc38xlc e7XlK7N9RqKFjFM3P0yYpUEI2UaPdHE= X-MC-Unique: zPkZeSHsNwmsyacOj3XEbA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/14] virDomainSmartcardDef: Declare 'type' as virDomainSmartcardType Date: Tue, 12 Oct 2021 13:12:11 +0200 Message-Id: <6ce568436b3f9a9de8a383f3ff4b6f2eccd3fc3d.1634037045.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634037178122100001 Content-Type: text/plain; charset="utf-8" Use 'virXMLPropEnum' to parse it and fix all switch statements which didn't include the VIR_DOMAIN_SMARTCARD_TYPE_LAST case. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 23 +++++++---------------- src/conf/domain_conf.h | 2 +- src/qemu/qemu_command.c | 1 + src/qemu/qemu_validate.c | 1 + src/security/security_selinux.c | 10 ++++------ 5 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4799070bc4..aeb64c9c83 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2884,6 +2884,7 @@ void virDomainSmartcardDefFree(virDomainSmartcardDef = *def) virObjectUnref(def->data.passthru); break; + case VIR_DOMAIN_SMARTCARD_TYPE_LAST: default: break; } @@ -11602,7 +11603,6 @@ virDomainSmartcardDefParseXML(virDomainXMLOption *x= mlopt, unsigned int flags) { g_autoptr(virDomainSmartcardDef) def =3D NULL; - g_autofree char *mode =3D NULL; g_autofree char *type =3D NULL; g_autofree xmlNodePtr *certificates =3D NULL; int n =3D 0; @@ -11611,18 +11611,9 @@ virDomainSmartcardDefParseXML(virDomainXMLOption *= xmlopt, ctxt->node =3D node; def =3D g_new0(virDomainSmartcardDef, 1); - mode =3D virXMLPropString(node, "mode"); - if (mode =3D=3D NULL) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing smartcard device mode")); - return NULL; - } - if ((def->type =3D virDomainSmartcardTypeFromString(mode)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown smartcard device mode: %s"), - mode); + if (virXMLPropEnum(node, "mode", virDomainSmartcardTypeFromString, + VIR_XML_PROP_REQUIRED, &def->type) < 0) return NULL; - } switch (def->type) { case VIR_DOMAIN_SMARTCARD_TYPE_HOST: @@ -11687,9 +11678,9 @@ virDomainSmartcardDefParseXML(virDomainXMLOption *x= mlopt, break; + case VIR_DOMAIN_SMARTCARD_TYPE_LAST: default: - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("unknown smartcard mode")); + virReportEnumRangeError(virDomainSmartcardType, def->type); return NULL; } @@ -25406,9 +25397,9 @@ virDomainSmartcardDefFormat(virBuffer *buf, virDomainChrSourceDefFormat(&childBuf, def->data.passthru, flags); break; + case VIR_DOMAIN_SMARTCARD_TYPE_LAST: default: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected smartcard type %d"), def->type); + virReportEnumRangeError(virDomainSmartcardType, def->type); return -1; } virDomainDeviceInfoFormat(&childBuf, &def->info, flags); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index c1871b1757..55be01bbcf 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1320,7 +1320,7 @@ typedef enum { #define VIR_DOMAIN_SMARTCARD_DEFAULT_DATABASE "/etc/pki/nssdb" struct _virDomainSmartcardDef { - int type; /* virDomainSmartcardType */ + virDomainSmartcardType type; union { /* no extra data for 'host' */ struct { diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index fae2d1569c..2d7a6ebde7 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9146,6 +9146,7 @@ qemuBuildSmartcardCommandLine(virLogManager *logManag= er, smartcard->info.alias); break; + case VIR_DOMAIN_SMARTCARD_TYPE_LAST: default: virReportEnumRangeError(virDomainSmartcardType, smartcard->type); return -1; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 9865e29637..48d5c172c5 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2117,6 +2117,7 @@ qemuValidateDomainSmartcardDef(const virDomainSmartca= rdDef *def, return -1; break; + case VIR_DOMAIN_SMARTCARD_TYPE_LAST: default: virReportEnumRangeError(virDomainSmartcardType, def->type); return -1; diff --git a/src/security/security_selinux.c b/src/security/security_selinu= x.c index cc72453329..622a8f4c02 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -2696,10 +2696,9 @@ virSecuritySELinuxRestoreSecuritySmartcardCallback(v= irDomainDef *def, return virSecuritySELinuxRestoreChardevLabel(mgr, def, dev->data.passthru, f= alse); + case VIR_DOMAIN_SMARTCARD_TYPE_LAST: default: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown smartcard type %d"), - dev->type); + virReportEnumRangeError(virDomainSmartcardType, dev->type); return -1; } @@ -3103,10 +3102,9 @@ virSecuritySELinuxSetSecuritySmartcardCallback(virDo= mainDef *def, return virSecuritySELinuxSetChardevLabel(mgr, def, dev->data.passthru, false= ); + case VIR_DOMAIN_SMARTCARD_TYPE_LAST: default: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown smartcard type %d"), - dev->type); + virReportEnumRangeError(virDomainSmartcardType, dev->type); return -1; } --=20 2.31.1 From nobody Thu Mar 28 15:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634037258; cv=none; d=zohomail.com; s=zohoarc; b=bPnxLaFZ61p1ijO6ON0xrOhcFmd1v00G+BzzL0pYVmpodpZ+ZWOC6kvXnx7QqqSwqmqP7fwBEN8LpdpraNJoNt/mnZc7O4p/bzpjL3gnw5bWqV90ZRpPpMQ8qnVRf74WKsqv2VdpsJp0lUpb1FK3kWgkdDWZrqQ1In9r6VNSntQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037258; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wfj6HLHv0FFfkiDJtjMLLrW9oPrcurzXUENsXubz1WA=; b=CNYJxSUbDGGOMMLlSuDzLqLFB+kFvCI8RYPWwwXpHuwLVVDS0M3cpQbvJI6xfe1pRJfeYji8lBg0Va3X3ErwqbBynSBSirppbd4rFOFgvN+RvxOLy0ljOmECpnTE985KD3s8YLE23cVr1JiLpTm4EITb7CxnSjlgCJVGYpcZOVE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634037258610494.72623630366536; Tue, 12 Oct 2021 04:14:18 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-238-ie9o93f3NnqPyQPzuYtnbA-1; Tue, 12 Oct 2021 07:12:53 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 663F080158D; Tue, 12 Oct 2021 11:12:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4AC3B5F4F6; Tue, 12 Oct 2021 11:12:48 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1E876181A1D0; Tue, 12 Oct 2021 11:12:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBCkGL008270 for ; Tue, 12 Oct 2021 07:12:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 653DEADCB; Tue, 12 Oct 2021 11:12:46 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4344ADCA for ; Tue, 12 Oct 2021 11:12:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037257; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wfj6HLHv0FFfkiDJtjMLLrW9oPrcurzXUENsXubz1WA=; b=PJ7dFPtpZsg6clIjQiMm0bBOo3ISFvkCV4vjzy+i+i/1FXT10Np5tbkGXHUAQYKEd/N0Iv bhGUsgqpuF8089KSEFWWbAYWX/IUbN46xPSkviRSv2Y9uQWVmqE5DeYLHj9QMDIpgyQEvo U2nCiVMv8Y7RCdmMi1F7YgUPy9H4Oxc= X-MC-Unique: ie9o93f3NnqPyQPzuYtnbA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/14] qemuBuildSmartcardCommandLine: Replace qemuBuildSmartcardFindCCIDController Date: Tue, 12 Oct 2021 13:12:12 +0200 Message-Id: <7a2cc76b120dc54acf109f32663fa4615987f097.1634037045.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634037260387100001 Content-Type: text/plain; charset="utf-8" We have a commonly used helper virDomainControllerAliasFind, which does the same thing and also reports errors internally. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2d7a6ebde7..e41c7dfaaa 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9048,32 +9048,6 @@ qemuBuildNetCommandLine(virQEMUDriver *driver, } -static const char * -qemuBuildSmartcardFindCCIDController(const virDomainDef *def, - const virDomainSmartcardDef *smartcar= d) -{ - size_t i; - - /* Should never happen. But doesn't hurt to check. */ - if (smartcard->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID) - return NULL; - - for (i =3D 0; i < def->ncontrollers; i++) { - const virDomainControllerDef *tmp =3D def->controllers[i]; - - if (tmp->type !=3D VIR_DOMAIN_CONTROLLER_TYPE_CCID) - continue; - - if (tmp->idx !=3D smartcard->info.addr.ccid.controller) - continue; - - return tmp->info.alias; - } - - return NULL; -} - - static int qemuBuildSmartcardCommandLine(virLogManager *logManager, virSecurityManager *secManager, @@ -9152,13 +9126,10 @@ qemuBuildSmartcardCommandLine(virLogManager *logMan= ager, return -1; } - if (!(contAlias =3D qemuBuildSmartcardFindCCIDController(def, - smartcard))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find controller for %s"), - smartcard->info.alias); + if (!(contAlias =3D virDomainControllerAliasFind(def, + VIR_DOMAIN_CONTROLLER_T= YPE_CCID, + smartcard->info.addr.cc= id.controller))) return -1; - } virCommandAddArg(cmd, "-device"); virBufferAsprintf(&opt, ",id=3D%s,bus=3D%s.0", smartcard->info.alias, = contAlias); --=20 2.31.1 From nobody Thu Mar 28 15:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634037183; cv=none; d=zohomail.com; s=zohoarc; b=KzS9fxM43+A754hUbf3qnQB4Vxn63QTqgFiLbV365FAqlX0cK0I9+sSae9yJTbKxPuDL7hHN/N7mOCO7IQJzx7AaRQGuWI8zsf7s47f+ps60Xzo4lOQrl5Al5RTQLQd8ky2nIlrDd3Ef6v+fL3dFPabGJoIikXIdvtLYIPXer+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037183; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=41lUtqBAQUvbWTx24BhiJ0i69Dtlrxqfyvs+0/6vuKA=; b=LtDOSqWkydd18eigr5xfnXpZVB3FNzjnU1eY9jv4xurBjo/L90b0HKf1ts5vtLv+dxEOW9bZc122tTdfTT7Ec71uzshv8u19rN/Jxp5dPOObY2RMxeJ8epuFzSFssFr/E1Ehhha9wBBSSulRyFxVG/e94xS4NvONMqo2KVfBiL0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1634037183064921.3208775930897; Tue, 12 Oct 2021 04:13:03 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-138-w4u4GIzHNBmUhTYDdcRZYQ-1; Tue, 12 Oct 2021 07:13:00 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 73ECD1006AA4; Tue, 12 Oct 2021 11:12:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 23BA61972D; Tue, 12 Oct 2021 11:12:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E12CF4EA37; Tue, 12 Oct 2021 11:12:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBCrbH008349 for ; Tue, 12 Oct 2021 07:12:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id E3A00ADCD; Tue, 12 Oct 2021 11:12:53 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B54F5E268 for ; Tue, 12 Oct 2021 11:12:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037181; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=41lUtqBAQUvbWTx24BhiJ0i69Dtlrxqfyvs+0/6vuKA=; b=LDSFGW2xNGTthlHxFErm9H3sk6YgMJ33AYpXJD8gdSB3tmtqpM/d8RUtG2hhqCJmAuNYPs J+zZPDZ1DwIqKsUKL+0t5DK4jIAprQabdFTbi2ttT1DBR41k0JNHqCXwv0hsGtF4xHxj03 0E9YVnKPVbkOfpJgg5JjkJnUIzxFtfM= X-MC-Unique: w4u4GIzHNBmUhTYDdcRZYQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/14] qemuValidateDomainSmartcardDef: Move validation of smartcard count Date: Tue, 12 Oct 2021 13:12:13 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634037185142100001 Content-Type: text/plain; charset="utf-8" Move it into the validator. Note that the placement into the device validation part is intentional so that it also covers hotplug code paths. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 12 ------------ src/qemu/qemu_validate.c | 20 +++++++++++++++----- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e41c7dfaaa..6fa07e3e17 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9073,18 +9073,6 @@ qemuBuildSmartcardCommandLine(virLogManager *logMana= ger, smartcard =3D def->smartcards[0]; - /* -device usb-ccid was already emitted along with other - * controllers. For now, qemu handles only one smartcard. */ - if (def->nsmartcards > 1 || - smartcard->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID || - smartcard->info.addr.ccid.controller !=3D 0 || - smartcard->info.addr.ccid.slot !=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU binary lacks multiple smartcard " - "support")); - return -1; - } - switch (smartcard->type) { case VIR_DOMAIN_SMARTCARD_TYPE_HOST: virBufferAddLit(&opt, "ccid-card-emulated,backend=3Dnss-emulated"); diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 48d5c172c5..75dc9edb7d 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2086,10 +2086,20 @@ qemuValidateDomainChrDef(const virDomainChrDef *dev, static int -qemuValidateDomainSmartcardDef(const virDomainSmartcardDef *def, +qemuValidateDomainSmartcardDef(const virDomainSmartcardDef *smartcard, + const virDomainDef *def, virQEMUCaps *qemuCaps) { - switch (def->type) { + if (def->nsmartcards > 1 || + smartcard->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID || + smartcard->info.addr.ccid.controller !=3D 0 || + smartcard->info.addr.ccid.slot !=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU binary lacks multiple smartcard suppor= t")); + return -1; + } + + switch (smartcard->type) { case VIR_DOMAIN_SMARTCARD_TYPE_HOST: if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCID_EMULATED)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -2113,13 +2123,13 @@ qemuValidateDomainSmartcardDef(const virDomainSmart= cardDef *def, return -1; } - if (qemuValidateDomainChrSourceDef(def->data.passthru, qemuCaps) <= 0) + if (qemuValidateDomainChrSourceDef(smartcard->data.passthru, qemuC= aps) < 0) return -1; break; case VIR_DOMAIN_SMARTCARD_TYPE_LAST: default: - virReportEnumRangeError(virDomainSmartcardType, def->type); + virReportEnumRangeError(virDomainSmartcardType, smartcard->type); return -1; } @@ -5105,7 +5115,7 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef = *dev, return qemuValidateDomainChrDef(dev->data.chr, def, qemuCaps); case VIR_DOMAIN_DEVICE_SMARTCARD: - return qemuValidateDomainSmartcardDef(dev->data.smartcard, qemuCap= s); + return qemuValidateDomainSmartcardDef(dev->data.smartcard, def, qe= muCaps); case VIR_DOMAIN_DEVICE_RNG: return qemuValidateDomainRNGDef(dev->data.rng, qemuCaps); --=20 2.31.1 From nobody Thu Mar 28 15:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634037191; cv=none; d=zohomail.com; s=zohoarc; b=J1B7BlpwlUw8LnEueZsDyJDi7uh8EiMLvMn07YAE5UeoEHnqlTs4cMFUB0kG4Pe+Yg707wKYArPixSG7TZMaZ7Bj08VxXVJLVxwknsQHLgB/qJgVfdnR3FFBnFlmHQPupfwjVIFBjVA29NwX5CirAmXduJqHaCCHlt81x9+dw7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037191; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=618/pwVAItwdFDOpOpu9BE+0YWlZVRqkdE6GOZ7Ka74=; b=NDkYIP0zsCxMXbNwOo3DBEbF0a4VCafmap4hnOlfV+LuVXDInb6n1ydH9dvdY+1RUa3rVp+F9Y2I0pVqttMBCu0+MCuIlbnRWav1lbhwG2ToQI6XivhJkxhuxapd/Jx4riCjIF4DUCL+4SH3KFkBg5nj7zrkJhU7bEzt6qHR3Ck= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634037191915316.3424129928835; Tue, 12 Oct 2021 04:13:11 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-439-62GCECRiNk-7euOkh_KkMA-1; Tue, 12 Oct 2021 07:13:09 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 81FA41006AA2; Tue, 12 Oct 2021 11:13:04 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6255760C5F; Tue, 12 Oct 2021 11:13:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 312B34EA3A; Tue, 12 Oct 2021 11:13:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBD2qr008452 for ; Tue, 12 Oct 2021 07:13:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id D68A2ADCB; Tue, 12 Oct 2021 11:13:02 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DB8CADCA for ; Tue, 12 Oct 2021 11:12:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037190; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=618/pwVAItwdFDOpOpu9BE+0YWlZVRqkdE6GOZ7Ka74=; b=PFRT5puZqAbkvENXBn9bmtiHYgkev0fmXk7y6zVEDcGPa/qKU+0o+WQXH+jlNHNWCWW2m9 kGdY0j/9abZUFnn2B3Gc7+qWYIWzO5JD+ihLzz2BiyK8MOa4be0N2cOs2J44jz/QySMJcs UUZDypKoXB3WePix47PHHiap0CXezOA= X-MC-Unique: 62GCECRiNk-7euOkh_KkMA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/14] qemuBuildVMGenIDCommandLine: Generate via JSON Date: Tue, 12 Oct 2021 13:12:14 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634037194099100001 Content-Type: text/plain; charset="utf-8" QEMU declares the 'guid' property as: guid=3D - UUID (aka GUID) or "auto" for random value (de= fault) (default: "auto") Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6fa07e3e17..bf15a4801a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6144,19 +6144,26 @@ qemuBuildSysinfoCommandLine(virCommand *cmd, static int qemuBuildVMGenIDCommandLine(virCommand *cmd, - const virDomainDef *def) + const virDomainDef *def, + virQEMUCaps *qemuCaps) { - g_auto(virBuffer) opts =3D VIR_BUFFER_INITIALIZER; + g_autoptr(virJSONValue) props =3D NULL; char guid[VIR_UUID_STRING_BUFLEN]; if (!def->genidRequested) return 0; virUUIDFormat(def->genid, guid); - virBufferAsprintf(&opts, "vmgenid,guid=3D%s,id=3Dvmgenid0", guid); - virCommandAddArg(cmd, "-device"); - virCommandAddArgBuffer(cmd, &opts); + if (virJSONValueObjectCreate(&props, + "s:driver", "vmgenid", + "s:guid", guid, + "s:id", "vmgenid0", + NULL) < 0) + return -1; + + if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0) + return -1; return 0; } @@ -10658,7 +10665,7 @@ qemuBuildCommandLine(virQEMUDriver *driver, if (qemuBuildSysinfoCommandLine(cmd, def) < 0) return NULL; - if (qemuBuildVMGenIDCommandLine(cmd, def) < 0) + if (qemuBuildVMGenIDCommandLine(cmd, def, qemuCaps) < 0) return NULL; /* --=20 2.31.1 From nobody Thu Mar 28 15:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634037209; cv=none; d=zohomail.com; s=zohoarc; b=he9p0EwtGpsMNGbogUSkSw0smVATwGuOW2aIddvMwk4+Os7laRqG2iJ21Dc0E7E62fBv2TIZxp5kRprw62uFZYE5osF4NWfS2i8oxKxfRAhICoD9JCCdRWZT0IY49mM15H8QAWrssEwKugfieiGNuPH934YEBukQ6i9XeZaiXeo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037209; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rG+DOnQhYCk30d1P5p5oK7xCHXWWNIv3fVKnhcjTeXU=; b=Jm/wqQtniMD1bk7hB3IyWIct3pg7afkK4a80GnJEtMCLY98ocdi9dvdpXeD5bjCFrtA7OPB2gF0kZ0TbBVkKBiihRYV/86rZtWtJbBGvhgrgp4pHkfIwLp4s/P5N6MAgJoKneFP0ScUyVJJmNs6EoVpuxycvbm0d8gQ3xv9X79A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 16340372097561005.4401044671919; Tue, 12 Oct 2021 04:13:29 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-8zBsfAJ-Ovm16OjjehgZFA-1; Tue, 12 Oct 2021 07:13:25 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3F166100C63B; Tue, 12 Oct 2021 11:13:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1ED7210016F4; Tue, 12 Oct 2021 11:13:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E17BB1806D02; Tue, 12 Oct 2021 11:13:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBDJj2008617 for ; Tue, 12 Oct 2021 07:13:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 59CE9ADD1; Tue, 12 Oct 2021 11:13:19 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id BECDD5E268 for ; Tue, 12 Oct 2021 11:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037208; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rG+DOnQhYCk30d1P5p5oK7xCHXWWNIv3fVKnhcjTeXU=; b=WYJXTBg04DpsPBy6S+mheB1H9H2M54UhRygq5BJPUmfj0ueaB+qTkvedUOAF1SAUOi3PlC lfFndIZmx1EcIILSIyekCScDrm/2tB+qm7xebBLNpXgmIcKXh2F0b76vGBFsHNQpbnxe// an7uaqWNb2cWkjdKnx6l4/7KpqEq1Q0= X-MC-Unique: 8zBsfAJ-Ovm16OjjehgZFA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/14] qemuBuildTPMProxyCommandLine: Generate via JSON Date: Tue, 12 Oct 2021 13:12:15 +0200 Message-Id: <1a308df6e2c64f73ac94ec48ec9328f8bf269f8a.1634037045.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634037210215100001 Content-Type: text/plain; charset="utf-8" All properties are strings according to QEMU. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bf15a4801a..86affcdf6f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9980,19 +9980,20 @@ qemuBuildTPMCommandLine(virCommand *cmd, static int qemuBuildTPMProxyCommandLine(virCommand *cmd, - virDomainTPMDef *tpm) + virDomainTPMDef *tpm, + virQEMUCaps *qemuCaps) { - g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; - const char *filePath =3D NULL; + g_autoptr(virJSONValue) props =3D NULL; - filePath =3D tpm->data.passthrough.source.data.file.path; + if (virJSONValueObjectCreate(&props, + "s:driver", virDomainTPMModelTypeToString= (tpm->model), + "s:id", tpm->info.alias, + "s:host-path", tpm->data.passthrough.sour= ce.data.file.path, + NULL) < 0) + return -1; - virCommandAddArg(cmd, "-device"); - virBufferAsprintf(&buf, "%s,id=3D%s,host-path=3D", - virDomainTPMModelTypeToString(tpm->model), - tpm->info.alias); - virQEMUBuildBufferEscapeComma(&buf, filePath); - virCommandAddArgBuffer(cmd, &buf); + if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0) + return -1; return 0; } @@ -10007,7 +10008,7 @@ qemuBuildTPMsCommandLine(virCommand *cmd, for (i =3D 0; i < def->ntpms; i++) { if (def->tpms[i]->model =3D=3D VIR_DOMAIN_TPM_MODEL_SPAPR_PROXY) { - if (qemuBuildTPMProxyCommandLine(cmd, def->tpms[i]) < 0) + if (qemuBuildTPMProxyCommandLine(cmd, def->tpms[i], qemuCaps) = < 0) return -1; } else if (qemuBuildTPMCommandLine(cmd, def, def->tpms[i], qemuCaps) < 0) { --=20 2.31.1 From nobody Thu Mar 28 15:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634037213; cv=none; d=zohomail.com; s=zohoarc; b=gxFWyXO1uZ2rEdlqNkVTOgSYa4p8eqgC1i3jZ/jmdBtDQuQHysXDSu09YOF65P6ueaWW7y8GIfzJvyS/40rWxAUUHMEsieMrobgbraPZ+r6lIENZRU1RlB6najOHpHDVRoIlmrK4CjbiVeOGfERtSMfdCPBTMa8PksfG2qOFO+U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037213; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VMyK1Gp6KETwif/tlegLaR2mV7AAoO08eVwBRMMs/+A=; b=eu4oCFEGptiOIF31vdkUZ3Htu4Moq0J1X7ilmoeXD9pU4Lf1wg/2b/KNfJboFMsicteEoJfQbSaE5ds1e/9jU4ragyx0hirXUHsBgt4fTQfIVRt+HJ7fNmTm3NeuC+KoTRvduLSAh8NvPfsdFt/UA5FUd+Ke6NAePSEqXjP2eN4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1634037213821658.9092060592421; Tue, 12 Oct 2021 04:13:33 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-476-zm1P16-eOkmP0NykLgfOOg-1; Tue, 12 Oct 2021 07:13:31 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A8A310B3941; Tue, 12 Oct 2021 11:13:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3DBE410016F4; Tue, 12 Oct 2021 11:13:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0F7361806D03; Tue, 12 Oct 2021 11:13:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBDOqm008662 for ; Tue, 12 Oct 2021 07:13:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 99413ADCA; Tue, 12 Oct 2021 11:13:24 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02D47ADD1 for ; Tue, 12 Oct 2021 11:13:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037212; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VMyK1Gp6KETwif/tlegLaR2mV7AAoO08eVwBRMMs/+A=; b=fpFKFcFWP6B1e4LaL6EwZf60E03WRN6a3NKGyq5HtZCJzcLhO79OWD+5zIo6lE+Ra6V5Hz FmoF4nF3a66cVimxc6dw14XG1r0OjrOmI7iDtnIxFwcGEipgjGAtDFTktytaaYk+03vWPi IM91/i43MEpgeC+IuIcQENiyG4JkYto= X-MC-Unique: zm1P16-eOkmP0NykLgfOOg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/14] qemuBuildVMCoreInfoCommandLine: Generate via JSON Date: Tue, 12 Oct 2021 13:12:16 +0200 Message-Id: <8f947da95784a753e7f542c493dcf532c2fd687b.1634037045.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634037214575100001 Content-Type: text/plain; charset="utf-8" While this device doesn't have any properties it must be converted to use qemuBuildDeviceCommandlineFromJSON so that we can validate it in the future. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 86affcdf6f..56bf17b6b4 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10097,14 +10097,22 @@ qemuBuildSecCommandLine(virDomainObj *vm, virComm= and *cmd, static int qemuBuildVMCoreInfoCommandLine(virCommand *cmd, - const virDomainDef *def) + const virDomainDef *def, + virQEMUCaps *qemuCaps) { - virTristateSwitch vmci =3D def->features[VIR_DOMAIN_FEATURE_VMCOREINFO= ]; + g_autoptr(virJSONValue) props =3D NULL; - if (vmci !=3D VIR_TRISTATE_SWITCH_ON) + if (def->features[VIR_DOMAIN_FEATURE_VMCOREINFO] !=3D VIR_TRISTATE_SWI= TCH_ON) return 0; - virCommandAddArgList(cmd, "-device", "vmcoreinfo", NULL); + if (virJSONValueObjectCreate(&props, + "s:driver", "vmcoreinfo", + NULL) < 0) + return -1; + + if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0) + return -1; + return 0; } @@ -10785,7 +10793,7 @@ qemuBuildCommandLine(virQEMUDriver *driver, if (qemuBuildNVRAMCommandLine(cmd, def) < 0) return NULL; - if (qemuBuildVMCoreInfoCommandLine(cmd, def) < 0) + if (qemuBuildVMCoreInfoCommandLine(cmd, def, qemuCaps) < 0) return NULL; if (qemuBuildSecCommandLine(vm, cmd, def->sec) < 0) --=20 2.31.1 From nobody Thu Mar 28 15:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634037223; cv=none; d=zohomail.com; s=zohoarc; b=gYC4zTjUivy+ZicktIGc1Bx494Q0qhqCtlWHxkQvMaXMAcamC8Y8i09uVYuFR9vHq04jZXGiVmoDpYBlXhIMgC/VgdadaYBMWIzEi6lPTQhg0ssixvZ05yJvjzeoPyARMFEZmBzRQU3cMX56VS2USRt7HoSi2IryvSrGoeqgs/0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037223; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GlpA1FBHGk90cljSIV9Q8UP/q0ysy1jW9gK554jNL6M=; b=GcBWipl39COXIPcsMLW2FO7m6eurd1gDCiLnlm4vYZQUSpNFMXVeYzzOyPQQ/Gz8ebFB7EGXdxxcZVEEcqz4HCoLF28vNYhJjBJpec9mAWheJ+8iioihgA7mkDGrp36dupzWKWBHxu/X64QZPGF4VYzKkhJrs8QRMuiUBkKiOkw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634037223473531.2514685313105; Tue, 12 Oct 2021 04:13:43 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-319-kbHbDLvvMZyAr7SS5s_Y2A-1; Tue, 12 Oct 2021 07:13:39 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E729D801E72; Tue, 12 Oct 2021 11:13:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C27891972D; Tue, 12 Oct 2021 11:13:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 912D04EA37; Tue, 12 Oct 2021 11:13:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBDWjN008679 for ; Tue, 12 Oct 2021 07:13:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4A9DCADCD; Tue, 12 Oct 2021 11:13:32 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFC315E7A2 for ; Tue, 12 Oct 2021 11:13:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037222; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=GlpA1FBHGk90cljSIV9Q8UP/q0ysy1jW9gK554jNL6M=; b=Qo86laMGA7tlVYu/duo7H/7LYnUP+VEaiQqef1v0hRhLlIHXVMaaINadMBBquRB2cdq91D hL8MfpDNXcHy8eTzn6pK9s28Xti83DhnnF2yaAnKrTENJSQyN7E3cpF0fRCDaTutXdZrrx V+Y0LHh5JRjk6rf/gb29maY6D7jTqHs= X-MC-Unique: kbHbDLvvMZyAr7SS5s_Y2A-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/14] qemuBuildIOMMUCommandLine: Generate via JSON Date: Tue, 12 Oct 2021 13:12:17 +0200 Message-Id: <1254e1d92d946d63b581635aa39746f5c7485612.1634037045.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634037225387100001 Content-Type: text/plain; charset="utf-8" QEMU declares the following types for fields we control: intremap=3D - on/off/auto (default: "auto") caching-mode=3D - (default: false) eim=3D - on/off/auto (default: "auto") device-iotlb=3D - (default: false) aw-bits=3D - (default: 39) Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 42 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 56bf17b6b4..8913110b00 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6486,7 +6486,8 @@ qemuBuildBootCommandLine(virCommand *cmd, static int qemuBuildIOMMUCommandLine(virCommand *cmd, - const virDomainDef *def) + const virDomainDef *def, + virQEMUCaps *qemuCaps) { const virDomainIOMMUDef *iommu =3D def->iommu; @@ -6495,31 +6496,22 @@ qemuBuildIOMMUCommandLine(virCommand *cmd, switch (iommu->model) { case VIR_DOMAIN_IOMMU_MODEL_INTEL: { - g_auto(virBuffer) opts =3D VIR_BUFFER_INITIALIZER; + g_autoptr(virJSONValue) props =3D NULL; - virBufferAddLit(&opts, "intel-iommu"); - if (iommu->intremap !=3D VIR_TRISTATE_SWITCH_ABSENT) { - virBufferAsprintf(&opts, ",intremap=3D%s", - virTristateSwitchTypeToString(iommu->intrema= p)); - } - if (iommu->caching_mode !=3D VIR_TRISTATE_SWITCH_ABSENT) { - virBufferAsprintf(&opts, ",caching-mode=3D%s", - virTristateSwitchTypeToString(iommu->caching= _mode)); - } - if (iommu->eim !=3D VIR_TRISTATE_SWITCH_ABSENT) { - virBufferAsprintf(&opts, ",eim=3D%s", - virTristateSwitchTypeToString(iommu->eim)); - } - if (iommu->iotlb !=3D VIR_TRISTATE_SWITCH_ABSENT) { - virBufferAsprintf(&opts, ",device-iotlb=3D%s", - virTristateSwitchTypeToString(iommu->iotlb)); - } - if (iommu->aw_bits > 0) - virBufferAsprintf(&opts, ",aw-bits=3D%d", iommu->aw_bits); + if (virJSONValueObjectCreate(&props, + "s:driver", "intel-iommu", + "S:intremap", qemuOnOffAuto(iommu->in= tremap), + "T:caching-mode", iommu->caching_mode, + "S:eim", qemuOnOffAuto(iommu->eim), + "T:device-iotlb", iommu->iotlb, + "z:aw-bits", iommu->aw_bits, + NULL) < 0) + return -1; - virCommandAddArg(cmd, "-device"); - virCommandAddArgBuffer(cmd, &opts); - break; + if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0) + return -1; + + return 0; } case VIR_DOMAIN_IOMMU_MODEL_SMMUV3: @@ -10705,7 +10697,7 @@ qemuBuildCommandLine(virQEMUDriver *driver, if (qemuBuildBootCommandLine(cmd, def) < 0) return NULL; - if (qemuBuildIOMMUCommandLine(cmd, def) < 0) + if (qemuBuildIOMMUCommandLine(cmd, def, qemuCaps) < 0) return NULL; if (qemuBuildGlobalControllerCommandLine(cmd, def) < 0) --=20 2.31.1 From nobody Thu Mar 28 15:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634037261; cv=none; d=zohomail.com; s=zohoarc; b=JPQk6RSAsCheq0fzbNJ3DUsv6xseiOtfKtDgZ2QZ7PYm7oz6FE1KLQxn7diNx6joxBZdc07EMDxdyeFrGFyxOKBRg7irDoT9mI6E6WvFYVRixh9Xcjjd4Dk2FTVkVL5sh6M5ukUXjIghBocpXVO1gkNABqDQllQ2q0FGEbq/N9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037261; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=c7GUiZMe7hcasqN+pRJWt+ir2H3FAvB/j3yF0FScLio=; b=jFvQWtejeM2lA9pLjwO8iz/nBvLWzWCfMMPjXkOdnJbiUs8crQibqnNl7i6Y3Al192E/Ak5QUlPy5H1472TXC96lAYE/VcQKvH91G83rvNI+PLRalENtTv67wl2VeazGraqv967UrrkmwIIf3eShQZsBQKQgu4/353b/cDVvuSM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634037261714116.58651425510982; Tue, 12 Oct 2021 04:14:21 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-165-KeRE-ECUMdq1KnMxZWA7vA-1; Tue, 12 Oct 2021 07:14:17 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2FE01801A93; Tue, 12 Oct 2021 11:14:12 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0E5CA5C1B4; Tue, 12 Oct 2021 11:14:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 911021803B30; Tue, 12 Oct 2021 11:14:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBEAFe008903 for ; Tue, 12 Oct 2021 07:14:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id E00A74F0E8; Tue, 12 Oct 2021 11:14:09 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 372E8804F7 for ; Tue, 12 Oct 2021 11:13:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037260; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=c7GUiZMe7hcasqN+pRJWt+ir2H3FAvB/j3yF0FScLio=; b=KMS1s0IS4T60OQMOoJ/n7qwJwmCAMRSwgM8ntdbqH/znqOA7Hhl9KsNOh5K6Cx76Mu63Ts ufHWXRaWsdubbyjZebVY8ATxxgbYiEhxCB7GmX7PuAQ2ZFXvBZ06zJWP1FKRJf2ebCbUF3 53W7+ssHXIJq9Xk6DJBaw58YC5Po004= X-MC-Unique: KeRE-ECUMdq1KnMxZWA7vA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 12/14] qemuBuildSmartcardCommandLine: Generate via JSON Date: Tue, 12 Oct 2021 13:12:18 +0200 Message-Id: <2c85ed316d4f8cc4f18848b243ccf4515aca0108.1634037045.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634037262843100001 Content-Type: text/plain; charset="utf-8" QEMU declares the props we control as: 'ccid-card-emulated' backend=3D cert1=3D cert2=3D cert3=3D db=3D 'ccid-card-passthru' chardev=3D - ID of a chardev to use as a backend Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 88 +++++++++++++++++++++++++---------------- 1 file changed, 54 insertions(+), 34 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8913110b00..1d5986b85a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9056,16 +9056,10 @@ qemuBuildSmartcardCommandLine(virLogManager *logMan= ager, virQEMUCaps *qemuCaps, bool chardevStdioLogd) { - size_t i; + g_autoptr(virJSONValue) props =3D NULL; virDomainSmartcardDef *smartcard; - g_autofree char *devstr =3D NULL; - g_auto(virBuffer) opt =3D VIR_BUFFER_INITIALIZER; - const char *database; const char *contAlias =3D NULL; - unsigned int cdevflags =3D QEMU_BUILD_CHARDEV_TCP_NOWAIT | - QEMU_BUILD_CHARDEV_UNIX_FD_PASS; - if (chardevStdioLogd) - cdevflags |=3D QEMU_BUILD_CHARDEV_FILE_LOGD; + g_autofree char *bus =3D NULL; if (!def->nsmartcards) return 0; @@ -9074,37 +9068,56 @@ qemuBuildSmartcardCommandLine(virLogManager *logMan= ager, switch (smartcard->type) { case VIR_DOMAIN_SMARTCARD_TYPE_HOST: - virBufferAddLit(&opt, "ccid-card-emulated,backend=3Dnss-emulated"); + if (virJSONValueObjectCreate(&props, + "s:driver", "ccid-card-emulated", + "s:backend", "nss-emulated", + NULL) < 0) + return -1; + break; - case VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES: - virBufferAddLit(&opt, "ccid-card-emulated,backend=3Dcertificates"); - for (i =3D 0; i < VIR_DOMAIN_SMARTCARD_NUM_CERTIFICATES; i++) { - virBufferAsprintf(&opt, ",cert%zu=3D", i + 1); - virQEMUBuildBufferEscapeComma(&opt, smartcard->data.cert.file[= i]); - } - if (smartcard->data.cert.database) { + case VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES: { + const char *database =3D VIR_DOMAIN_SMARTCARD_DEFAULT_DATABASE; + + if (smartcard->data.cert.database) database =3D smartcard->data.cert.database; - } else { - database =3D VIR_DOMAIN_SMARTCARD_DEFAULT_DATABASE; - } - virBufferAddLit(&opt, ",db=3D"); - virQEMUBuildBufferEscapeComma(&opt, database); + + if (virJSONValueObjectCreate(&props, + "s:driver", "ccid-card-emulated", + "s:backend", "certificates", + "s:cert1", smartcard->data.cert.file[= 0], + "s:cert2", smartcard->data.cert.file[= 1], + "s:cert3", smartcard->data.cert.file[= 2], + "s:db", database, + NULL) < 0) + return -1; + } break; - case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH: - if (!(devstr =3D qemuBuildChrChardevStr(logManager, secManager, - cmd, cfg, def, - smartcard->data.passthru, - smartcard->info.alias, - qemuCaps, cdevflags))) { + case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH: { + unsigned int cdevflags =3D QEMU_BUILD_CHARDEV_TCP_NOWAIT | QEMU_BU= ILD_CHARDEV_UNIX_FD_PASS; + g_autofree char *chardevstr =3D NULL; + g_autofree char *chardevalias =3D g_strdup_printf("char%s", smartc= ard->info.alias); + + if (chardevStdioLogd) + cdevflags |=3D QEMU_BUILD_CHARDEV_FILE_LOGD; + + if (!(chardevstr =3D qemuBuildChrChardevStr(logManager, secManager, + cmd, cfg, def, + smartcard->data.passthru, + smartcard->info.alias, + qemuCaps, cdevflags))) { return -1; } - virCommandAddArg(cmd, "-chardev"); - virCommandAddArg(cmd, devstr); - virBufferAsprintf(&opt, "ccid-card-passthru,chardev=3Dchar%s", - smartcard->info.alias); + virCommandAddArgList(cmd, "-chardev", chardevstr, NULL); + + if (virJSONValueObjectCreate(&props, + "s:driver", "ccid-card-passthru", + "s:chardev", chardevalias, + NULL) < 0) + return -1; + } break; case VIR_DOMAIN_SMARTCARD_TYPE_LAST: @@ -9118,9 +9131,16 @@ qemuBuildSmartcardCommandLine(virLogManager *logMana= ger, smartcard->info.addr.cc= id.controller))) return -1; - virCommandAddArg(cmd, "-device"); - virBufferAsprintf(&opt, ",id=3D%s,bus=3D%s.0", smartcard->info.alias, = contAlias); - virCommandAddArgBuffer(cmd, &opt); + bus =3D g_strdup_printf("%s.0", contAlias); + + if (virJSONValueObjectAdd(props, + "s:id", smartcard->info.alias, + "s:bus", bus, + NULL) < 0) + return -1; + + if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0) + return -1; return 0; } --=20 2.31.1 From nobody Thu Mar 28 15:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634037262; cv=none; d=zohomail.com; s=zohoarc; b=nOR2ZPAjlO8fTZWS2dtRvkeWP4hhpAGLftbDUKxURJEfLXHDKo+HW1OH0V7WPLQzfU3b+i+XUaftqPCkjOh9+G75sHtH5+eNY6uOSx+ZlcKiO+fLzz0GazXkSyRxrPkygt7z5mqrtl4uX23jwbIoJkATQV4+L85/ViB/eQhe7Bk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037262; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FtfDZnXkUKCWsxokMB9RpODMorx+62rIV3HvMcHeOh4=; b=aKjiprd9/VZS0AnMY0obhQCWBUTouaOhFsLs/jVOfZa5laduIHCu2VmVt30qo/ypFIo5O5NUlZiUJYnn8XA7Jj9cjN7tG9skiuQSYWFuFeuneTR/6J6Om6UYDdd0q3pSYLZQGSl3LTWHXVpNEQpS8lJR0Ggyqw+qZcWY/hoqGWQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634037262836586.2284526497579; Tue, 12 Oct 2021 04:14:22 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-151-lgg6fDLvO9O1fc7BK5loOA-1; Tue, 12 Oct 2021 07:14:18 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9BF10100A647; Tue, 12 Oct 2021 11:14:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7EA8110016F4; Tue, 12 Oct 2021 11:14:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4B86A1806D01; Tue, 12 Oct 2021 11:14:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBEAYS008912 for ; Tue, 12 Oct 2021 07:14:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id D1BFB5D9F0; Tue, 12 Oct 2021 11:14:10 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3634A5D9D5 for ; Tue, 12 Oct 2021 11:14:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037261; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FtfDZnXkUKCWsxokMB9RpODMorx+62rIV3HvMcHeOh4=; b=jR6j8aT5kMQoFbv5W6oKY7hhHxzZoPMS3oQZzyMeiiP1iY7PFyI9JKp5Wbh7sp2LddBeni 0c9iIcfun+Z7Aku0uaQrZeOR/e6NGlAegqKAtrceuIKN3CS9mSzSBE/Kz4FSMHIwJGv3NU G6inyRtj6284ZXBik99QlWPZtbMpHDE= X-MC-Unique: lgg6fDLvO9O1fc7BK5loOA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 13/14] qemuBuildFloppyCommandLineControllerOptions: Extract formatting of implicit/explicit fdc Date: Tue, 12 Oct 2021 13:12:19 +0200 Message-Id: <075d8dc0f0b2e733791df84498a234208af56b6d.1634037046.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634037264897100005 Content-Type: text/plain; charset="utf-8" qemuBuildFloppyCommandLineControllerOptions was generating config for both the implicit and explicit fdc. The explicit FDC is using '-device' and thus will need to be converted to JSON. Split up the lookup of the floppy drive configs from the actuall command generation. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 126 +++++++++++++++++++++++++++------------- 1 file changed, 86 insertions(+), 40 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 1d5986b85a..665cd739ec 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2153,23 +2153,79 @@ qemuCommandAddExtDevice(virCommand *cmd, return 0; } + +static void +qemuBuildFloppyCommandLineControllerOptionsImplicit(virCommand *cmd, + unsigned int bootindex= A, + unsigned int bootindex= B, + const char *backendA, + const char *backendB) +{ + if (backendA) { + virCommandAddArg(cmd, "-global"); + virCommandAddArgFormat(cmd, "isa-fdc.driveA=3D%s", backendA); + } + + if (bootindexA > 0) { + virCommandAddArg(cmd, "-global"); + virCommandAddArgFormat(cmd, "isa-fdc.bootindexA=3D%u", bootindexA); + } + + if (backendB) { + virCommandAddArg(cmd, "-global"); + virCommandAddArgFormat(cmd, "isa-fdc.driveB=3D%s", backendB); + } + + if (bootindexB > 0) { + virCommandAddArg(cmd, "-global"); + virCommandAddArgFormat(cmd, "isa-fdc.bootindexB=3D%u", bootindexB); + } +} + + +static void +qemuBuildFloppyCommandLineControllerOptionsExplicit(virCommand *cmd, + unsigned int bootindex= A, + unsigned int bootindex= B, + const char *backendA, + const char *backendB) +{ + g_auto(virBuffer) fdc_opts =3D VIR_BUFFER_INITIALIZER; + + virBufferAddLit(&fdc_opts, "isa-fdc,"); + + if (backendA) + virBufferAsprintf(&fdc_opts, "driveA=3D%s,", backendA); + + if (bootindexA > 0) + virBufferAsprintf(&fdc_opts, "bootindexA=3D%u,", bootindexA); + + if (backendB) + virBufferAsprintf(&fdc_opts, "driveB=3D%s,", backendB); + + if (bootindexB > 0) + virBufferAsprintf(&fdc_opts, "bootindexB=3D%u,", bootindexB); + + virBufferTrim(&fdc_opts, ","); + virCommandAddArg(cmd, "-device"); + virCommandAddArgBuffer(cmd, &fdc_opts); +} + + static int qemuBuildFloppyCommandLineControllerOptions(virCommand *cmd, const virDomainDef *def, virQEMUCaps *qemuCaps) { - g_auto(virBuffer) fdc_opts =3D VIR_BUFFER_INITIALIZER; - bool explicitfdc =3D qemuDomainNeedsFDC(def); + unsigned int bootindexA =3D 0; + unsigned int bootindexB =3D 0; + g_autofree char *backendA =3D NULL; + g_autofree char *backendB =3D NULL; bool hasfloppy =3D false; - char driveLetter; size_t i; - virBufferAddLit(&fdc_opts, "isa-fdc,"); - for (i =3D 0; i < def->ndisks; i++) { g_autofree char *backendAlias =3D NULL; - g_autofree char *backendStr =3D NULL; - g_autofree char *bootindexStr =3D NULL; virDomainDiskDef *disk =3D def->disks[i]; if (disk->bus !=3D VIR_DOMAIN_DISK_BUS_FDC) @@ -2177,45 +2233,35 @@ qemuBuildFloppyCommandLineControllerOptions(virComm= and *cmd, hasfloppy =3D true; - if (disk->info.addr.drive.unit) - driveLetter =3D 'B'; - else - driveLetter =3D 'A'; - - if (disk->info.effectiveBootIndex > 0) - bootindexStr =3D g_strdup_printf("bootindex%c=3D%u", driveLett= er, - disk->info.effectiveBootIndex); - /* with -blockdev we setup the floppy device and it's backend with= -device */ - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { - if (qemuDomainDiskGetBackendAlias(disk, qemuCaps, &backendAlia= s) < 0) - return -1; - - if (backendAlias) - backendStr =3D g_strdup_printf("drive%c=3D%s", driveLetter= , backendAlias); - } - - if (!explicitfdc) { - if (backendStr) { - virCommandAddArg(cmd, "-global"); - virCommandAddArgFormat(cmd, "isa-fdc.%s", backendStr); - } + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV) && + qemuDomainDiskGetBackendAlias(disk, qemuCaps, &backendAlias) <= 0) + return -1; - if (bootindexStr) { - virCommandAddArg(cmd, "-global"); - virCommandAddArgFormat(cmd, "isa-fdc.%s", bootindexStr); - } + if (disk->info.addr.drive.unit) { + bootindexB =3D disk->info.effectiveBootIndex; + backendB =3D g_steal_pointer(&backendAlias); } else { - virBufferStrcat(&fdc_opts, backendStr, ",", NULL); - virBufferStrcat(&fdc_opts, bootindexStr, ",", NULL); + bootindexA =3D disk->info.effectiveBootIndex; + backendA =3D g_steal_pointer(&backendAlias); } } - if (explicitfdc && hasfloppy) { - /* Newer Q35 machine types require an explicit FDC controller */ - virBufferTrim(&fdc_opts, ","); - virCommandAddArg(cmd, "-device"); - virCommandAddArgBuffer(cmd, &fdc_opts); + if (!hasfloppy) + return 0; + + if (qemuDomainNeedsFDC(def)) { + qemuBuildFloppyCommandLineControllerOptionsExplicit(cmd, + bootindexA, + bootindexB, + backendA, + backendB); + } else { + qemuBuildFloppyCommandLineControllerOptionsImplicit(cmd, + bootindexA, + bootindexB, + backendA, + backendB); } return 0; --=20 2.31.1 From nobody Thu Mar 28 15:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634037260; cv=none; d=zohomail.com; s=zohoarc; b=GG/UWmBDIkIRrQH+G2lkckmMDqxJ1kO2iDepkqc5iIiDGoPJwV8NOcFrkrw4QDWb+ysn4gbr6MCfL+uWSQDwp8bUdHiVtqw96oZE0TgQh2/4qR8ZvFfRL7Ipah9cx7VuC+kTpeeHQ/Eb/wlZMg57nBskXRTI1Hqs65nePyQZUW8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037260; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Xnb/L1Jvn3py941NZfNDXllQb++JLl5VN5leq/9TeNs=; b=dKvQz5KEcgUCVhsSyZ8EPnINz41X/FxOlag0kvaJlEQgC0Ntxag9HMc2yyCgpe+RuxmBIpwJWBp83SilzRw9OANCA360eEb9O+SlZ2OlnvWBnrbdeY0YWqiLQQ8p9fu/mSIJRKoarYdNhU3pSEK0uLhIYIeOT2PrLG1J7+ukLK0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634037260610578.823684426537; Tue, 12 Oct 2021 04:14:20 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-505-gZk1RrfMMUSNyET11RdfVw-1; Tue, 12 Oct 2021 07:14:18 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 32D5D814249; Tue, 12 Oct 2021 11:14:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 14FA769FA0; Tue, 12 Oct 2021 11:14:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D2385180598A; Tue, 12 Oct 2021 11:14:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBECv1008922 for ; Tue, 12 Oct 2021 07:14:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id DAC645D9F0; Tue, 12 Oct 2021 11:14:11 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4918F5D9D5 for ; Tue, 12 Oct 2021 11:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037259; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Xnb/L1Jvn3py941NZfNDXllQb++JLl5VN5leq/9TeNs=; b=CzyyYzfXwfOk9Uzvvynystv9OX7hFQSJO4UvbjOXs0WhDUZ0dotwceS4P1yOuJQXobcdoa DWufaf9J+j3++5aF+VxUJVARfGZSrXrTF86ghE0uCucWzktXDzb+8g0G6pRB3+PfSpzzcZ dIEP4Ei94J0sYWvFdqwtkIlP0Y84cCI= X-MC-Unique: gZk1RrfMMUSNyET11RdfVw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 14/14] qemuBuildFloppyCommandLineControllerOptionsExplicit: Generate via JSON Date: Tue, 12 Oct 2021 13:12:20 +0200 Message-Id: <1bbc0b9e52323f78b36f809396e35d3e1292adf9.1634037046.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634037262854100002 Content-Type: text/plain; charset="utf-8" QEMU declares the bootindex types as: bootindexA=3D bootindexB=3D The driveA/driveB parameters were deprecated and removed in qemu-6.0. We'll keep them for compatibility, but they are not used with -blockdev. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 45 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 665cd739ec..3b2f88bcb9 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2183,32 +2183,29 @@ qemuBuildFloppyCommandLineControllerOptionsImplicit= (virCommand *cmd, } -static void +static int qemuBuildFloppyCommandLineControllerOptionsExplicit(virCommand *cmd, unsigned int bootindex= A, unsigned int bootindex= B, const char *backendA, - const char *backendB) + const char *backendB, + virQEMUCaps *qemuCaps) { - g_auto(virBuffer) fdc_opts =3D VIR_BUFFER_INITIALIZER; - - virBufferAddLit(&fdc_opts, "isa-fdc,"); - - if (backendA) - virBufferAsprintf(&fdc_opts, "driveA=3D%s,", backendA); - - if (bootindexA > 0) - virBufferAsprintf(&fdc_opts, "bootindexA=3D%u,", bootindexA); + g_autoptr(virJSONValue) props =3D NULL; - if (backendB) - virBufferAsprintf(&fdc_opts, "driveB=3D%s,", backendB); + if (virJSONValueObjectCreate(&props, + "s:driver", "isa-fdc", + "S:driveA", backendA, + "p:bootindexA", bootindexA, + "S:driveB", backendB, + "p:bootindexB", bootindexB, + NULL) < 0) + return -1; - if (bootindexB > 0) - virBufferAsprintf(&fdc_opts, "bootindexB=3D%u,", bootindexB); + if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0) + return -1; - virBufferTrim(&fdc_opts, ","); - virCommandAddArg(cmd, "-device"); - virCommandAddArgBuffer(cmd, &fdc_opts); + return 0; } @@ -2251,11 +2248,13 @@ qemuBuildFloppyCommandLineControllerOptions(virComm= and *cmd, return 0; if (qemuDomainNeedsFDC(def)) { - qemuBuildFloppyCommandLineControllerOptionsExplicit(cmd, - bootindexA, - bootindexB, - backendA, - backendB); + if (qemuBuildFloppyCommandLineControllerOptionsExplicit(cmd, + bootindexA, + bootindexB, + backendA, + backendB, + qemuCaps) = < 0) + return -1; } else { qemuBuildFloppyCommandLineControllerOptionsImplicit(cmd, bootindexA, --=20 2.31.1