From nobody Mon Sep 16 19:47:52 2024 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=1679081297; cv=none; d=zohomail.com; s=zohoarc; b=XAUWXRHGXtimcFmHBSAhcv7mQNqKfi4EsonOgX969W20LTSmM+YAq+oZyKoBNFnOvlZJbU+GoLh0D+S7zwMUdUB3b5TJ8OQXrtXg7WCW81nVQbMYqLnb9Gm6n1OYx02qnI2HHuqV/5+r+uuR1atjmDlKebnovIK8iRfyL78q8dA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679081297; 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=9vylSlktdc8GKWycuvjH3HE+jac64JlqVjYX90sykqc=; b=hnXkbdq6eEINqeHWYAnAUHMheTUpS+yQLNTr1DXgw/0W1vKOGgLYAEHQJH+laZirhGkhOQDS0uLF5Gdkkchx0sCSolb90Iia8UQZ6Z074LNkDagHBYMmmekszVGA/3C2OxyQCadDfpm11a7N6046Zt6uXAHRj7zONzgOALRULlk= 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) 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 1679081297865585.8582417589106; Fri, 17 Mar 2023 12:28:17 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-660-AOhkc_9hOO-lkLhevFytOw-1; Fri, 17 Mar 2023 15:28:15 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 07459280A33C; Fri, 17 Mar 2023 19:28:10 +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 E896249AF4; Fri, 17 Mar 2023 19:28:09 +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 DC4891946A49; Fri, 17 Mar 2023 19:28:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DE02C19466DF for ; Fri, 17 Mar 2023 19:27:59 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D2FF540C6E69; Fri, 17 Mar 2023 19:27:59 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.45.226.11]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6648940C6E67 for ; Fri, 17 Mar 2023 19:27:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679081296; 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=9vylSlktdc8GKWycuvjH3HE+jac64JlqVjYX90sykqc=; b=Uxx0KUq+ij7MWVt0uNyqmZeczCtdUVjTfPjxxgsfGpSVVYMw/xNy0qygINbfgvzHy6rbK8 hkBuQM5kv2de33Alp4KfFoI81LJFlHLmyTSM/z/JzRyWufxGD9UyxwsyotMDxZEL8oc7SJ OLsH5faUntchCYXGPUgYx8GK/QzU7nA= X-MC-Unique: AOhkc_9hOO-lkLhevFytOw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 14/15] conf: Move validation check out of postparse Date: Fri, 17 Mar 2023 20:27:46 +0100 Message-Id: <20230317192747.1311223-15-abologna@redhat.com> In-Reply-To: <20230317192747.1311223-1-abologna@redhat.com> References: <20230317192747.1311223-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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 3.1 on 10.11.54.5 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: 1679081298656100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The reason why it was in postparse in the first place was so that we could could automatically enable the secure-boot feature in some cases, but that no longer happens so we can finally move it to the proper location. Signed-off-by: Andrea Bolognani --- src/conf/domain_postparse.c | 10 ---------- src/conf/domain_validate.c | 8 ++++++++ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/conf/domain_postparse.c b/src/conf/domain_postparse.c index 79862a72cd..2832705d0f 100644 --- a/src/conf/domain_postparse.c +++ b/src/conf/domain_postparse.c @@ -93,16 +93,6 @@ virDomainDefPostParseMemory(virDomainDef *def, static int virDomainDefPostParseOs(virDomainDef *def) { - if (def->os.firmwareFeatures && - def->os.firmwareFeatures[VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_ENROLL= ED_KEYS] =3D=3D VIR_TRISTATE_BOOL_YES) { - - if (def->os.firmwareFeatures[VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_SE= CURE_BOOT] =3D=3D VIR_TRISTATE_BOOL_NO) { - virReportError(VIR_ERR_XML_DETAIL, "%s", - _("firmware feature 'enrolled-keys' cannot be e= nabled when firmware feature 'secure-boot' is disabled")); - return -1; - } - } - if (!def->os.loader) return 0; =20 diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 6991cf1dd3..f208c0c531 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -1606,6 +1606,14 @@ virDomainDefOSValidate(const virDomainDef *def, return -1; } =20 + if (def->os.firmwareFeatures && + def->os.firmwareFeatures[VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_EN= ROLLED_KEYS] =3D=3D VIR_TRISTATE_BOOL_YES && + def->os.firmwareFeatures[VIR_DOMAIN_OS_DEF_FIRMWARE_FEATURE_SE= CURE_BOOT] =3D=3D VIR_TRISTATE_BOOL_NO) { + virReportError(VIR_ERR_XML_DETAIL, "%s", + _("firmware feature 'enrolled-keys' cannot be e= nabled when firmware feature 'secure-boot' is disabled")); + return -1; + } + if (!loader) return 0; =20 --=20 2.39.2