From nobody Sun May 19 00:17:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614795555; cv=none; d=zohomail.com; s=zohoarc; b=nhIBK5xWmrgvGx/DWNsrPToGDF5Fc/mUZ8k7vs/jWkvHvPgfgwGaU63bnEs/37G65ZFvfshs72KsS/vuKA1WYh9XXJd6W7EB0bhyY19bTk1T/Cs1X9fvvecA9LVX6WT4s9auEpXA8j+YMWlQDsm/gtrVzOmIO0574DQeP4bIuQc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614795555; 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=BQ3x9q1zQph2EonY5FHsMjDjVJjDbwXnbWKEH/LQ1Qo=; b=ac1b6fYZafBd9I/aUdoGLFkHyY1cchjA+gDizQPBsveyTfcdm7Amcx3yHYvbGRAn7tLIWV0j4XtRpW1S8RueOGKzUNNiPzvbaaaUMQK5l2e+6H8o7jFM16Si1mA+TwQP5wps+KwupUlutFIgGM5PlM1W98Xw1DDuZcN/dXxWopo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614795555754371.72064919585773; Wed, 3 Mar 2021 10:19:15 -0800 (PST) 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-344-XNYWBkOPO-yCTNsZyWPn-Q-1; Wed, 03 Mar 2021 13:19:12 -0500 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 5440918C35C4; Wed, 3 Mar 2021 18:19:06 +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 032476F45C; Wed, 3 Mar 2021 18:19:06 +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 BAC8C5002E; Wed, 3 Mar 2021 18:19:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 123IIl7X032347 for ; Wed, 3 Mar 2021 13:18:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8D3D860C15; Wed, 3 Mar 2021 18:18:47 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-145.ams2.redhat.com [10.36.115.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4D3460BFA; Wed, 3 Mar 2021 18:18:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614795554; 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=BQ3x9q1zQph2EonY5FHsMjDjVJjDbwXnbWKEH/LQ1Qo=; b=KgzpjboCPjOjvt4pUX1fbXDrD3PXdRZ9yW5QkcpvYOwHQj2YGdX46Aaub1bIVVCShMAd39 ouv1Spw7kq+fO1s+CAku/ENKSUJE70M4YMHw4WYw/dYcaSNaLFYT6dHq2CJfz+5Zl9ngMC DvviowhAfekjEWSphc/jdFa0DkaRLxQ= X-MC-Unique: XNYWBkOPO-yCTNsZyWPn-Q-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 01/18] config: cleanup some typos / baggage wrt compiler checks Date: Wed, 3 Mar 2021 18:18:17 +0000 Message-Id: <20210303181834.1578756-2-berrange@redhat.com> In-Reply-To: <20210303181834.1578756-1-berrange@redhat.com> References: <20210303181834.1578756-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) We had a copy and paste mistake from code we mirrored from QEMU, as well as failing to remove an earlier redundant check. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik Reviewed-by: Neal Gompa --- config.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/config.h b/config.h index 2ee7f7bff6..ca6720f37d 100644 --- a/config.h +++ b/config.h @@ -25,10 +25,6 @@ # define _FORTIFY_SOURCE 2 #endif =20 -#ifndef __GNUC__ -# error "Libvirt requires GCC >=3D 4.8, or Clang" -#endif - /* * Define __GNUC_PREREQ to a sane default if it isn't yet defined. * This is done here so that it's included as early as possible; @@ -41,16 +37,16 @@ #if defined(__clang_major__) && defined(__clang_minor__) # ifdef __apple_build_version__ # if __clang_major__ < 5 || (__clang_major__ =3D=3D 5 && __clang_minor__ = < 1) -# error You need at least XCode Clang v5.1 to compile QEMU +# error You need at least XCode Clang v5.1 to compile libvirt # endif # else # if __clang_major__ < 3 || (__clang_major__ =3D=3D 3 && __clang_minor__ = < 4) -# error You need at least Clang v3.4 to compile QEMU +# error You need at least Clang v3.4 to compile libvirt # endif # endif #elif defined(__GNUC__) && defined(__GNUC_MINOR__) # if __GNUC__ < 4 || (__GNUC__ =3D=3D 4 && __GNUC_MINOR__ < 8) -# error You need at least GCC v4.8 to compile QEMU +# error You need at least GCC v4.8 to compile libvirt # endif #else # error You either need at least GCC 4.8 or Clang 3.4 or XCode Clang 5.1 t= o compile libvirt --=20 2.29.2 From nobody Sun May 19 00:17:15 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=1614795542; cv=none; d=zohomail.com; s=zohoarc; b=IWJuEq/2UwJPw4ZlZywShhaxSMMaGewe2J0YmgXREBQt1ozlRgcDGZkt70pkTZz7Lz+iFrtsMU4WNL6UUdqZUISJsxRghiNE9EObnb2hL/YfB4X1KT/E8Qvb8L254p6HNGR9bl146mucUiMsjGPtGfU83zHHd1PnK1vQ96k63C8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614795542; 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=/+JhV/czoEXwQWvho7ZRtdRAx/c1gYx8yahsFwn1WY8=; b=irYpCIRiM/+kBBnbm+lTtaUF/Lrvsn3maY1DRyDeOr5pwlpYMUJS7WERkK+T04uXTPzj0t521zKj15A/XtLjvvCepZnUDnUuijJcjIn7aBjJZ9SYinj8mUV4NcX14AG6LDwMjGm1AgxGRypbB6vv+aK3IGKKRdUHKAt68gUtZKw= 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) header.from= 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 1614795542394336.76596703960195; Wed, 3 Mar 2021 10:19:02 -0800 (PST) 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-44-n2DCk3mXPyKwbJyf2YTR8A-1; Wed, 03 Mar 2021 13:18:58 -0500 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 6204E18C35BF; Wed, 3 Mar 2021 18:18:53 +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 13A135D9C6; Wed, 3 Mar 2021 18:18:53 +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 D4F9D18095CB; Wed, 3 Mar 2021 18:18:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 123IImD0032355 for ; Wed, 3 Mar 2021 13:18:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9E96560C13; Wed, 3 Mar 2021 18:18:48 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-145.ams2.redhat.com [10.36.115.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBAED60BFA; Wed, 3 Mar 2021 18:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614795541; 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=/+JhV/czoEXwQWvho7ZRtdRAx/c1gYx8yahsFwn1WY8=; b=GcxNQhSf5YsI8JB76kYwxep4Ea9iaiCC/1yR0L6cX1ADJROnBzb+LXetN7t85K714qGm6G NYJJ8CbFJ1vvbObp0hSA6hi6YDD7Ocnw4EOb/lUZ4MpJ+kgDXJYQiYo8VoY4VAOW19d0Kr 1+0DPv4XE+mU8Mu/tBTXfP4m2Bpsy+Y= X-MC-Unique: n2DCk3mXPyKwbJyf2YTR8A-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 02/18] conf: stronger error reporting when parsing audio related params Date: Wed, 3 Mar 2021 18:18:18 +0000 Message-Id: <20210303181834.1578756-3-berrange@redhat.com> In-Reply-To: <20210303181834.1578756-1-berrange@redhat.com> References: <20210303181834.1578756-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Check for varuous mandatory elements and improve error message clarity Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik Reviewed-by: Neal Gompa --- src/conf/domain_conf.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b731744f04..d30ca627aa 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13794,6 +13794,11 @@ virDomainSoundDefParseXML(virDomainXMLOptionPtr xm= lopt, if (audioNode) { g_autofree char *tmp =3D NULL; tmp =3D virXMLPropString(audioNode, "id"); + if (!tmp) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing audio 'id' attribute")); + goto error; + } if (virStrToLong_ui(tmp, NULL, 10, &def->audioId) < 0 || def->audioId =3D=3D 0) { virReportError(VIR_ERR_XML_ERROR, @@ -13867,6 +13872,12 @@ virDomainAudioDefParseXML(virDomainXMLOptionPtr xm= lopt G_GNUC_UNUSED, ctxt->node =3D node; =20 type =3D virXMLPropString(node, "type"); + if (!type) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing audio 'type' attribute")); + goto error; + } + if ((def->type =3D virDomainAudioTypeTypeFromString(type)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown audio type '%s'"), type); @@ -13874,6 +13885,11 @@ virDomainAudioDefParseXML(virDomainXMLOptionPtr xm= lopt G_GNUC_UNUSED, } =20 tmp =3D virXMLPropString(node, "id"); + if (!tmp) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("missing audio 'id' attribute")); + goto error; + } if (virStrToLong_ui(tmp, NULL, 10, &def->id) < 0 || def->id =3D=3D 0) { virReportError(VIR_ERR_XML_ERROR, --=20 2.29.2 From nobody Sun May 19 00:17:15 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=1614795609; cv=none; d=zohomail.com; s=zohoarc; b=FdFjJWoflsb/nPS/mrN+jMb2b2TSrq0jPPJdiMj0ethXbIvosRCGeqrz9GL647VRRJ3wi4pDiqpF7SsJp4YiHc1uktH9lQamtoYa6IiAHl2sHxqFgE6+BxFJBpiJv3WMRZSPBkw8DsyNC4mI6X1DYgctAN7LC3kMLWTT0BAK0JY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614795609; 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=9wPlvhnl/Vh1zsnibEB4z1FeVAFi5F8ENJuAKul4zKQ=; b=BnXhaZIdLEqia563rbmbJApLWTKrazXicGiDELJw9o2jMmbkSJzABjR64ew5I8WPPTdVSvT9L+G6jqbRHb5GIJpdy1F9UrdtH6TgVerTR6arMK48P9gOMO2bFrUE9/QPp82y9sZZY13YrLhT2S7aYpaWgd7xIeefshQ7NgYuWZQ= 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) header.from= 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 1614795609652813.9164873220071; Wed, 3 Mar 2021 10:20:09 -0800 (PST) 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-529-Ihue2S8RNfq_zgQLI55ONg-1; Wed, 03 Mar 2021 13:19:17 -0500 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 43D92801A88; Wed, 3 Mar 2021 18:19:09 +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 17EC016558; Wed, 3 Mar 2021 18:19:09 +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 D16C618089C9; Wed, 3 Mar 2021 18:19:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 123IInLe032362 for ; Wed, 3 Mar 2021 13:18:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id BDC5D60C15; Wed, 3 Mar 2021 18:18:49 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-145.ams2.redhat.com [10.36.115.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C2F360BFA; Wed, 3 Mar 2021 18:18:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614795608; 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=9wPlvhnl/Vh1zsnibEB4z1FeVAFi5F8ENJuAKul4zKQ=; b=WzmkCdn2z4fAzoVZgcoWp3dsxf5nRLBKGov8KnE9CcbHRhQa3/5xSvZnJHve9bJkiJ7b3Y GfTFIDhMRm27sqNeIjF9FELRXJYFdWiGtKgYr9Uwz0hrs1aTIYtdDUSngMtZE6rf5k9iD8 amyB8HiIHkA0pyLPDnxb8/LGy3RK3iE= X-MC-Unique: Ihue2S8RNfq_zgQLI55ONg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 03/18] conf: don't force existance of audio child elements Date: Wed, 3 Mar 2021 18:18:19 +0000 Message-Id: <20210303181834.1578756-4-berrange@redhat.com> In-Reply-To: <20210303181834.1578756-1-berrange@redhat.com> References: <20210303181834.1578756-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The attributes on the elements are optional, so we should not force the elements themselves to be present, especially since we omit them when formating the XML thus breaking round-tripping. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik Reviewed-by: Neal Gompa --- src/conf/domain_conf.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d30ca627aa..b6c50f54e5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13904,15 +13904,10 @@ virDomainAudioDefParseXML(virDomainXMLOptionPtr x= mlopt G_GNUC_UNUSED, inputDevNode =3D virXPathNode("./input", ctxt); outputDevNode =3D virXPathNode("./output", ctxt); =20 - if (!inputDevNode || !outputDevNode) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Audio type OSS requires to have " - "and specified")); - goto error; - } - - def->backend.oss.inputDev =3D virXMLPropString(inputDevNode, "dev"= ); - def->backend.oss.outputDev =3D virXMLPropString(outputDevNode, "de= v"); + if (inputDevNode) + def->backend.oss.inputDev =3D virXMLPropString(inputDevNode, "= dev"); + if (outputDevNode) + def->backend.oss.outputDev =3D virXMLPropString(outputDevNode,= "dev"); break; } =20 --=20 2.29.2 From nobody Sun May 19 00:17:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614795542; cv=none; d=zohomail.com; s=zohoarc; b=Ejgk3jHS73pyWOYYSTS+Bm51gzmdr6K+xbywNJtE8qjzgrDiUUSxWuLkxRCHtM4es+LT4XuIbPqP2bTbHGZx0SMfwb37Kz3jU+WWUNyL5pz+APqBdvQ6nDrxp/T4H9BibNr19dls7/6yElqS0RxMdht2WOPUop5Wq8GsOidSEoI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614795542; 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=QMmGAlsbH8gxMICoh87U/EDEjnwLoZNKavsZtl6jhvk=; b=Wg9nTBVmOl1SAvs2ZSJxJuanqG+zFZYm1Eb0Mqyf4CBQbcAh+NR75U37gmfceLr2ySXh0wVhHmN4lE3WtBbrR40L0bunLnSa+gxS/ReEo6h8D2I0WCQ32cLdNEI6U50B+D1lK0swFjXt5t6ttvq9GcUcr8BCLzKiSVPoOjEPyCM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614795542105990.664204999925; Wed, 3 Mar 2021 10:19:02 -0800 (PST) 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-346-xPWFBdDNOdmZkpotqVzzxw-1; Wed, 03 Mar 2021 13:18:58 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7710F10082F8; Wed, 3 Mar 2021 18:18:53 +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 5066470956; Wed, 3 Mar 2021 18:18:53 +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 DB7D718095C7; Wed, 3 Mar 2021 18:18:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 123IIo64032372 for ; Wed, 3 Mar 2021 13:18:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id F11BD60C15; Wed, 3 Mar 2021 18:18:50 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-145.ams2.redhat.com [10.36.115.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13D0060BFA; Wed, 3 Mar 2021 18:18:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614795541; 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=QMmGAlsbH8gxMICoh87U/EDEjnwLoZNKavsZtl6jhvk=; b=T4ZOinBHorSVmzurrcj2Nwp4hkKSl1x8crSqbUpQI4pa72cpg8+VJl4wBAf6r79vUOpVg6 Vp3gMpuaIg6irJV95yUCCGfz2AGslT3kiQ8Lzz1cdp56HFvPv/3rR+jQjqMJxyRUxTPpNe ZbRFYhWAMS9/HgTFwRBP2mvSjEDTCDA= X-MC-Unique: xPWFBdDNOdmZkpotqVzzxw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 04/18] conf: add helper to test for sound device codec support Date: Wed, 3 Mar 2021 18:18:20 +0000 Message-Id: <20210303181834.1578756-5-berrange@redhat.com> In-Reply-To: <20210303181834.1578756-1-berrange@redhat.com> References: <20210303181834.1578756-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.13 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The check for ICH6 || ICH9 is repeated in many places in the code. The new virDomainSoundModelSupportsCodecs() method provides a helper to standardize this check. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik Reviewed-by: Neal Gompa --- src/conf/domain_conf.c | 11 +++++++++-- src/conf/domain_conf.h | 2 ++ src/libvirt_private.syms | 1 + src/qemu/qemu_command.c | 4 +--- src/qemu/qemu_validate.c | 3 +-- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b6c50f54e5..2837ad67a7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13764,8 +13764,7 @@ virDomainSoundDefParseXML(virDomainXMLOptionPtr xml= opt, goto error; } =20 - if (def->model =3D=3D VIR_DOMAIN_SOUND_MODEL_ICH6 || - def->model =3D=3D VIR_DOMAIN_SOUND_MODEL_ICH9) { + if (virDomainSoundModelSupportsCodecs(def)) { int ncodecs; g_autofree xmlNodePtr *codecNodes =3D NULL; =20 @@ -30376,6 +30375,14 @@ virDomainDefFindAudioForSound(virDomainDefPtr def, } =20 =20 +bool +virDomainSoundModelSupportsCodecs(virDomainSoundDefPtr def) +{ + return def->model =3D=3D VIR_DOMAIN_SOUND_MODEL_ICH6 || + def->model =3D=3D VIR_DOMAIN_SOUND_MODEL_ICH9; +} + + char * virDomainObjGetMetadata(virDomainObjPtr vm, int type, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 930eed60de..8f2e559884 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3785,6 +3785,8 @@ int virDomainDefFindDevice(virDomainDefPtr def, virDomainAudioDefPtr virDomainDefFindAudioForSound(virDomainDefPtr def, virDomainSoundDefPtr sound); +bool +virDomainSoundModelSupportsCodecs(virDomainSoundDefPtr def); =20 const char *virDomainChrSourceDefGetPath(virDomainChrSourceDefPtr chr); =20 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 6b7261b987..2b7bfe76b5 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -618,6 +618,7 @@ virDomainSmbiosModeTypeToString; virDomainSoundDefFind; virDomainSoundDefFree; virDomainSoundDefRemove; +virDomainSoundModelSupportsCodecs; virDomainSoundModelTypeFromString; virDomainSoundModelTypeToString; virDomainStartupPolicyTypeFromString; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f255b0f881..4785dfb791 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4101,9 +4101,7 @@ qemuBuildSoundCommandLine(virCommandPtr cmd, return -1; =20 virCommandAddArg(cmd, str); - if (sound->model =3D=3D VIR_DOMAIN_SOUND_MODEL_ICH6 || - sound->model =3D=3D VIR_DOMAIN_SOUND_MODEL_ICH9) { - + if (virDomainSoundModelSupportsCodecs(sound)) { for (j =3D 0; j < sound->ncodecs; j++) { g_autofree char *codecstr =3D NULL; virCommandAddArg(cmd, "-device"); diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index b9971b66bb..d24300b305 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -4199,8 +4199,7 @@ qemuValidateDomainDeviceDefSound(virDomainSoundDefPtr= sound, return -1; } =20 - if (sound->model =3D=3D VIR_DOMAIN_SOUND_MODEL_ICH6 || - sound->model =3D=3D VIR_DOMAIN_SOUND_MODEL_ICH9) { + if (virDomainSoundModelSupportsCodecs(sound)) { for (i =3D 0; i < sound->ncodecs; i++) { const char *stype; int type, flags; --=20 2.29.2 From nobody Sun May 19 00:17:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614795558; cv=none; d=zohomail.com; s=zohoarc; b=LuJka/3AVMEhS5kOBrMAuxgXVjYr2edWwH605d/qqlTfcwPf+zWwJMIb/CSgAsKbph8BJK/NRsuZdl6bDT/PUs6vNa4wGpjnL2l1qPlqjOW7X6murbD8im56OPKU1WBvYh4ae4dIRzYj8Y75iHKbeYlnKJpeS/EEwNVpGi85Rck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614795558; 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=hvmcjSl59dwjRa+LxkLMGYdzRgmI7QF0qb4z0phDx4s=; b=ad0N9dWTSnPWdgxNcB6UkBltBpwC0bPUoaNt/aOuF9wEuvudO31nuSnIvldS0+6jYqxLcshUzGvqykNgYUxU65FtQu3xex/LSyoqbRq3D6vUyCeLFm1SlutNh0g9r31tRIdYLihk2cOjIxS8RnNzdWY9EK33S3MVwtDohqgN3Zs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614795558899535.90350579027; Wed, 3 Mar 2021 10:19:18 -0800 (PST) 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-464-ZhW5InhKNYqGfa8DEC9Jbg-1; Wed, 03 Mar 2021 13:19:14 -0500 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 EE0DB85B668; Wed, 3 Mar 2021 18:19:07 +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 C402C100164C; Wed, 3 Mar 2021 18:19:07 +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 859C150032; Wed, 3 Mar 2021 18:19:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 123IIqFq032383 for ; Wed, 3 Mar 2021 13:18:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 066CC60C13; Wed, 3 Mar 2021 18:18:52 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-145.ams2.redhat.com [10.36.115.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4967A60BFA; Wed, 3 Mar 2021 18:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614795557; 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=hvmcjSl59dwjRa+LxkLMGYdzRgmI7QF0qb4z0phDx4s=; b=DDjZNMnOIvPcB6B7zMt3WwUGD0Ilu01r+UCXDOzMIV6oiT63e5ADUrnLM1ATjmCDsoYUHa Qqu/B2N8z3qHwZI3edRN3JaNVqR18RN3jzwF7LLjhXpylv96MNUSUZofKukG4TNWLsRqAi WyM7gE+plox/8dfDSZR+Y9SEOEgT+p8= X-MC-Unique: ZhW5InhKNYqGfa8DEC9Jbg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 05/18] conf: add missing iteration over audio backends Date: Wed, 3 Mar 2021 18:18:21 +0000 Message-Id: <20210303181834.1578756-6-berrange@redhat.com> In-Reply-To: <20210303181834.1578756-1-berrange@redhat.com> References: <20210303181834.1578756-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Fixes 9375bc7373caddd31f1ac5c14a69eac5096ea416 Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik Reviewed-by: Neal Gompa --- src/conf/domain_conf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2837ad67a7..34d1673546 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4411,6 +4411,12 @@ virDomainDeviceInfoIterateFlags(virDomainDefPtr def, if ((rc =3D cb(def, &device, NULL, opaque)) !=3D 0) return rc; } + device.type =3D VIR_DOMAIN_DEVICE_AUDIO; + for (i =3D 0; i < def->naudios; i++) { + device.data.audio =3D def->audios[i]; + if ((rc =3D cb(def, &device, NULL, opaque)) !=3D 0) + return rc; + } device.type =3D VIR_DOMAIN_DEVICE_LEASE; for (i =3D 0; i < def->nleases; i++) { device.data.lease =3D def->leases[i]; --=20 2.29.2 From nobody Sun May 19 00:17:15 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=1614795563; cv=none; d=zohomail.com; s=zohoarc; b=PGz7I0QMnJuVfDdUjehVUURbVtHCH0Rz8A9F4JOVSjBC1VYEldzOHBnXES9l1JoViT4i3N5dxpdzGGQe9FqeIa7hd8te/2l9XQBWNL5b+IaSIanUCwyGSuUsZWNT57cKu/46pNLcwfIYcq1XlRh2WBMAHclUtTq9ICK2+IE14HQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614795563; 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=yL182VT6KR4JnGar7GQ2JAun72VsnZ7FTpiBMZtJADw=; b=F3VJvUtrEqFmkbIOJqDwB+hd624QpY1wAqPDrLZXHkx6/TCk69u747SKtJaVCKJpyhMUo2bQ9UaFHFXutF4uwMWRkYint9vzL4p7vWqI1qWCHzPSOLDyiXXS+Z0V2zm69csR3zep/nwmq+nAsKqeiNYqaUsACnoocvSX9Z0tJms= 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) header.from= 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 161479556318853.204780002832536; Wed, 3 Mar 2021 10:19:23 -0800 (PST) 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-489-kgkhQxOaPXqXx7rPClB33A-1; Wed, 03 Mar 2021 13:19:19 -0500 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 4702118C35D0; Wed, 3 Mar 2021 18:19: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 14BCC1F040; Wed, 3 Mar 2021 18:19: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 C411B18089E0; Wed, 3 Mar 2021 18:19:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 123IIr3A032393 for ; Wed, 3 Mar 2021 13:18:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0BD2A60C43; Wed, 3 Mar 2021 18:18:53 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-145.ams2.redhat.com [10.36.115.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 524B060BFA; Wed, 3 Mar 2021 18:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614795562; 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=yL182VT6KR4JnGar7GQ2JAun72VsnZ7FTpiBMZtJADw=; b=BVYWUI5/sOenKbRwKK3bRDMUiADCrIEyR1l4uYn9Nj/7muTmSx8Wloc9Hf8sLnqUPFBVr9 RicUqq3aLNRmKfUtAmz2rNtc67z3sXPD1V9Cph4rAwz5jrN5Whd/FEME5seEWHAyxPpzUS rb95G9x0Jklae+UPQKuhn0caVRSAo0E= X-MC-Unique: kgkhQxOaPXqXx7rPClB33A-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 06/18] conf: refactor OSS audio backend specific options Date: Wed, 3 Mar 2021 18:18:22 +0000 Message-Id: <20210303181834.1578756-7-berrange@redhat.com> In-Reply-To: <20210303181834.1578756-1-berrange@redhat.com> References: <20210303181834.1578756-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) To prepare for the introduction for more backend specific audio options, move the OSS options into a dedicated struct and introduce separate helper methods for parse/format/free. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik Reviewed-by: Neal Gompa --- docs/schemas/domaincommon.rng | 17 +++++--- src/bhyve/bhyve_command.c | 8 ++-- src/conf/domain_conf.c | 77 ++++++++++++++++++++++++++--------- src/conf/domain_conf.h | 9 +++- 4 files changed, 79 insertions(+), 32 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index d73db65742..efa1806a3a 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4513,6 +4513,15 @@ + + + + + + + + + @@ -4526,16 +4535,12 @@ - - - + - - - + diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index a963338654..e60a6bd393 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -514,13 +514,13 @@ bhyveBuildSoundArgStr(const virDomainDef *def G_GNUC_= UNUSED, if (audio) { switch ((virDomainAudioType) audio->type) { case VIR_DOMAIN_AUDIO_TYPE_OSS: - if (audio->backend.oss.inputDev) + if (audio->backend.oss.input.dev) virBufferAsprintf(¶ms, ",play=3D%s", - audio->backend.oss.inputDev); + audio->backend.oss.input.dev); =20 - if (audio->backend.oss.outputDev) + if (audio->backend.oss.output.dev) virBufferAsprintf(¶ms, ",rec=3D%s", - audio->backend.oss.outputDev); + audio->backend.oss.output.dev); =20 break; =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 34d1673546..d5969c79a0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2889,15 +2889,22 @@ void virDomainSoundDefFree(virDomainSoundDefPtr def) g_free(def); } =20 -void virDomainAudioDefFree(virDomainAudioDefPtr def) +static void +virDomainAudioIOOSSFree(virDomainAudioIOOSS *def) +{ + g_free(def->dev); +} + +void +virDomainAudioDefFree(virDomainAudioDefPtr def) { if (!def) return; =20 switch ((virDomainAudioType) def->type) { case VIR_DOMAIN_AUDIO_TYPE_OSS: - g_free(def->backend.oss.inputDev); - g_free(def->backend.oss.outputDev); + virDomainAudioIOOSSFree(&def->backend.oss.input); + virDomainAudioIOOSSFree(&def->backend.oss.output); break; =20 case VIR_DOMAIN_AUDIO_TYPE_LAST: @@ -13863,6 +13870,16 @@ virDomainSoundDefFind(const virDomainDef *def, } =20 =20 +static int +virDomainAudioOSSParse(virDomainAudioIOOSS *def, + xmlNodePtr node) +{ + def->dev =3D virXMLPropString(node, "dev"); + + return 0; +} + + static virDomainAudioDefPtr virDomainAudioDefParseXML(virDomainXMLOptionPtr xmlopt G_GNUC_UNUSED, xmlNodePtr node G_GNUC_UNUSED, @@ -13872,6 +13889,7 @@ virDomainAudioDefParseXML(virDomainXMLOptionPtr xml= opt G_GNUC_UNUSED, VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autofree char *tmp =3D NULL; g_autofree char *type =3D NULL; + xmlNodePtr inputNode, outputNode; =20 def =3D g_new0(virDomainAudioDef, 1); ctxt->node =3D node; @@ -13902,19 +13920,16 @@ virDomainAudioDefParseXML(virDomainXMLOptionPtr x= mlopt G_GNUC_UNUSED, goto error; } =20 - switch ((virDomainAudioType) def->type) { - case VIR_DOMAIN_AUDIO_TYPE_OSS: { - xmlNodePtr inputDevNode, outputDevNode; - - inputDevNode =3D virXPathNode("./input", ctxt); - outputDevNode =3D virXPathNode("./output", ctxt); + inputNode =3D virXPathNode("./input", ctxt); + outputNode =3D virXPathNode("./output", ctxt); =20 - if (inputDevNode) - def->backend.oss.inputDev =3D virXMLPropString(inputDevNode, "= dev"); - if (outputDevNode) - def->backend.oss.outputDev =3D virXMLPropString(outputDevNode,= "dev"); + switch ((virDomainAudioType) def->type) { + case VIR_DOMAIN_AUDIO_TYPE_OSS: + if (inputNode) + virDomainAudioOSSParse(&def->backend.oss.input, inputNode); + if (outputNode) + virDomainAudioOSSParse(&def->backend.oss.output, outputNode); break; - } =20 case VIR_DOMAIN_AUDIO_TYPE_LAST: break; @@ -26381,11 +26396,34 @@ virDomainSoundDefFormat(virBufferPtr buf, } =20 =20 +static void +virDomainAudioCommonFormat(virBufferPtr childBuf, + virBufferPtr backendAttrBuf, + const char *direction) +{ + if (virBufferUse(backendAttrBuf)) { + virBufferAsprintf(childBuf, "<%s", direction); + virBufferAdd(childBuf, virBufferCurrentContent(backendAttrBuf), -1= ); + virBufferAddLit(childBuf, "/>\n"); + } +} + + +static void +virDomainAudioOSSFormat(virDomainAudioIOOSS *def, + virBufferPtr buf) +{ + virBufferEscapeString(buf, " dev=3D'%s'", def->dev); +} + + static int virDomainAudioDefFormat(virBufferPtr buf, virDomainAudioDefPtr def) { g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); + g_auto(virBuffer) inputBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) outputBuf =3D VIR_BUFFER_INITIALIZER; const char *type =3D virDomainAudioTypeTypeToString(def->type); =20 if (!type) { @@ -26398,15 +26436,14 @@ virDomainAudioDefFormat(virBufferPtr buf, =20 switch (def->type) { case VIR_DOMAIN_AUDIO_TYPE_OSS: - if (def->backend.oss.inputDev) - virBufferAsprintf(&childBuf, "\n", - def->backend.oss.inputDev); - if (def->backend.oss.outputDev) - virBufferAsprintf(&childBuf, "\n", - def->backend.oss.outputDev); + virDomainAudioOSSFormat(&def->backend.oss.input, &inputBuf); + virDomainAudioOSSFormat(&def->backend.oss.output, &outputBuf); break; } =20 + virDomainAudioCommonFormat(&childBuf, &inputBuf, "input"); + virDomainAudioCommonFormat(&childBuf, &outputBuf, "output"); + if (virBufferUse(&childBuf)) { virBufferAddLit(buf, ">\n"); virBufferAddBuffer(buf, &childBuf); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 8f2e559884..977dd48cc3 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1451,6 +1451,11 @@ typedef enum { VIR_DOMAIN_AUDIO_TYPE_LAST } virDomainAudioType; =20 +typedef struct _virDomainAudioIOOSS virDomainAudioIOOSS; +struct _virDomainAudioIOOSS { + char *dev; +}; + struct _virDomainAudioDef { int type; =20 @@ -1458,8 +1463,8 @@ struct _virDomainAudioDef { =20 union { struct { - char *inputDev; - char *outputDev; + virDomainAudioIOOSS input; + virDomainAudioIOOSS output; } oss; } backend; }; --=20 2.29.2 From nobody Sun May 19 00:17:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1614795555; cv=none; d=zohomail.com; s=zohoarc; b=E9wGo+J3dzZg2lPblbhcTOPiRk0eilGIdnGEohaxXpTObbvCGMd3jK1E+zKFcPHuCXG+XBTBxiL4fyKbhh3SYxWi9wBg/10oOWb+IYOvZv1y4WzMLGUxe9UvOEcEpxo2Ndi4nHSZp+YLui5X3720mzC9/SC3/MZJnhi4rxaF5/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614795555; 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=SM3nKKvxnJQQkF1R23LZkiuXd7uk2R+D9/MShxzH2/8=; b=KIiMyO6cTd2uB2M/gQE183M9qGXhJEGUUaPpyGlXAUyhoIkNMRGPGyF543a9g107WlgvY9gyjK72O4yXz4Bp5pVTbiAONzqobdrN0bDgHBnnnArd9OHQe1vcwHHZVe+qD7WEY+tAMkJiIbEaUmQHjmVZP9/Rn1Gbk+ck4BCobTE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614795555662223.02530840534007; Wed, 3 Mar 2021 10:19:15 -0800 (PST) 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-356-aGdbi8JCM4aiPR1iW0AtWA-1; Wed, 03 Mar 2021 13:19:12 -0500 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 61F5E100961D; Wed, 3 Mar 2021 18:19:06 +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 0A111100164C; Wed, 3 Mar 2021 18:19:06 +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 B94501809C91; Wed, 3 Mar 2021 18:19:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 123IIsVa032406 for ; Wed, 3 Mar 2021 13:18:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2BD3760C15; Wed, 3 Mar 2021 18:18:54 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-145.ams2.redhat.com [10.36.115.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6881660BFA; Wed, 3 Mar 2021 18:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614795554; 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=SM3nKKvxnJQQkF1R23LZkiuXd7uk2R+D9/MShxzH2/8=; b=KCqtGV71xXL5z6ZH7MnzcV1XjVjRVrj4CFG4f+cGGCQdPc9jdEk1iPDwt747R67eyXt75s t4C5DSK3XvWrx4KDpMI2dOUZow1/Qd0SWWEnKwZdkEZpcpL9K/OKjXSy5EGCZF5VmjZu7m PXhOaFeQ+YJmwvaGznXqkS5YF5vvKzM= X-MC-Unique: aGdbi8JCM4aiPR1iW0AtWA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 07/18] conf: add coverage for all QEMU audio backend types Date: Wed, 3 Mar 2021 18:18:23 +0000 Message-Id: <20210303181834.1578756-8-berrange@redhat.com> In-Reply-To: <20210303181834.1578756-1-berrange@redhat.com> References: <20210303181834.1578756-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The current diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index e60a6bd393..b03a1f26b7 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -524,11 +524,22 @@ bhyveBuildSoundArgStr(const virDomainDef *def G_GNUC_= UNUSED, =20 break; =20 - case VIR_DOMAIN_AUDIO_TYPE_LAST: + case VIR_DOMAIN_AUDIO_TYPE_NONE: + case VIR_DOMAIN_AUDIO_TYPE_ALSA: + case VIR_DOMAIN_AUDIO_TYPE_COREAUDIO: + case VIR_DOMAIN_AUDIO_TYPE_JACK: + case VIR_DOMAIN_AUDIO_TYPE_PULSEAUDIO: + case VIR_DOMAIN_AUDIO_TYPE_SDL: + case VIR_DOMAIN_AUDIO_TYPE_SPICE: + case VIR_DOMAIN_AUDIO_TYPE_FILE: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported audio backend '%s'"), virDomainAudioTypeTypeToString(audio->type)); return -1; + case VIR_DOMAIN_AUDIO_TYPE_LAST: + default: + virReportEnumRangeError(virDomainAudioType, def->type); + return -1; } } =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d5969c79a0..b2a232a8d0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -736,7 +736,24 @@ VIR_ENUM_IMPL(virDomainSoundModel, =20 VIR_ENUM_IMPL(virDomainAudioType, VIR_DOMAIN_AUDIO_TYPE_LAST, + "none", + "alsa", + "coreaudio", + "jack", "oss", + "pulseaudio", + "sdl", + "spice", + "file", +); + +VIR_ENUM_IMPL(virDomainAudioSDLDriver, + VIR_DOMAIN_AUDIO_SDL_DRIVER_LAST, + "", + "esd", + "alsa", + "arts", + "pulseaudio", ); =20 VIR_ENUM_IMPL(virDomainKeyWrapCipherName, @@ -2902,11 +2919,35 @@ virDomainAudioDefFree(virDomainAudioDefPtr def) return; =20 switch ((virDomainAudioType) def->type) { + case VIR_DOMAIN_AUDIO_TYPE_NONE: + break; + + case VIR_DOMAIN_AUDIO_TYPE_ALSA: + break; + + case VIR_DOMAIN_AUDIO_TYPE_COREAUDIO: + break; + + case VIR_DOMAIN_AUDIO_TYPE_JACK: + break; + case VIR_DOMAIN_AUDIO_TYPE_OSS: virDomainAudioIOOSSFree(&def->backend.oss.input); virDomainAudioIOOSSFree(&def->backend.oss.output); break; =20 + case VIR_DOMAIN_AUDIO_TYPE_PULSEAUDIO: + break; + + case VIR_DOMAIN_AUDIO_TYPE_SDL: + break; + + case VIR_DOMAIN_AUDIO_TYPE_SPICE: + break; + + case VIR_DOMAIN_AUDIO_TYPE_FILE: + break; + case VIR_DOMAIN_AUDIO_TYPE_LAST: break; } @@ -13924,6 +13965,18 @@ virDomainAudioDefParseXML(virDomainXMLOptionPtr xm= lopt G_GNUC_UNUSED, outputNode =3D virXPathNode("./output", ctxt); =20 switch ((virDomainAudioType) def->type) { + case VIR_DOMAIN_AUDIO_TYPE_NONE: + break; + + case VIR_DOMAIN_AUDIO_TYPE_ALSA: + break; + + case VIR_DOMAIN_AUDIO_TYPE_COREAUDIO: + break; + + case VIR_DOMAIN_AUDIO_TYPE_JACK: + break; + case VIR_DOMAIN_AUDIO_TYPE_OSS: if (inputNode) virDomainAudioOSSParse(&def->backend.oss.input, inputNode); @@ -13931,7 +13984,28 @@ virDomainAudioDefParseXML(virDomainXMLOptionPtr xm= lopt G_GNUC_UNUSED, virDomainAudioOSSParse(&def->backend.oss.output, outputNode); break; =20 + case VIR_DOMAIN_AUDIO_TYPE_PULSEAUDIO: + break; + + case VIR_DOMAIN_AUDIO_TYPE_SDL: { + g_autofree char *driver =3D virXMLPropString(node, "driver"); + if (driver && + (def->backend.sdl.driver =3D + virDomainAudioSDLDriverTypeFromString(driver)) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown SDL driver '%s'"), driver); + goto error; + } + break; + } + + case VIR_DOMAIN_AUDIO_TYPE_SPICE: + case VIR_DOMAIN_AUDIO_TYPE_FILE: + break; + case VIR_DOMAIN_AUDIO_TYPE_LAST: + default: + virReportEnumRangeError(virDomainAudioType, def->type); break; } =20 @@ -26434,11 +26508,44 @@ virDomainAudioDefFormat(virBufferPtr buf, =20 virBufferAsprintf(buf, "
`` which can= tie the device to a particular PCI slot, `documented above <#elementsAddress>`= __. =20 -:since:`Since 6.7.0`, a sound device could be optionally mapped to the spe= cific -host audio backend using the ``` =20 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index d27de58b42..330a600539 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3692,7 +3692,16 @@ keep - + + + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b2a232a8d0..c3a21b4c78 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13204,6 +13204,8 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsDe= fPtr def, g_autofree char *websocketGenerated =3D virXMLPropString(node, "websoc= ketGenerated"); g_autofree char *sharePolicy =3D virXMLPropString(node, "sharePolicy"); g_autofree char *autoport =3D virXMLPropString(node, "autoport"); + xmlNodePtr audioNode; + VIR_XPATH_NODE_AUTORESTORE(ctxt) =20 if (virDomainGraphicsListensParseXML(def, node, ctxt, flags) < 0) return -1; @@ -13262,6 +13264,24 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsD= efPtr def, =20 def->data.vnc.keymap =3D virXMLPropString(node, "keymap"); =20 + ctxt->node =3D node; + audioNode =3D virXPathNode("./audio", ctxt); + if (audioNode) { + g_autofree char *tmp =3D NULL; + tmp =3D virXMLPropString(audioNode, "id"); + if (!tmp) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing audio 'id' attribute")); + return -1; + } + if (virStrToLong_ui(tmp, NULL, 10, &def->data.vnc.audioId) < 0 || + def->data.vnc.audioId =3D=3D 0) { + virReportError(VIR_ERR_XML_ERROR, + _("Invalid audio 'id' value '%s'"), tmp); + return -1; + } + } + if (virDomainGraphicsAuthDefParseXML(node, &def->data.vnc.auth, def->type) < 0) return -1; @@ -27529,6 +27549,18 @@ virDomainGraphicsDefFormat(virBufferPtr buf, virDomainSpiceGLDefFormat(buf, def); } =20 + if (def->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_VNC) { + if (!children) { + virBufferAddLit(buf, ">\n"); + virBufferAdjustIndent(buf, 2); + children =3D true; + } + + if (def->data.vnc.audioId > 0) + virBufferAsprintf(buf, "
+ + +
+ + +
+ + + + +
+ + +
+ + +
+ + + + +
+ + +
+ + +
+ + + + +