From nobody Fri May 3 21:05:50 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=1615394598; cv=none; d=zohomail.com; s=zohoarc; b=DeBBM+qGYvUhDhdFtUMy5+d7nQLF4pqK33Pmw6wmPvdkjDlqMcM+BazUAmm2HAqgZQLWko9koW36WTPuXY4+EZkE9hO4xL+DbQARBJ5oliuOVF99++mznYsMjzlVf+cmPkAh5ZLk4sPYYQBcmUeD3jtn/NVYeXIOa4SjL0I56i8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615394598; 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=K/w2qXJ+nd1yD2s498YJ438pDzrbGN8T/CP4mHJiDB0=; b=muxQbmEqgZXszxWBY5FwkucnGhk+dvshFDpOcasUZQwaYlhBrq1WEtnQYXuy/q/JzjT3JngPeGaN6X74JQsw+zKURjZxKFuBsOTknl0FDoFozlKrEF21Xc5pHgLffC/hsu9ryYZinWnvVsYirIGTjYCdMfMMke1Xd/SmOkzGlHg= 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 1615394598770229.53326181175726; Wed, 10 Mar 2021 08:43: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-239-79g9hjtMN-CBEX45NFr_NA-1; Wed, 10 Mar 2021 11:43:14 -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 9BBC083DE78; Wed, 10 Mar 2021 16:43:08 +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 6C93AE15A; Wed, 10 Mar 2021 16:43:08 +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 E9B1C57DC4; Wed, 10 Mar 2021 16:43:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12AGh6Q5023182 for ; Wed, 10 Mar 2021 11:43:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 33B235C23E; Wed, 10 Mar 2021 16:43:06 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.194.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 481CC5C1A1 for ; Wed, 10 Mar 2021 16:43:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615394597; 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=K/w2qXJ+nd1yD2s498YJ438pDzrbGN8T/CP4mHJiDB0=; b=CSRo7IdDiVzTI6lG/Oo8JAX7bIfSTdL4Cbl0hfEvLtxTa5u1PZqYfWoQEvdKhk+/XfZD5O GgeMh4eTxieNq/LIuQWSctpsegrsYFRFQsbXq6Ze5nq8Tu7WFuZq5H1xmHtcxinAqUVKSv Oj3KRkplNkHxoQtHD+3QM5o7zQ1NQtA= X-MC-Unique: 79g9hjtMN-CBEX45NFr_NA-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH v2 1/2] move virDomainCheckVirtioOptionsAreAbsent a few lines forward Date: Wed, 10 Mar 2021 17:42:50 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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) Content-Type: text/plain; charset="utf-8" Moving this function in order to use it in the next patch before its previous declaration. Signed-off-by: Kristina Hanicova Reviewed-by: Michal Privoznik --- src/conf/domain_validate.c | 56 +++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index b4e09e21fe..dabdd7b8eb 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -78,6 +78,34 @@ virDomainDefVideoValidate(const virDomainDef *def) } =20 =20 +static int +virDomainCheckVirtioOptionsAreAbsent(virDomainVirtioOptionsPtr virtio) +{ + if (!virtio) + return 0; + + if (virtio->iommu !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iommu driver option is only supported " + "for virtio devices")); + return -1; + } + if (virtio->ats !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("ats driver option is only supported " + "for virtio devices")); + return -1; + } + if (virtio->packed !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("packed driver option is only supported " + "for virtio devices")); + return -1; + } + return 0; +} + + static int virDomainVideoDefValidate(const virDomainVideoDef *video, const virDomainDef *def) @@ -228,34 +256,6 @@ virSecurityDeviceLabelDefValidate(virSecurityDeviceLab= elDefPtr *seclabels, } =20 =20 -static int -virDomainCheckVirtioOptionsAreAbsent(virDomainVirtioOptionsPtr virtio) -{ - if (!virtio) - return 0; - - if (virtio->iommu !=3D VIR_TRISTATE_SWITCH_ABSENT) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("iommu driver option is only supported " - "for virtio devices")); - return -1; - } - if (virtio->ats !=3D VIR_TRISTATE_SWITCH_ABSENT) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("ats driver option is only supported " - "for virtio devices")); - return -1; - } - if (virtio->packed !=3D VIR_TRISTATE_SWITCH_ABSENT) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("packed driver option is only supported " - "for virtio devices")); - return -1; - } - return 0; -} - - static int virDomainDiskVhostUserValidate(const virDomainDiskDef *disk) { --=20 2.29.2 From nobody Fri May 3 21:05:50 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=1615394601; cv=none; d=zohomail.com; s=zohoarc; b=OYWBNWTHwPqVjyIlrJkdCDPXPHH+35/WYPFx/prnoVf2lrqG9qCAQXPIhwlmLiE1KG1YXxFduoec/qDR+qN9twokwPWI6Xqtm7MfuGeE/9gCxs/+NjSeVyrwSKifUzmOuAwrEcniKydHZsHhU9IClsOAlu/OdNDu0R36JQhX710= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615394601; 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=gCPgKKK3dH5Y4BnVhYqR5iYjRq6WJUGYnKdzX+mVZgA=; b=FfNaR3/dGx1b5aG8BQC76nHnb/4StOfJkMHT70h9iP4jd+PPhfnv/829jrqpa1jO8VPmhkBAPSt5yzIWvxGMxukNst4tn8rIOYYTeamZ/7YerR/0//a7vYmI+TU/10DHg2fyTWwW/BRRaPuzv9L753Qk6O9IP0D2Z44wkOnVt/k= 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 1615394601132390.05693550350156; Wed, 10 Mar 2021 08:43:21 -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-193-ZP_oIMHGMse-pzRk2BROCQ-1; Wed, 10 Mar 2021 11:43:17 -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 493781005D4F; Wed, 10 Mar 2021 16:43:10 +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 25C295D9DB; Wed, 10 Mar 2021 16:43:10 +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 DBEFD1809C86; Wed, 10 Mar 2021 16:43:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12AGh84f023190 for ; Wed, 10 Mar 2021 11:43:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 427125C1A1; Wed, 10 Mar 2021 16:43:08 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.194.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6ABC25C23E for ; Wed, 10 Mar 2021 16:43:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615394600; 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=gCPgKKK3dH5Y4BnVhYqR5iYjRq6WJUGYnKdzX+mVZgA=; b=YT9UllVawURB4Lj5RGT/HNjY7e9VLRtC5wlJ3NuA4D6K33suWRjT4H41InBht1pmhWfkWz CvRXSFVwv7Y5mMxSAG0oSvlBVjYvi2YmxrGGl5rfG/vlC6zgYymbKEe5ycQgNLIiM82S/R 1xwx663x7fanu5GVCEmIlANP6BGraGs= X-MC-Unique: ZP_oIMHGMse-pzRk2BROCQ-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH v2 2/2] XML validate that non-virtio video devices have none virtio options Date: Wed, 10 Mar 2021 17:42:51 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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) Content-Type: text/plain; charset="utf-8" With this, XML fails if non-virtio video devices have virtio options. Previously it didn't raise error. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1922093 Signed-off-by: Kristina Hanicova Reviewed-by: Michal Privoznik --- src/conf/domain_validate.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index dabdd7b8eb..b53f6437cc 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -179,6 +179,10 @@ virDomainVideoDefValidate(const virDomainVideoDef *vid= eo, } } =20 + if (video->type !=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && + (virDomainCheckVirtioOptionsAreAbsent(video->virtio) < 0)) + return -1; + return 0; } =20 --=20 2.29.2