From nobody Mon Feb 9 11:47:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1656000935; cv=none; d=zohomail.com; s=zohoarc; b=SF1/7Ecdz+DXI8LgSI/n+mqIwMAIv458YGSH9rwRoMOiBjL908AZ09U3mL5Vk46LmyfRT680vC7g7aYP+2qFPehS6Q7KHZbWFpA6pNCggVMGcFu5b+Xd6xLwwoykiItljf1iQSSmdEFXa0xyuxMGqmhdl1I9+DWwikxves9l7DE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1656000935; 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=NIQqJwDXwTKAfHt//Xg4E82OxZypbZfa7uNlHYNAOOs=; b=l0ksVm0jQc7/2EbOE5/Ms1Msty8VCDbEco42Z2vrXXTjN6TK2MGwenHVPxJUlltB4JAePy+/AW7sfyO6KTkCnSqUrkwKaYAIgJxwSyxC0a7xcdoVJjss1X5u1BOIBpKRm54kzTIVJbkCeExMOTaIKRQhQ+8HqOhXaYFArkYY7DM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1656000935793694.0842151339224; Thu, 23 Jun 2022 09:15:35 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-107-qrc6JMskPcetjHoCRuGIFQ-1; Thu, 23 Jun 2022 12:15:29 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CD981919F6E; Thu, 23 Jun 2022 16:15:02 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B34A51121319; Thu, 23 Jun 2022 16:15:02 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 64495194B966; Thu, 23 Jun 2022 16:15:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4D776194B950 for ; Thu, 23 Jun 2022 16:14:59 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2F9CB1121314; Thu, 23 Jun 2022 16:14:59 +0000 (UTC) Received: from harajuku.homenet.telecomitalia.it (unknown [10.40.194.79]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B245A1121320 for ; Thu, 23 Jun 2022 16:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656000934; 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=NIQqJwDXwTKAfHt//Xg4E82OxZypbZfa7uNlHYNAOOs=; b=TAWhqPk7Ol8jIT55Tz51mJG6PGIkEYOa1Xv+83qifSUAe8WJtnjYbn4ciZqxEiO4+ho35Y 6CvxND4UmAWdDOevblIJQubcf0E8IU6tPSqRDa1egsxHwJl9L2CBkm2J5EnGeX+kkZPyro oWCRuo4igxCVYcRb/SmF/HG8pkxkMA8= X-MC-Unique: qrc6JMskPcetjHoCRuGIFQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 21/28] conf: Refactor virDomainDefOSValidate() Date: Thu, 23 Jun 2022 18:14:33 +0200 Message-Id: <20220623161440.61653-22-abologna@redhat.com> In-Reply-To: <20220623161440.61653-1-abologna@redhat.com> References: <20220623161440.61653-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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) X-ZM-MESSAGEID: 1656000937771100003 Content-Type: text/plain; charset="utf-8" This makes it explicit that there are two possible scenarios (whether or not firmware autoselection is in use) and will make upcoming changes cleaner to implement. Signed-off-by: Andrea Bolognani --- src/conf/domain_validate.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 33b6f47159..1f6c32a816 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -1598,21 +1598,23 @@ static int virDomainDefOSValidate(const virDomainDef *def, virDomainXMLOption *xmlopt) { - if (def->os.firmware && - !(xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT))= { - virReportError(VIR_ERR_XML_DETAIL, "%s", - _("firmware auto selection not implemented for this= driver")); - return -1; - } + virDomainLoaderDef *loader =3D def->os.loader; =20 - if (!def->os.loader) - return 0; + if (def->os.firmware) { + if (!(xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELE= CT)) { + virReportError(VIR_ERR_XML_DETAIL, "%s", + _("firmware auto selection not implemented for = this driver")); + return -1; + } + } else { + if (!loader) + return 0; =20 - if (!def->os.loader->path && - def->os.firmware =3D=3D VIR_DOMAIN_OS_DEF_FIRMWARE_NONE) { - virReportError(VIR_ERR_XML_DETAIL, "%s", - _("no loader path specified and firmware auto selec= tion disabled")); - return -1; + if (!loader->path) { + virReportError(VIR_ERR_XML_DETAIL, "%s", + _("no loader path specified and firmware auto s= election disabled")); + return -1; + } } =20 return 0; --=20 2.35.3