From nobody Sun Feb 8 11:45:33 2026 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; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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=1607466077; cv=none; d=zohomail.com; s=zohoarc; b=ZN0xFIdO5PZeNtH6wSyCq0edFzUQWy8hVxWzUeBU1nRQCUuZZMB9wW5KMUWrd4X0tIy3HeWy8sI/yo9ZojJRpS/vrxPW4r+JmWMA4nneNpa5NqpHOdEGIMwsGGPPv9AB1c90AF882IkEJ40pp4DXjZhdxrMoLbilVv2VTz+78eM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607466077; 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=aMURdiJzsFL8c6xvAoyPv6bYcifcZOxEwvjFkId2cTA=; b=SlgWZUNIyRAQmM+MMSMWzmG4ZGuvDajkwH7012G2/khrY5axJ5VLqfn7PwnJaQF01XUAic5x397hdaPfhMHXI418N0S3cK1rQY6nyhGSDxv03gqyxRlyskeYN7V7asD9qZU1qOpgo3hfu8sbWMHEq1iNp2p3FDRrfMQvQSGQ1dA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1607466077394804.4634985197368; Tue, 8 Dec 2020 14:21:17 -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-562-GCKmuOdONpG5tmt9mcFmAw-1; Tue, 08 Dec 2020 17:21:13 -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 5B721180A095; Tue, 8 Dec 2020 22:21:08 +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 393C760877; Tue, 8 Dec 2020 22:21: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 063D01809C9F; Tue, 8 Dec 2020 22:21:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B8ML1CH017270 for ; Tue, 8 Dec 2020 17:21:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8515E112D41B; Tue, 8 Dec 2020 22:21:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 81204112D411 for ; Tue, 8 Dec 2020 22:21:01 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (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 6E61B811E76 for ; Tue, 8 Dec 2020 22:21:01 +0000 (UTC) Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-446-TCMEBI-1NeeJYu7MOs1XUQ-1; Tue, 08 Dec 2020 17:20:58 -0500 Received: by mail-qt1-f177.google.com with SMTP id k4so13150149qtj.10; Tue, 08 Dec 2020 14:20:58 -0800 (PST) Received: from rekt.redhat.com ([2804:431:c7c7:c1a:69c1:2b22:e880:fc49]) by smtp.gmail.com with ESMTPSA id c14sm75057qtg.85.2020.12.08.14.20.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Dec 2020 14:20:56 -0800 (PST) X-MC-Unique: GCKmuOdONpG5tmt9mcFmAw-1 X-MC-Unique: TCMEBI-1NeeJYu7MOs1XUQ-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=aMURdiJzsFL8c6xvAoyPv6bYcifcZOxEwvjFkId2cTA=; b=nXS36eRrkYYkfBuAwpPwK0k3fs6oqjfpPb4pErVll0ifJErlzpGN7sccMrcsd1TLV4 yuci3MPTlpdIUNcDuK36Cwa+1AQLTSQvuDr63WwX9miJB4/lH83jA1/o2XQqoj0ELMh6 4YILy9qwuORXDiUAqNIfVu8rx83N9gypcmRPwV5/yDwypYk8Z7Vw3NsmeRpOXWpGSlrR WCUD3z5j+poSF1KH+dYaZaEcxGUxZ/9JllaC1y8YuQ4Q/x5ZOO4vgjKFXiOJ/HEa9BzC Qs6EbAnVVm1SKs+DDtwbqVI1KB3zq2Clazs1zZH64c3q3a4Q5kh34O3QRmHofYu69EVI 4Ryg== X-Gm-Message-State: AOAM533TX67Yhw26J5SmFyl6YqPXQfrc8i5oxbEVADJ3g3tFf51eOxbf 03Nke5HnUgc6maq8+NP9lCzdJwMW29I= X-Google-Smtp-Source: ABdhPJwX1W2NY2Uue8ORAg92y9knqJIVsIYyLiPWOxZoEXtek43FDiXWX4/WkM0W1TNEsFM+3eBPrA== X-Received: by 2002:ac8:51d8:: with SMTP id d24mr202906qtn.73.1607466057561; Tue, 08 Dec 2020 14:20:57 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v3 04/14] domain_conf.c: move QXL attributes check to virDomainVideoDefValidate() Date: Tue, 8 Dec 2020 19:20:20 -0300 Message-Id: <20201208222030.1302229-5-danielhb413@gmail.com> In-Reply-To: <20201208222030.1302229-1-danielhb413@gmail.com> References: <20201208222030.1302229-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.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Michal Privoznik , 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.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-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. Reviewed-by: Michal Privoznik Signed-off-by: Daniel Henrique Barboza --- src/conf/domain_conf.c | 15 --------------- src/conf/domain_validate.c | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d80bc8495e..db0ca975fe 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16132,11 +16132,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); @@ -16153,11 +16148,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); @@ -16166,11 +16156,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); diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index c81fd296b9..234eb72f11 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -128,5 +128,25 @@ virDomainVideoDefValidate(const virDomainVideoDef *vid= eo, 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 2.26.2