From nobody Sun Feb 8 21:27:02 2026 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1607349332; cv=none; d=zohomail.com; s=zohoarc; b=nle3rn2nNXGG6ThgXW5UMWN4UjdDM7J7FKi103/i8cjf8hD2R+EZDpPDSBzWSuFzuq6hWMjqQRqzybkZKso/HD7Nl7iNjKB0PkxT2giqMb9+OB8h07ApQYvnQ9QN4aIYkp2mhNUWEXLeSuZzTiazhEK+KmB0I3tNHwvodVIZ+Jg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607349332; h=Content-Type:Content-Transfer-Encoding:Cc: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=KMG4QDw3RtuXpmzlpN4hqDvRxybO6Dg/ZZVcDmnmM/E=; b=kz4SmQoW+XK13hCxakHex+5KaOEslqhRaAHoXikZVGK5rLLVpdVv4ZX9c7WnnvS9hfICZnZRDY4LIIcnvJi3MX8QlG+ccx7rwj/blow2xnvl2R6PWzvQQlSvFJIuvNdd8uZ3ebOT0TfIcFIzT3eE5mPgJi87BX9ZMolrrlvqttA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail 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 1607349332781681.513914678677; Mon, 7 Dec 2020 05:55:32 -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-305-tR8UL7EkPwiCys8dnjeBpQ-1; Mon, 07 Dec 2020 08:55:29 -0500 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 E37918015F4; Mon, 7 Dec 2020 13:55:19 +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 C00B95D6D5; Mon, 7 Dec 2020 13:55:19 +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 8A3F850031; Mon, 7 Dec 2020 13:55:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B7DsvYh012932 for ; Mon, 7 Dec 2020 08:54:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5F0096B42D; Mon, 7 Dec 2020 13:54:57 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5923C4405A for ; Mon, 7 Dec 2020 13:54:57 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 46470100FBC9 for ; Mon, 7 Dec 2020 13:54:57 +0000 (UTC) Received: from mail-qt1-f174.google.com (mail-qt1-f174.google.com [209.85.160.174]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-118-Dp6uUtwLM7i6N1rg_7T-bg-1; Mon, 07 Dec 2020 08:54:55 -0500 Received: by mail-qt1-f174.google.com with SMTP id z9so9367882qtn.4 for ; Mon, 07 Dec 2020 05:54:55 -0800 (PST) Received: from rekt.redhat.com ([2804:431:c7c7:c1a:69c1:2b22:e880:fc49]) by smtp.gmail.com with ESMTPSA id n95sm12233701qte.43.2020.12.07.05.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 05:54:54 -0800 (PST) X-MC-Unique: tR8UL7EkPwiCys8dnjeBpQ-1 X-MC-Unique: Dp6uUtwLM7i6N1rg_7T-bg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KMG4QDw3RtuXpmzlpN4hqDvRxybO6Dg/ZZVcDmnmM/E=; b=aMVtCTMJqsjkM31STRgN+uaO9rFztzOPN8PeCxRlafRKUoWTYMaluZx7fd4h7rV8Yy TZ6Sid6iYnLGA23ZDmWMTTsCIQBE87hGSLhLE4DoP3h53dLM/wUApbA/+1XiXVta8Z5P GWHzvY6H4TpWGKr66CsGFFqxXpAM+lzPjLC8HOXIs1XC3Di97wYzmP66yf/s/4iiqiZ6 0yeuYVIalHLeNfqdDBMiYyKXmop0mFlNI8gZhemF4Cf8VnwUBfSkz4w+LJY2/qg79e2d rsGJOBeMexKnQQhbQuJpa3bbTayjX0qffxk91ZCSQOzN2YL6XkMEE2k8vDQ3G+4MH1mS 8s3g== X-Gm-Message-State: AOAM530rKpz+OjKRiAkANR4iYagcnGfoIWowUARIgWUXy2JxxW64FB4p qR2kdUVs6FVc5TBORXz1NOgwg0Uo/0w= X-Google-Smtp-Source: ABdhPJwEeEJ5E+b+UpLetXoekvObIQfPXKn4X5x/Jrh9t8kx01HR+WAz+pGubhjFMCk/I20huGkuPQ== X-Received: by 2002:ac8:120c:: with SMTP id x12mr10169303qti.388.1607349294771; Mon, 07 Dec 2020 05:54:54 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v2 3/9] domain_conf.c: move QXL attributes check to virDomainVideoDefValidate() Date: Mon, 7 Dec 2020 10:54:29 -0300 Message-Id: <20201207135435.884594-4-danielhb413@gmail.com> In-Reply-To: <20201207135435.884594-1-danielhb413@gmail.com> References: <20201207135435.884594-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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 Content-Type: text/plain; charset="utf-8" These checks are not related to XML parsing and can be moved to the validate callback. Errors were changed from VIR_ERR_XML_ERROR to VIR_ERR_CONFIG_UNSUPPORTED. Signed-off-by: Daniel Henrique Barboza --- src/conf/domain_conf.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4b5cab87e7..bc09577e39 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6664,6 +6664,26 @@ virDomainVideoDefValidate(const virDomainVideoDef *v= ideo, return -1; } =20 + if (video->type !=3D VIR_DOMAIN_VIDEO_TYPE_QXL) { + if (video->ram !=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("ram attribute only supported for video type = qxl")); + return -1; + } + + if (video->vram64 !=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("vram64 attribute only supported for video ty= pe qxl")); + return -1; + } + + if (video->vgamem !=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("vgamem attribute only supported for video ty= pe qxl")); + return -1; + } + } + return 0; } =20 @@ -16234,11 +16254,6 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xm= lopt, } =20 if (ram) { - if (def->type !=3D VIR_DOMAIN_VIDEO_TYPE_QXL) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("ram attribute only supported for type of qxl= ")); - return NULL; - } if (virStrToLong_uip(ram, NULL, 10, &def->ram) < 0) { virReportError(VIR_ERR_XML_ERROR, _("cannot parse video ram '%s'"), ram); @@ -16255,11 +16270,6 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xm= lopt, } =20 if (vram64) { - if (def->type !=3D VIR_DOMAIN_VIDEO_TYPE_QXL) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("vram64 attribute only supported for type of = qxl")); - return NULL; - } if (virStrToLong_uip(vram64, NULL, 10, &def->vram64) < 0) { virReportError(VIR_ERR_XML_ERROR, _("cannot parse video vram64 '%s'"), vram64); @@ -16268,11 +16278,6 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xm= lopt, } =20 if (vgamem) { - if (def->type !=3D VIR_DOMAIN_VIDEO_TYPE_QXL) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("vgamem attribute only supported for type of = qxl")); - return NULL; - } if (virStrToLong_uip(vgamem, NULL, 10, &def->vgamem) < 0) { virReportError(VIR_ERR_XML_ERROR, _("cannot parse video vgamem '%s'"), vgamem); --=20 2.26.2