From nobody Mon Feb 9 05:01:17 2026 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=1618587457; cv=none; d=zohomail.com; s=zohoarc; b=bJIiSiclQAd+VIkYF1KOqa9h7699ij9M19zUceeQXUAZXmiMKaqyHqLu0w5AO8iPz2wHv7DNXOWSi3U/+7GTUb63g+32Qh0A2MN6dFd2rF1ahatZdEcfPdy3GOjeQmMm2VXTYHhJe53UcOu8bq7S+dhn5+1ZlFhjZ6iBCCtLR40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618587457; 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=FESxON4LCVE9m9Q/HlERi87bzj0hixFkVXrgZVVDKZg=; b=SzmE4JwFqG9/+Sxp6CZxBkA+YzO/R7YNrW3pEII3/435ccfDt44D/r9wCkhpcmyXO9KSyreYItmfNuMuICFdSjObtnVglzOUMPOhMbL59EVxmE98EVdXjkUN+EGarnh4ExfEUsSR9ihlCuyyvqd/2cwjjoBgOo/hg38B0Sd83xo= 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 1618587457729980.3915805326225; Fri, 16 Apr 2021 08:37:37 -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-80-t6qP5urzM8Kq6BdsxXG-uA-1; Fri, 16 Apr 2021 11:37:33 -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 094306D588; Fri, 16 Apr 2021 15:37:29 +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 DBDAC5D9C6; Fri, 16 Apr 2021 15:37:28 +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 9E24044A5F; Fri, 16 Apr 2021 15:37:28 +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 13GFZ2ru009340 for ; Fri, 16 Apr 2021 11:35:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 15E645C6DE; Fri, 16 Apr 2021 15:35:02 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71ACB5C3DF for ; Fri, 16 Apr 2021 15:35:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618587456; 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=FESxON4LCVE9m9Q/HlERi87bzj0hixFkVXrgZVVDKZg=; b=b9OdVL9nKgX3wQZVi4ey045Nifu07k/kExV5hKfMI8FfxgUFmv7lDKCTaW9cxRLJuOlszO 6d4O0esnOvYWDYE/wNhWuSGwVuOQr7wYMZuR2tzsalmYOU7KkKgb/aBKrdLLBbn4CTKagl 8JIEaGfnG2D3By9KL8Ca+ez6PeyIhqs= X-MC-Unique: t6qP5urzM8Kq6BdsxXG-uA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 12/25] conf: Move checks from virDomainDiskDefPostParse to virDomainDiskDefValidate Date: Fri, 16 Apr 2021 17:34:30 +0200 Message-Id: <8c794e00c3ddb7b2c7e09dd8155bbccf82c75914.1618587222.git.pkrempa@redhat.com> 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" The moved code contains only checks and does not modify the parsed document so it doesn't belong into the PostParse code. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 19 ------------------- src/conf/domain_validate.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0738bf7f1f..ce0931c160 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -5367,25 +5367,6 @@ virDomainDiskDefPostParse(virDomainDiskDef *disk, const virDomainDef *def, virDomainXMLOption *xmlopt) { - /* internal snapshots and config files are currently supported - * only with rbd: */ - if (virStorageSourceGetActualType(disk->src) !=3D VIR_STORAGE_TYPE_NET= WORK && - disk->src->protocol !=3D VIR_STORAGE_NET_PROTOCOL_RBD) { - if (disk->src->snapshot) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _(" element is currently supported " - "only with 'rbd' disks")); - return -1; - } - - if (disk->src->configFile) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _(" element is currently supported " - "only with 'rbd' disks")); - return -1; - } - } - if (disk->src->type =3D=3D VIR_STORAGE_TYPE_NETWORK && disk->src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_ISCSI) { virDomainPostParseCheckISCSIPath(&disk->src->path); diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index b2780b3562..5118d6a25e 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -469,6 +469,24 @@ virDomainDiskDefValidateSourceChainOne(const virStorag= eSource *src) } } + /* internal snapshots and config files are currently supported only wi= th rbd: */ + if (virStorageSourceGetActualType(src) !=3D VIR_STORAGE_TYPE_NETWORK && + src->protocol !=3D VIR_STORAGE_NET_PROTOCOL_RBD) { + if (src->snapshot) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _(" element is currently supported " + "only with 'rbd' disks")); + return -1; + } + + if (src->configFile) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _(" element is currently supported " + "only with 'rbd' disks")); + return -1; + } + } + return 0; } --=20 2.30.2