From nobody Fri Dec 19 21:51:54 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1746810930507915.5159464231008; Fri, 9 May 2025 10:15:30 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E050117FD; Fri, 9 May 2025 13:15:29 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id A53B11792; Fri, 9 May 2025 13:13:21 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id EDD00173F; Fri, 9 May 2025 13:13:13 -0400 (EDT) Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 455B11746 for ; Fri, 9 May 2025 13:13:03 -0400 (EDT) Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-5f624291db6so3764657a12.3 for ; Fri, 09 May 2025 10:13:03 -0700 (PDT) Received: from tulp.my.domain (80-115-115-199.cable.dynamic.v4.ziggo.nl. [80.115.115.199]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5fcb3773b04sm581106a12.10.2025.05.09.10.13.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 May 2025 10:13:00 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746810782; x=1747415582; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Npzg5X8MondGFv6AgDqcTvlQDb7xL1dcWCViCJtB9jk=; b=THuIEd9F1vOksR7Itsy6IYACKpl5ccfPm3CI1DJ7LLLh1v/HZmxbnx/kTcVLU/l2s+ maNdwKhwp2LZXmG10C5OMf3l7jgujsp4Zg28/iW/SL/nkFw1jrnzijZPxxDITQtZiodJ 10e3kAzX/E0S5FjWw0UbcthJt4iXUnf7fGneMqsanL/mEXxCBpTvA/+9ERf1q77Uncjr JZ0FhJu9M02SWRzFX6204zdVlLVZBPtHWTU5OeuZZjkOq8vDs0zvOV3n11Xg+hAzDCCt hr86ukYhMkys4ZjI2D5h5brKILNp6lSXXtG0ypdFodx8Lir2zk8Rd95nQW1Iyrr2anm4 a7aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746810782; x=1747415582; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Npzg5X8MondGFv6AgDqcTvlQDb7xL1dcWCViCJtB9jk=; b=JVSaiPpP+q7M3jW/UTFXTn45wu5WTgtm2sXHjA/OOIWpjNI/GAknartKGn8oOzQ5sN DnLXqCZMxK9SBYvLVsf0/OOclCWQKP3k4fPSvCLIhmDPZRTHp34oEoIfRFLMf6yYykjC adXU7JywPu0TUbgJV/3+cF1w+97O9DAP7j5kNs1mrAKZ/VeG4t8iMEXaNp6//kMLEpM+ NFA78uK7XeU0F6qD97+RiCuoG8CE94W6s8FP/vpZKOtSuEqfBkGZHT1ALsu7mIrQA27b xzOCg8TNiljG2M9bAnFdVqVfaDuCFc4ZeVHjpJLqnVu/in1QAtrCFpPlSKFMHrkDqV+M PTNQ== X-Gm-Message-State: AOJu0YwYtQ1GQdJPvLsKUyqvMBnvLNNutBsbrtrlO8RIcWMq6zfccdOg 2WO1VyHhTFC6Og/7LFOEvs1FO0reP/u4PWUvgh+77uKXEcp9LlYe4Z5h84B4oJX3Sg== X-Gm-Gg: ASbGncsanhVoLhFgsYUi3vGC2EUqV00w8zpIKndVayf1ksxG1zwXqNNb60MqtA8uOPg NBUlUZPzKtzVwAn6lKALjR3xwf9CsCNXT5pLHRCmslvVGZOeEC111KYF89oZ9BbOXqoR0hhuJAs uI7RlyulErXFT814UQeAWsf0DxNzq2qLWLolz3g+NJPxQXcTr+tr20j03B4BMNqlu8olTUGmz6M dBR92cLamiWhg7x2DyCXhHbf1P1/vqxI+NHGc/HWB+/8qtW7Q7Cvme1xkpP08bZNdB/EGSHGlFP OWyq5hBL7dcU9hZsMdTFiF8bmPZS6hkBISHLrQl8ygLeoDerDb7OaKqBAjykeirOKX51H0ODsNe lnVvVXcu6HVwvyCZ+lBIpmLO9 X-Google-Smtp-Source: AGHT+IGpUQm6lEyEYr156fkVzKYLv+vFRQ863wn9L+hljc+b9SXoMpor0IBpqen9KmeGrHzX/NhWkw== X-Received: by 2002:a05:6402:2813:b0:5fb:1fbd:e3ad with SMTP id 4fb4d7f45d1cf-5fca0759c82mr3647972a12.13.1746810781575; Fri, 09 May 2025 10:13:01 -0700 (PDT) From: Roman Bogorodskiy To: devel@lists.libvirt.org Subject: [PATCH 4/5] bhyve: introduce bhyveDomainDefValidate() Date: Fri, 9 May 2025 19:11:50 +0200 Message-ID: <20250509171151.31305-5-bogorodskiy@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250509171151.31305-1-bogorodskiy@gmail.com> References: <20250509171151.31305-1-bogorodskiy@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZWAIXEMFIEEMU6IIYNPMBP4ZMNS6KPXO X-Message-ID-Hash: ZWAIXEMFIEEMU6IIYNPMBP4ZMNS6KPXO X-MailFrom: bogorodskiy@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Roman Bogorodskiy X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1746810932368019000 Content-Type: text/plain; charset="utf-8" Add the bhyveDomainDefValidate() validation which currently checks whether the requested NVRAM is supported. Signed-off-by: Roman Bogorodskiy --- src/bhyve/bhyve_domain.c | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c index ca5176885a..3e18a462e4 100644 --- a/src/bhyve/bhyve_domain.c +++ b/src/bhyve/bhyve_domain.c @@ -267,11 +267,54 @@ bhyveDomainDeviceDefValidate(const virDomainDeviceDef= *dev, return 0; } =20 + +static int +bhyveDomainDefValidate(const virDomainDef *def, + void *opaque G_GNUC_UNUSED, + void *parseOpaque G_GNUC_UNUSED) +{ + virStorageSource *src =3D NULL; + + if (!def->os.loader) + return 0; + + if (!(src =3D def->os.loader->nvram)) + return 0; + + if (src->type !=3D VIR_STORAGE_TYPE_FILE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", + _("only 'file' type is supported with NVRAM")); + return -1; + } + + if (src->sliceStorage) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("slices are not supported with NVRAM")); + return -1; + } + + if (src->pr) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("persistent reservations are not supported with = NVRAM")); + return -1; + } + + if (src->backingStore) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("backingStore is not supported with NVRAM")); + return -1; + } + + return 0; +} + virDomainDefParserConfig virBhyveDriverDomainDefParserConfig =3D { .devicesPostParseCallback =3D bhyveDomainDeviceDefPostParse, .domainPostParseCallback =3D bhyveDomainDefPostParse, .assignAddressesCallback =3D bhyveDomainDefAssignAddresses, .deviceValidateCallback =3D bhyveDomainDeviceDefValidate, + .domainValidateCallback =3D bhyveDomainDefValidate, =20 .features =3D VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT, }; --=20 2.49.0