From nobody Mon Feb 9 10:57:34 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=1618587520; cv=none; d=zohomail.com; s=zohoarc; b=nQiyWRo3FgndKM/VlpA2y2Sp3gyEV/1rr4gq7ywMSUfsgPBQiOfIXoOJVTGhrGelLnOU2TwJy+ztBkl1yBwFCLcGVxYsJVYXu4NHEG7HAWy+xWDN80x7dOPbbExgp8uA5olhjcGQH3xVhSRTR+TVnBnAVVL4MUEP/1064evPpMA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618587520; 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=9FOTQ41AHC6ucdxxOcfIehy4XgXLGMyr3PrXnI3udh8=; b=lMPRNhHnMmfcrwXgblV4JjgYcahTykKtjbRlQC/vIubygWiHv4vyFegAj3+DLo+3mYVUB2xkRIN9ucirpoj1LNdXfc/eiRUcGa6kpzgclke88oQQ4w2IpYCihh+TqB00H2r4dba2Q6wXqZKgIu15TEPw7krVaR1wkzy9ViBng6s= 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 1618587520534260.608313529926; Fri, 16 Apr 2021 08:38:40 -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-40-xwkdU1dpNIq_gPnLoo2DMA-1; Fri, 16 Apr 2021 11:38:36 -0400 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 7481D18B9FA9; Fri, 16 Apr 2021 15:38:31 +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 4DF976E703; Fri, 16 Apr 2021 15:38:31 +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 1220544A62; Fri, 16 Apr 2021 15:38:31 +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 13GFYwPO009297 for ; Fri, 16 Apr 2021 11:34:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id C20E31C4; Fri, 16 Apr 2021 15:34:58 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 19FD85C3DF for ; Fri, 16 Apr 2021 15:34:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618587519; 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=9FOTQ41AHC6ucdxxOcfIehy4XgXLGMyr3PrXnI3udh8=; b=WWAGbAwmVUjb7HB48fO3hENkstby+ytMIMzj08BPbkBuI0wpEHr/ay3aPgNgnZ577x6hF8 54NoHeZOnvat2JssHREFwdIwV2mlw3B6wOeuUuMrUSIgHkw3Z+73pBoeEPBWrkbmO+FIiF ZqwiBMwn5qHspC25+UJAy4lGiwcq4U0= X-MC-Unique: xwkdU1dpNIq_gPnLoo2DMA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/25] virDomainDiskDefValidate: Consolidate conditions Date: Fri, 16 Apr 2021 17:34:27 +0200 Message-Id: <1863e52e6fd6ea373462ff624573e51775d2280c.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.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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Consolidate the checks for '' and viritio queues under already existing blocks which have the same condition. Signed-off-by: Peter Krempa --- src/conf/domain_validate.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 570279cd92..4d253599af 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -451,13 +451,12 @@ virDomainDiskDefValidate(const virDomainDef *def, "device=3D'lun'"), disk->dst); return -1; } - } - - if (disk->src->pr && - disk->device !=3D VIR_DOMAIN_DISK_DEVICE_LUN) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _(" allowed only for lun devices")); - return -1; + } else { + if (disk->src->pr) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _(" allowed only for lun devices= ")); + return -1; + } } /* Reject disks with a bus type that is not compatible with the @@ -474,13 +473,6 @@ virDomainDiskDefValidate(const virDomainDef *def, return -1; } - if (disk->queues && disk->bus !=3D VIR_DOMAIN_DISK_BUS_VIRTIO) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("queues attribute in disk driver element is only " - "supported by virtio-blk")); - return -1; - } - if (disk->bus !=3D VIR_DOMAIN_DISK_BUS_VIRTIO) { if (disk->model =3D=3D VIR_DOMAIN_DISK_MODEL_VIRTIO || disk->model =3D=3D VIR_DOMAIN_DISK_MODEL_VIRTIO_TRANSITIONAL || @@ -492,6 +484,12 @@ virDomainDiskDefValidate(const virDomainDef *def, return -1; } + if (disk->queues) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("queues attribute in disk driver element is o= nly supported by virtio-blk")); + return -1; + } + if (virDomainCheckVirtioOptionsAreAbsent(disk->virtio) < 0) return -1; } --=20 2.30.2