From nobody Tue May 14 18:09:05 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=1644951448; cv=none; d=zohomail.com; s=zohoarc; b=ibI4mu3EGw7dglvDGeRb4Qf4rZwKzTV4LKbF1nFuy2dh8ROHn3kBMhlyzVzsPfel+7ILsggUMvqFn2XSpCiTceJIfKLTIX0zxmE9ZuXcm8jhmdZVZ3IQTMj4i+xIs+8gzBUWvK0ZcKdjDB63gi/1YN2EmQd0NBnc9qOV4Lrz5wA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644951448; 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=A1yiWzqEU/YKUiykI4CLVlaQSvDcOPJlTLcytDmvwFI=; b=JMD+KpPbXTy1peGURAKvHrGGqQFeK/gTlC7gJAuJaTBgaJsu2EbTo2ahphHLzVzZWzrfXSWcaPo3MTU1kbum9I2k7QwJFgyEdl62hp4I6KT3g0sfg9B11eU475J5myWyszeXFxT7q5A0TPrkQHBC7CJzE0nYhVqFKB8/V2PVtYw= 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 1644951448222881.9703929613952; Tue, 15 Feb 2022 10:57:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-140-nk437CoUNmeVMGNc180Tbg-1; Tue, 15 Feb 2022 13:57:23 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 366E02F25; Tue, 15 Feb 2022 18:57:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E122B782D7; Tue, 15 Feb 2022 18:57:17 +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 DCF9D1809C88; Tue, 15 Feb 2022 18:57:15 +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 21FIskAq029717 for ; Tue, 15 Feb 2022 13:54:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id B908C838F8; Tue, 15 Feb 2022 18:54:46 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.196.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id D89BD838E5; Tue, 15 Feb 2022 18:54:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644951447; 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=A1yiWzqEU/YKUiykI4CLVlaQSvDcOPJlTLcytDmvwFI=; b=Pr98v9nsp8d3RG8eQOdk4JRb9nw9HVB95g7nXnsFE+LfF4OJym2NdSfntf1k59fQ/YT9aJ 0elHa37kYpnu4haKZzR7LxI461FF3grvBKM47PYRtigjpdyYiRGCNGrRnWI9dqIq8/p9Oc 4X/dc4XbI8AEW6p9xhg8ceQ0I3/sRfY= X-MC-Unique: nk437CoUNmeVMGNc180Tbg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 01/10] qemu: fix bad indentation for qemuDomainNVRAMPathFormat Date: Tue, 15 Feb 2022 18:54:29 +0000 Message-Id: <20220215185438.1720571-2-berrange@redhat.com> In-Reply-To: <20220215185438.1720571-1-berrange@redhat.com> References: <20220215185438.1720571-1-berrange@redhat.com> 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.15 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644951450156100001 Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain.c | 4 ++-- src/qemu/qemu_domain.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c764f6296c..4e9c845f68 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10956,8 +10956,8 @@ qemuDomainDiskIsMissingLocalOptional(virDomainDiskD= ef *disk) =20 void qemuDomainNVRAMPathFormat(virQEMUDriverConfig *cfg, - virDomainDef *def, - char **path) + virDomainDef *def, + char **path) { *path =3D g_strdup_printf("%s/%s_VARS.fd", cfg->nvramDir, def->name); } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 8bf1c91049..3ca6ef084e 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -980,8 +980,8 @@ qemuDomainDiskIsMissingLocalOptional(virDomainDiskDef *= disk); =20 void qemuDomainNVRAMPathFormat(virQEMUDriverConfig *cfg, - virDomainDef *def, - char **path); + virDomainDef *def, + char **path); =20 void qemuDomainNVRAMPathGenerate(virQEMUDriverConfig *cfg, --=20 2.34.1 From nobody Tue May 14 18:09:05 2024 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=1644951458; cv=none; d=zohomail.com; s=zohoarc; b=fzQ4YntXfB64zXMGmujTk/ycQ2X0eLU8u17SYnnD+AoaaC3Avx+shKM6MZ7U34VjVM2LFXOAO/HJ9BLQXawFRMzbbbS9Z86qH1XEn6E3yGJXgkxtJwyEl5sBNoONgmlQTYf8uUTGvzWySD4B8nfBO+cmYvN0xfj6TMWGqz9Rsl8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644951458; 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=9E3BzlPP92pgwvpJdeARDt6IECZBgyb+kRuUEZ+6hWM=; b=BxXtlSSPmip836gbq5gExgh2CrrrNQQkUEUVckpWxS0Dfg0Uo92ho2+rE41oFkJiSsKM4b3a4J3Oo5kA4CuLJ91FwBpPTTuDuMCiz0+4TJq3cN3ZrZ+Hu1qA3aOVLG4JheXK1o4xquTkM5DuZKV3ahTzANxWPSHkQx1tHRAh7lg= 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 1644951458683335.3303444327473; Tue, 15 Feb 2022 10:57:38 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-575-QvojW2HMPvq3vXuuisbrcw-1; Tue, 15 Feb 2022 13:57:37 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9B39E801B0C; Tue, 15 Feb 2022 18:57: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 78EB82ED65; Tue, 15 Feb 2022 18:57: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 BACBE4BB7C; Tue, 15 Feb 2022 18:57:30 +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 21FIsoI0029730 for ; Tue, 15 Feb 2022 13:54:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3DC10838F9; Tue, 15 Feb 2022 18:54:50 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.196.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77BA7838FA; Tue, 15 Feb 2022 18:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644951458; 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=9E3BzlPP92pgwvpJdeARDt6IECZBgyb+kRuUEZ+6hWM=; b=LUM8V36V6ph7cV0zFl5KB8eBnt+rXpujN8SWK1Vwrp1d3skx067rRJhitOIdwR3rU+PULG 8k0b275si9jCto//wZVqzAHuUt6MhxzhiM/gnKzJ5hXdn+5VszkF2J6Th6JfVeAQHUQOaA VUunnPsOxgRZOmCn4McgfC6lcwSfflE= X-MC-Unique: QvojW2HMPvq3vXuuisbrcw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 02/10] tests: add explicit test case for pflash loader lacking path Date: Tue, 15 Feb 2022 18:54:30 +0000 Message-Id: <20220215185438.1720571-3-berrange@redhat.com> In-Reply-To: <20220215185438.1720571-1-berrange@redhat.com> References: <20220215185438.1720571-1-berrange@redhat.com> 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.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644951472902100003 The following is expected to raise an error: because no path to the pflash loader is given and there is no default built-in. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- tests/qemuxml2argvdata/bios-nvram-no-path.err | 1 + tests/qemuxml2argvdata/bios-nvram-no-path.xml | 19 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 3 files changed, 21 insertions(+) create mode 100644 tests/qemuxml2argvdata/bios-nvram-no-path.err create mode 100644 tests/qemuxml2argvdata/bios-nvram-no-path.xml diff --git a/tests/qemuxml2argvdata/bios-nvram-no-path.err b/tests/qemuxml2= argvdata/bios-nvram-no-path.err new file mode 100644 index 0000000000..795386008c --- /dev/null +++ b/tests/qemuxml2argvdata/bios-nvram-no-path.err @@ -0,0 +1 @@ +no loader path specified and firmware auto selection disabled diff --git a/tests/qemuxml2argvdata/bios-nvram-no-path.xml b/tests/qemuxml2= argvdata/bios-nvram-no-path.xml new file mode 100644 index 0000000000..bf97f0bdd6 --- /dev/null +++ b/tests/qemuxml2argvdata/bios-nvram-no-path.xml @@ -0,0 +1,19 @@ + + test-bios + 362d1fc1-df7d-193e-5c18-49a71bd1da66 + 1048576 + 1048576 + 1 + + hvm + + + + + + + + + /usr/bin/qemu-system-x86_64 + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 6cf35a0ebf..fd5fe6054d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1267,6 +1267,7 @@ mymain(void) DO_TEST("bios", QEMU_CAPS_DEVICE_ISA_SERIAL); DO_TEST_NOCAPS("bios-nvram"); + DO_TEST_PARSE_ERROR_NOCAPS("bios-nvram-no-path"); DO_TEST_CAPS_LATEST("bios-nvram-rw"); DO_TEST_CAPS_LATEST("bios-nvram-rw-implicit"); DO_TEST("bios-nvram-secure", --=20 2.34.1 From nobody Tue May 14 18:09:05 2024 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=1644951643; cv=none; d=zohomail.com; s=zohoarc; b=VWa6kdYXuFLZ/oslJmSn/rmC5JkpkRNcYh3Di7cxw4FTY20SNQe39d3zUI0tX5pOOLChpVjQfhkFbuSOhwOR4Net5KzMXl0Ebh+T4cKFEUKss0XeA6Y0/+hxfZbdztKqJCST2vKaBNK/hrDCPUX6xxHST69eyu6JlARPF2pAoW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644951643; 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=TbrWmz5YJcScOyYY+BrhI1nwVUAhBpNgWdiQBxXbAIc=; b=DFZ8gZKnuZ7V47ATno7svB1/jsPEk0rDBIwGE+J6T5HQni5Ko/BFid4Qn/4Mbl3RaOejvApk24IT+1TzmkJbzjct1sHxRChCfpZ6PiCGVf4si/F4xD1CnEQjzhx4EjDIUGDRsORFmqztFf6DPqqtthlCkj4waSKqkM5+cU7jEak= 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 1644951643153836.2789295261634; Tue, 15 Feb 2022 11:00:43 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-403-wfYGnRvIMVaLK5Ix-4G17w-1; Tue, 15 Feb 2022 14:00:41 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3BF9D344B0; Tue, 15 Feb 2022 19:00:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 16BA72BCE9; Tue, 15 Feb 2022 19:00:36 +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 DB1DC180BAAE; Tue, 15 Feb 2022 19:00:35 +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 21FIspfK029735 for ; Tue, 15 Feb 2022 13:54:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9A6DC838FB; Tue, 15 Feb 2022 18:54:51 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.196.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id B325F838F9; Tue, 15 Feb 2022 18:54:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644951643; 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=TbrWmz5YJcScOyYY+BrhI1nwVUAhBpNgWdiQBxXbAIc=; b=KM9gx4CFXApu6ejwRIqQwrQxX16rCiVPlrCHNdU0Pd7HAj6A8NVoqNqYaOC+vcTgNCml8G 2IcZiZUL0rVE3w2iu4r1T2amAoCGdDC6LtrXQepSBGvXIcBPaMOzO5MLyAPIMXfmFI6tOn jMTyv29U+cqo5SRQyOH1DO1rSBUbnwo= X-MC-Unique: wfYGnRvIMVaLK5Ix-4G17w-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 03/10] tests: add test case for NVRAM with template Date: Tue, 15 Feb 2022 18:54:31 +0000 Message-Id: <20220215185438.1720571-4-berrange@redhat.com> In-Reply-To: <20220215185438.1720571-1-berrange@redhat.com> References: <20220215185438.1720571-1-berrange@redhat.com> 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.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644951654766100003 This demonstrates that /usr/share/OVMF/OVMF_CODE.fd gets expanded to give a per-VM NVRAM path. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- .../bios-nvram-template.x86_64-latest.args | 37 +++++++++++++++++++ .../qemuxml2argvdata/bios-nvram-template.xml | 21 +++++++++++ tests/qemuxml2argvtest.c | 1 + 3 files changed, 59 insertions(+) create mode 100644 tests/qemuxml2argvdata/bios-nvram-template.x86_64-lates= t.args create mode 100644 tests/qemuxml2argvdata/bios-nvram-template.xml diff --git a/tests/qemuxml2argvdata/bios-nvram-template.x86_64-latest.args = b/tests/qemuxml2argvdata/bios-nvram-template.x86_64-latest.args new file mode 100644 index 0000000000..7dc0d604a0 --- /dev/null +++ b/tests/qemuxml2argvdata/bios-nvram-template.x86_64-latest.args @@ -0,0 +1,37 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-test-bios \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-test-bios/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-test-bios/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-test-bios/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dtest-bios,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-test-bios/master-key.aes"}' \ +-blockdev '{"driver":"file","filename":"/usr/share/OVMF/OVMF_CODE.fd","nod= e-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}'= \ +-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver"= :"raw","file":"libvirt-pflash0-storage"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/test-b= ios_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"d= iscard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver= ":"raw","file":"libvirt-pflash1-storage"}' \ +-machine pc,usb=3Doff,dump-guest-core=3Doff,pflash0=3Dlibvirt-pflash0-form= at,pflash1=3Dlibvirt-pflash1-format,memory-backend=3Dpc.ram \ +-accel tcg \ +-cpu qemu64 \ +-m 1024 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}= ' \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 362d1fc1-df7d-193e-5c18-49a71bd1da66 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot menu=3Don,strict=3Don \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","add= r":"0x2"}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/bios-nvram-template.xml b/tests/qemuxml= 2argvdata/bios-nvram-template.xml new file mode 100644 index 0000000000..1bbe4314b5 --- /dev/null +++ b/tests/qemuxml2argvdata/bios-nvram-template.xml @@ -0,0 +1,21 @@ + + test-bios + 362d1fc1-df7d-193e-5c18-49a71bd1da66 + 1048576 + 1048576 + 1 + + hvm + /usr/share/OVMF/OVMF_CODE.fd<= /loader> + + + + + + + + + + /usr/bin/qemu-system-x86_64 + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index fd5fe6054d..a7e8246d38 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1276,6 +1276,7 @@ mymain(void) QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_ICH9_AHCI, QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_CAPS_LATEST("bios-nvram-template"); =20 /* Make sure all combinations of ACPI and UEFI behave as expected */ DO_TEST_NOCAPS("q35-acpi-uefi"); --=20 2.34.1 From nobody Tue May 14 18:09:05 2024 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=1644951531; cv=none; d=zohomail.com; s=zohoarc; b=gIOOUlAlUm20u1dUJTO6rNDAnuq/DiEntVC1gBju7docDBvMBidKNN8tm2NcBfqMP31H1KMVVUJVDNpzHvvMVBNT6B7jbRN3mMrYHIYHm4u0slYhhuE28na3aFL+L97zkRkvlUqqW3BDqas9/QsRddx+KkYWoMIe7b2yRbNmCRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644951531; 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=u0rEfmRm0csZ+uzs2XOY5v6/ulHXTUrSKsiISD/vT04=; b=KZ0t53ExRbiA9PINe/Rz+GgoabiZBITQMAMbPqY1dBir7dn5gEly9oOVTCNsX4NmST/dmA4CcNzXkrRaubVK+AnBa0KwaawF/ui+sdM3/YBL3PlCGZsR6zRK1M8rT3ETJfgpMG2tDAr6sOqSTEm7XyTDheVF0vFGE6o2PtNWH6Y= 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 1644951531817709.1872272296583; Tue, 15 Feb 2022 10:58:51 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-581-3SJWGPSMMmW0Kwv1HNfGdQ-1; Tue, 15 Feb 2022 13:58:48 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2952C80D680; Tue, 15 Feb 2022 18:58:41 +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 0412A2ED64; Tue, 15 Feb 2022 18:58:41 +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 C74454A7C9; Tue, 15 Feb 2022 18:58:40 +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 21FIsrW3029747 for ; Tue, 15 Feb 2022 13:54:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4F75C838E5; Tue, 15 Feb 2022 18:54:53 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.196.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id 764DC838FE; Tue, 15 Feb 2022 18:54:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644951530; 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=u0rEfmRm0csZ+uzs2XOY5v6/ulHXTUrSKsiISD/vT04=; b=RjUaRPxjP5VKLFEMs0UetctNFstlsF0nw67B+/iQCWRz/jnxHbVFwyAk3jH6ZDCy/7MaOO 1qbbC5mI9+wnj47zZbzwJ3EaA0zIy6tpG42QYm7b7Spqzw1+3/gYxra39Se6uIPc6N8Pe5 d0qsLMs6zae2eb0/C4AzrUYXH3v2hKM= X-MC-Unique: 3SJWGPSMMmW0Kwv1HNfGdQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 04/10] conf: validate NVRAM template usage with R/W loader binary Date: Tue, 15 Feb 2022 18:54:32 +0000 Message-Id: <20220215185438.1720571-5-berrange@redhat.com> In-Reply-To: <20220215185438.1720571-1-berrange@redhat.com> References: <20220215185438.1720571-1-berrange@redhat.com> 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.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644951533032100001 The QEMU driver will populate the template to the nvram file any time it sees both the template and nvram paths present. It will auto-generate a nvram path per-VM if not provided by the user, but only if the loader is marked R/O. So with a R/O loader we have these possible scenarios - No NVRAM path or template -> try to infer a template based on the loader path, if not possible, fatal error. Auto-generate NVRAM per per VM - NVRAM path only -> try to infer a template based on the loader path, if not possible, app must have pre-created NVRAM - NVRAM path + template -> QEMU driver will copy template to NVRAM - NVRAM template only -> auto-generate NVRAM path per VM and then copy template While with a R/W loader we have these possible scenarios - No NVRAM path or template -> do nothing - NVRAM path only -> app must have pre-created NVRAM - NVRAM path + template -> QEMU driver will copy template to NVRAM - NVRAM template only -> silently ignored This change improves the last scenario by reporting an error from the parser. Two alternative strategies though would be: - Auto-generate a NVRAM path per VM - Don't support templates at all with R/W loader Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 16 ++++++-- ...-nvram-rw-template-vars.x86_64-latest.args | 41 +++++++++++++++++++ .../bios-nvram-rw-template-vars.xml | 36 ++++++++++++++++ .../bios-nvram-rw-template.err | 1 + .../bios-nvram-rw-template.xml | 36 ++++++++++++++++ .../bios-nvram-rw-vars.x86_64-latest.args | 41 +++++++++++++++++++ tests/qemuxml2argvdata/bios-nvram-rw-vars.xml | 36 ++++++++++++++++ tests/qemuxml2argvtest.c | 3 ++ 8 files changed, 207 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/bios-nvram-rw-template-vars.x86_= 64-latest.args create mode 100644 tests/qemuxml2argvdata/bios-nvram-rw-template-vars.xml create mode 100644 tests/qemuxml2argvdata/bios-nvram-rw-template.err create mode 100644 tests/qemuxml2argvdata/bios-nvram-rw-template.xml create mode 100644 tests/qemuxml2argvdata/bios-nvram-rw-vars.x86_64-latest= .args create mode 100644 tests/qemuxml2argvdata/bios-nvram-rw-vars.xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ab8f2a52cc..31b49c4ec9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4808,17 +4808,26 @@ virDomainDefPostParseMemory(virDomainDef *def, } =20 =20 -static void +static int virDomainDefPostParseOs(virDomainDef *def) { if (!def->os.loader) - return; + return 0; =20 if (def->os.loader->path && def->os.loader->type =3D=3D VIR_DOMAIN_LOADER_TYPE_NONE) { /* By default, loader is type of 'rom' */ def->os.loader->type =3D VIR_DOMAIN_LOADER_TYPE_ROM; } + + if (def->os.loader->readonly !=3D VIR_TRISTATE_BOOL_YES && + def->os.loader->templt && !def->os.loader->nvram) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("NVRAM template without VARs path not permitted w= ith writable loader")); + return -1; + } + + return 0; } =20 =20 @@ -6139,7 +6148,8 @@ virDomainDefPostParseCommon(virDomainDef *def, if (virDomainDefPostParseMemory(def, data->parseFlags) < 0) return -1; =20 - virDomainDefPostParseOs(def); + if (virDomainDefPostParseOs(def) < 0) + return -1; =20 virDomainDefPostParseMemtune(def); =20 diff --git a/tests/qemuxml2argvdata/bios-nvram-rw-template-vars.x86_64-late= st.args b/tests/qemuxml2argvdata/bios-nvram-rw-template-vars.x86_64-latest.= args new file mode 100644 index 0000000000..8d971ec29b --- /dev/null +++ b/tests/qemuxml2argvdata/bios-nvram-rw-template-vars.x86_64-latest.args @@ -0,0 +1,41 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-test-bios \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-test-bios/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-test-bios/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-test-bios/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dtest-bios,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-test-bios/master-key.aes"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/test-b= ios.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discar= d":"unmap"}' \ +-blockdev '{"node-name":"libvirt-pflash0-format","read-only":false,"driver= ":"raw","file":"libvirt-pflash0-storage"}' \ +-blockdev '{"driver":"file","filename":"/some/vars/path.fd","node-name":"l= ibvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver= ":"raw","file":"libvirt-pflash1-storage"}' \ +-machine pc,usb=3Doff,dump-guest-core=3Doff,pflash0=3Dlibvirt-pflash0-form= at,pflash1=3Dlibvirt-pflash1-format,memory-backend=3Dpc.ram \ +-accel tcg \ +-cpu qemu64 \ +-m 1024 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}= ' \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 362d1fc1-df7d-193e-5c18-49a71bd1da66 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot menu=3Don,strict=3Don \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ +-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-form= at","id":"ide0-0-0","bootindex":1}' \ +-device '{"driver":"usb-tablet","id":"input0","bus":"usb.0","port":"1"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","add= r":"0x2"}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/bios-nvram-rw-template-vars.xml b/tests= /qemuxml2argvdata/bios-nvram-rw-template-vars.xml new file mode 100644 index 0000000000..fe6a064c84 --- /dev/null +++ b/tests/qemuxml2argvdata/bios-nvram-rw-template-vars.xml @@ -0,0 +1,36 @@ + + test-bios + 362d1fc1-df7d-193e-5c18-49a71bd1da66 + 1048576 + 1048576 + 1 + + hvm + /var/lib/libvirt/qemu/nvram/te= st-bios.fd + /some/vars/path.fd + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-x86_64 + + + +
+ + + + + + + + + + diff --git a/tests/qemuxml2argvdata/bios-nvram-rw-template.err b/tests/qemu= xml2argvdata/bios-nvram-rw-template.err new file mode 100644 index 0000000000..fdfa6c711e --- /dev/null +++ b/tests/qemuxml2argvdata/bios-nvram-rw-template.err @@ -0,0 +1 @@ +XML error: NVRAM template without VARs path not permitted with writable lo= ader diff --git a/tests/qemuxml2argvdata/bios-nvram-rw-template.xml b/tests/qemu= xml2argvdata/bios-nvram-rw-template.xml new file mode 100644 index 0000000000..334ed1425b --- /dev/null +++ b/tests/qemuxml2argvdata/bios-nvram-rw-template.xml @@ -0,0 +1,36 @@ + + test-bios + 362d1fc1-df7d-193e-5c18-49a71bd1da66 + 1048576 + 1048576 + 1 + + hvm + /var/lib/libvirt/qemu/nvram/te= st-bios.fd + + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-x86_64 + + + +
+ + + + + + + + + + diff --git a/tests/qemuxml2argvdata/bios-nvram-rw-vars.x86_64-latest.args b= /tests/qemuxml2argvdata/bios-nvram-rw-vars.x86_64-latest.args new file mode 100644 index 0000000000..8d971ec29b --- /dev/null +++ b/tests/qemuxml2argvdata/bios-nvram-rw-vars.x86_64-latest.args @@ -0,0 +1,41 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-test-bios \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-test-bios/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-test-bios/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-test-bios/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dtest-bios,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tm= p/lib/domain--1-test-bios/master-key.aes"}' \ +-blockdev '{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/test-b= ios.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discar= d":"unmap"}' \ +-blockdev '{"node-name":"libvirt-pflash0-format","read-only":false,"driver= ":"raw","file":"libvirt-pflash0-storage"}' \ +-blockdev '{"driver":"file","filename":"/some/vars/path.fd","node-name":"l= ibvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-pflash1-format","read-only":false,"driver= ":"raw","file":"libvirt-pflash1-storage"}' \ +-machine pc,usb=3Doff,dump-guest-core=3Doff,pflash0=3Dlibvirt-pflash0-form= at,pflash1=3Dlibvirt-pflash1-format,memory-backend=3Dpc.ram \ +-accel tcg \ +-cpu qemu64 \ +-m 1024 \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}= ' \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 362d1fc1-df7d-193e-5c18-49a71bd1da66 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot menu=3Don,strict=3Don \ +-device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ +-blockdev '{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1","no= de-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \ +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw= ","file":"libvirt-1-storage"}' \ +-device '{"driver":"ide-hd","bus":"ide.0","unit":0,"drive":"libvirt-1-form= at","id":"ide0-0-0","bootindex":1}' \ +-device '{"driver":"usb-tablet","id":"input0","bus":"usb.0","port":"1"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","add= r":"0x2"}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/bios-nvram-rw-vars.xml b/tests/qemuxml2= argvdata/bios-nvram-rw-vars.xml new file mode 100644 index 0000000000..12fdb251f3 --- /dev/null +++ b/tests/qemuxml2argvdata/bios-nvram-rw-vars.xml @@ -0,0 +1,36 @@ + + test-bios + 362d1fc1-df7d-193e-5c18-49a71bd1da66 + 1048576 + 1048576 + 1 + + hvm + /var/lib/libvirt/qemu/nvram/te= st-bios.fd + /some/vars/path.fd + + + + + + + + destroy + restart + restart + + /usr/bin/qemu-system-x86_64 + + + +
+ + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a7e8246d38..a43f19b7a6 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1270,6 +1270,9 @@ mymain(void) DO_TEST_PARSE_ERROR_NOCAPS("bios-nvram-no-path"); DO_TEST_CAPS_LATEST("bios-nvram-rw"); DO_TEST_CAPS_LATEST("bios-nvram-rw-implicit"); + DO_TEST_PARSE_ERROR_NOCAPS("bios-nvram-rw-template"); + DO_TEST_CAPS_LATEST("bios-nvram-rw-template-vars"); + DO_TEST_CAPS_LATEST("bios-nvram-rw-vars"); DO_TEST("bios-nvram-secure", QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_DEVICE_PCI_BRIDGE, --=20 2.34.1 From nobody Tue May 14 18:09:05 2024 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=1644951647; cv=none; d=zohomail.com; s=zohoarc; b=CrBngG0x/TqunCtMzmbmFo853GAieDWQuuqJ3fDWnsbgikCv+35qvCOFTvUhUC2mjlBJCSqNPkgCzoIHiRdHzr8y1Iw2NQunM8U1IHepUldTxgsVBxUKQRr9vRSaXwhHND9oU8AdmYXLQwG1Xr/RX9SvINzzcVRlzE28k1X6XBo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644951647; 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=KREZKQK4xx1Wv/hTSyRFbbjdie4Ubn+jABHtdK5+dUM=; b=b3hyGihB3tWNYB88wqZ9lznNoWcK6E6SXYjqNZfRuNAiap7mppyNvKyLYBPaOVtVEC95Oy97HQ8XzW235SZQkkv7MwRXJo32xUJYAmxNpums3lUuARK3SLn2+JxY/G49Lv56pxUDJ/U05BrAeWyl02tF0vNYt8m1lzVEuSlBgXg= 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 1644951647795710.120462978167; Tue, 15 Feb 2022 11:00:47 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-547-Hg9hyijbOLicUkS1OKjZdw-1; Tue, 15 Feb 2022 14:00:44 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3A6241006AA7; Tue, 15 Feb 2022 19:00:39 +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 1671A5C1A1; Tue, 15 Feb 2022 19:00:39 +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 DA2524A706; Tue, 15 Feb 2022 19:00:38 +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 21FIssgD029755 for ; Tue, 15 Feb 2022 13:54:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9BDEA838F8; Tue, 15 Feb 2022 18:54:54 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.196.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id C49C5838E5; Tue, 15 Feb 2022 18:54:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644951646; 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=KREZKQK4xx1Wv/hTSyRFbbjdie4Ubn+jABHtdK5+dUM=; b=F+uKcQSXdio8MpGbbX2xXipMYpeFE17MRyKT40VJpH4dWbLII8VMbPVfCLv4cZAaXwcW2G qhYyaluit5pDJVqw+0LKr0YxWrWAkzfyqmnwK/o8Tlq28fKAVhzBIbY6k0ECdtiy+w1fvc h/rJEtof0UxGmeoEflghZz34Kb4xukA= X-MC-Unique: Hg9hyijbOLicUkS1OKjZdw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 05/10] tests: don't permit NVRAM path when using firmware auto-select Date: Tue, 15 Feb 2022 18:54:33 +0000 Message-Id: <20220215185438.1720571-6-berrange@redhat.com> In-Reply-To: <20220215185438.1720571-1-berrange@redhat.com> References: <20220215185438.1720571-1-berrange@redhat.com> 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.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644951648483100001 When using we still parse the path, but completely ignore it, replacing any user provided content with a custom generated path. This makes sense since when undefining the guest, the code to cleanup NVRAM also uses the same generated path. Instead of silently ignoring user config, we should report an explicit error message. This shows that some of our tests had the bogus config scenario present. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 8 +++ tests/qemuxml2argvdata/os-firmware-bios.xml | 1 - .../os-firmware-efi-bad-nvram-path.err | 1 + .../os-firmware-efi-bad-nvram-path.xml | 68 +++++++++++++++++++ .../os-firmware-efi-secboot.xml | 1 - tests/qemuxml2argvdata/os-firmware-efi.xml | 1 - tests/qemuxml2argvtest.c | 1 + .../os-firmware-bios.x86_64-latest.xml | 1 - .../os-firmware-efi-secboot.x86_64-latest.xml | 1 - .../os-firmware-efi.x86_64-latest.xml | 1 - 10 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 tests/qemuxml2argvdata/os-firmware-efi-bad-nvram-path.e= rr create mode 100644 tests/qemuxml2argvdata/os-firmware-efi-bad-nvram-path.x= ml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 31b49c4ec9..946a80c239 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4827,6 +4827,14 @@ virDomainDefPostParseOs(virDomainDef *def) return -1; } =20 + if (def->os.firmware !=3D VIR_DOMAIN_OS_DEF_FIRMWARE_NONE) { + if (def->os.loader->nvram) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("NVRAM path is not permitted with firmware at= tribute")); + return -1; + } + } + return 0; } =20 diff --git a/tests/qemuxml2argvdata/os-firmware-bios.xml b/tests/qemuxml2ar= gvdata/os-firmware-bios.xml index 63886666dd..d89fcb6c58 100644 --- a/tests/qemuxml2argvdata/os-firmware-bios.xml +++ b/tests/qemuxml2argvdata/os-firmware-bios.xml @@ -7,7 +7,6 @@ hvm - /var/lib/libvirt/qemu/nvram/fedora_VARS.fd diff --git a/tests/qemuxml2argvdata/os-firmware-efi-bad-nvram-path.err b/te= sts/qemuxml2argvdata/os-firmware-efi-bad-nvram-path.err new file mode 100644 index 0000000000..2ba8135ad4 --- /dev/null +++ b/tests/qemuxml2argvdata/os-firmware-efi-bad-nvram-path.err @@ -0,0 +1 @@ +XML error: NVRAM path is not permitted with firmware attribute diff --git a/tests/qemuxml2argvdata/os-firmware-efi-bad-nvram-path.xml b/te= sts/qemuxml2argvdata/os-firmware-efi-bad-nvram-path.xml new file mode 100644 index 0000000000..a4afdb6d0b --- /dev/null +++ b/tests/qemuxml2argvdata/os-firmware-efi-bad-nvram-path.xml @@ -0,0 +1,68 @@ + + fedora + 63840878-0deb-4095-97e6-fc444d9bc9fa + 8192 + 8192 + 1 + + hvm + + /some/path + + + + + + + + + + destroy + restart + restart + + + + + + /usr/bin/qemu-system-x86_64 + +
+ + + +
+ + + +
+ + + +
+ + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + diff --git a/tests/qemuxml2argvdata/os-firmware-efi-secboot.xml b/tests/qem= uxml2argvdata/os-firmware-efi-secboot.xml index a285e06334..51faac54bf 100644 --- a/tests/qemuxml2argvdata/os-firmware-efi-secboot.xml +++ b/tests/qemuxml2argvdata/os-firmware-efi-secboot.xml @@ -7,7 +7,6 @@ hvm - /var/lib/libvirt/qemu/nvram/fedora_VARS.fd diff --git a/tests/qemuxml2argvdata/os-firmware-efi.xml b/tests/qemuxml2arg= vdata/os-firmware-efi.xml index 46a7b1b780..cb21437ed8 100644 --- a/tests/qemuxml2argvdata/os-firmware-efi.xml +++ b/tests/qemuxml2argvdata/os-firmware-efi.xml @@ -7,7 +7,6 @@ hvm - /var/lib/libvirt/qemu/nvram/fedora_VARS.fd diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a43f19b7a6..8909dcd064 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3478,6 +3478,7 @@ mymain(void) =20 DO_TEST_CAPS_LATEST("os-firmware-bios"); DO_TEST_CAPS_LATEST("os-firmware-efi"); + DO_TEST_PARSE_ERROR_NOCAPS("os-firmware-efi-bad-nvram-path"); DO_TEST_CAPS_LATEST("os-firmware-efi-secboot"); DO_TEST_CAPS_LATEST("os-firmware-efi-no-enrolled-keys"); DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64"); diff --git a/tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml b/= tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml index df6f61421a..a278ff059c 100644 --- a/tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml +++ b/tests/qemuxml2xmloutdata/os-firmware-bios.x86_64-latest.xml @@ -7,7 +7,6 @@ hvm - /var/lib/libvirt/qemu/nvram/fedora_VARS.fd diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest= .xml b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml index c383546cc6..e7224896aa 100644 --- a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml +++ b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.x86_64-latest.xml @@ -7,7 +7,6 @@ hvm - /var/lib/libvirt/qemu/nvram/fedora_VARS.fd diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml b/t= ests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml index 04d57860e7..73f4b9a033 100644 --- a/tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml +++ b/tests/qemuxml2xmloutdata/os-firmware-efi.x86_64-latest.xml @@ -7,7 +7,6 @@ hvm - /var/lib/libvirt/qemu/nvram/fedora_VARS.fd --=20 2.34.1 From nobody Tue May 14 18:09:05 2024 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=1644951535; cv=none; d=zohomail.com; s=zohoarc; b=jPHd0c6QztAzVrcBSp9KGfNjZGhoIoh1IPEIvP5+4MO6sY+C9q794h69mJKqva8JFTT9x4ez6+7s2F777EWUFhzgtWdxshJlViodFjxLFhyCN6pvjvdD88pLsAOrUO2DRBAttILtFepuaa5QR9Vx6VZFsynJBBrQuE4rvF8Guzc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644951535; 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=5fSIa8f8IbbJVGGmBVbCTKSI8MQRGscNwd1kwNGGuIk=; b=W42vwb9i+u1rNqceiczAgPAHBlGRS414I1FcbSiZTCPUvECzKwsvUNrNwW/7+bpf7Beha1ipeV9cXTO8Q0e57hHOzBVCe8kxOrV9yUPbfLsDXpPlj12ASiAaJ4u9LikyTXmLSn56xshbvphGo2A1tVN++ZRTrN4+L7cHUVdDfT8= 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 1644951535492861.4126297451643; Tue, 15 Feb 2022 10:58:55 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-645-rnDawIHbNIGvf1z8G78bRg-1; Tue, 15 Feb 2022 13:58:51 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 471731006AA9; Tue, 15 Feb 2022 18:58:44 +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 28BB8782CF; Tue, 15 Feb 2022 18:58:44 +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 F1B794A7CB; Tue, 15 Feb 2022 18:58:43 +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 21FIstv5029765 for ; Tue, 15 Feb 2022 13:54:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id E849B838F8; Tue, 15 Feb 2022 18:54:55 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.196.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F7D5838E5; Tue, 15 Feb 2022 18:54:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644951535; 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=5fSIa8f8IbbJVGGmBVbCTKSI8MQRGscNwd1kwNGGuIk=; b=Pii4uptZbYNdA1Vx8LySNViFpsmDQR2tIC27Bo1job0tCvX+8wGgtsNgNbEGwRlUEHj5Zv JzKIRU9gfvlakjzIr5e+SYBYElvXdJZr9fZajfp+R3wTtQ7FIwKbfLwjUdYYC/RISPF9Fb 5i/v6syXOs/3DpRnwlam7++iPS7GNDk= X-MC-Unique: rnDawIHbNIGvf1z8G78bRg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 06/10] qemu: inline code for filling in per-VM NVRAM path Date: Tue, 15 Feb 2022 18:54:34 +0000 Message-Id: <20220215185438.1720571-7-berrange@redhat.com> In-Reply-To: <20220215185438.1720571-1-berrange@redhat.com> References: <20220215185438.1720571-1-berrange@redhat.com> 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.15 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644951563290100001 Before creating a NVRAM path, the qemuDomainNVRAMPathGenerate method checks whether the config is using the old style firmware approach. This check is redundant in one of the two callers. By inlining the check into the other caller, it makes it clearer to understand that the NVRAM path filling is done conditionally. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain.c | 14 +++----------- src/qemu/qemu_domain.h | 4 ---- src/qemu/qemu_firmware.c | 7 ++++--- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 4e9c845f68..3c3dfe5984 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4402,7 +4402,9 @@ qemuDomainDefPostParse(virDomainDef *def, def->os.machine =3D g_strdup(machine); } =20 - qemuDomainNVRAMPathGenerate(cfg, def); + if (virDomainDefHasOldStyleROUEFI(def) && + !def->os.loader->nvram) + qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram); =20 if (qemuDomainDefAddDefaultDevices(driver, def, qemuCaps) < 0) return -1; @@ -10963,16 +10965,6 @@ qemuDomainNVRAMPathFormat(virQEMUDriverConfig *cfg, } =20 =20 -void -qemuDomainNVRAMPathGenerate(virQEMUDriverConfig *cfg, - virDomainDef *def) -{ - if (virDomainDefHasOldStyleROUEFI(def) && - !def->os.loader->nvram) - qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram); -} - - virDomainEventSuspendedDetailType qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 3ca6ef084e..d2cb5775e8 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -983,10 +983,6 @@ qemuDomainNVRAMPathFormat(virQEMUDriverConfig *cfg, virDomainDef *def, char **path); =20 -void -qemuDomainNVRAMPathGenerate(virQEMUDriverConfig *cfg, - virDomainDef *def); - virDomainEventSuspendedDetailType qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason); =20 diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 84c80eaacb..a7373e3026 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1139,11 +1139,12 @@ qemuFirmwareEnableFeatures(virQEMUDriver *driver, VIR_FREE(def->os.loader->templt); def->os.loader->templt =3D g_strdup(flash->nvram_template.filename= ); =20 - qemuDomainNVRAMPathGenerate(cfg, def); + qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram); =20 - VIR_DEBUG("decided on firmware '%s' varstore template '%s'", + VIR_DEBUG("decided on firmware '%s' template '%s' NVRAM '%s'", def->os.loader->path, - def->os.loader->templt); + def->os.loader->templt, + def->os.loader->nvram); break; =20 case QEMU_FIRMWARE_DEVICE_KERNEL: --=20 2.34.1 From nobody Tue May 14 18:09:05 2024 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=1644951466; cv=none; d=zohomail.com; s=zohoarc; b=En+cnkivl6nskBHwP6u8xlItGyAC1k2O8Qq5oUTUTsSjnUU9cgEV171/LpA3qKVbbLy+sgXahhlGeTNWDrSSZ+GQHWRFNGG35dEV0iLyu1SKhHVR2CR8SrL7dTobUjn0T9VZBbH4vttZ+bjPyjT+55IoqmRrI5xl7qunSTBBpsU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644951466; 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=XgMC9nH5+uGZ+1TMoJgMxZeWe9ETuB0ZmLBfSne3uNQ=; b=MYL8TUt9HfbO43CIxtWWO5c5vcuv5J2Jc86cxhieLnQImDMBi4McW1ARmuDQ6qB6VEZ+V2DacKF1RA0YEJuvW5/mmD8Q/M5T8nQf9wAAbOrJ5V4Dn7gdhqWX2c4b0lhoQ39XHBNueFEJkjwDGNAgC/7wuQn3ja8bnnXJ2X+HgSo= 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 16449514662581006.3167296761787; Tue, 15 Feb 2022 10:57:46 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-81-9uOQ2oZFOmazNX2rIubKSA-1; Tue, 15 Feb 2022 13:57:42 -0500 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 943311006AA0; Tue, 15 Feb 2022 18:57:37 +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 753E478AAD; Tue, 15 Feb 2022 18:57:37 +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 498A14CA9B; Tue, 15 Feb 2022 18:57:37 +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 21FIsw8G029780 for ; Tue, 15 Feb 2022 13:54:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id F23F6838E5; Tue, 15 Feb 2022 18:54:58 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.196.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBE48838FE; Tue, 15 Feb 2022 18:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644951465; 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=XgMC9nH5+uGZ+1TMoJgMxZeWe9ETuB0ZmLBfSne3uNQ=; b=bvCPJR8wRUa6OemQM8G7skAjSebNkqSzrKe6XWPshh1luEm/DVt2JxgoCvllmkB/Kox9TK csux21HQqYvsJZV3XZaPpWs+Uz6S8M8QVfUPtS0CF+kVRcqgJbBiwhnjbmFMD+13yqVS+F sETI/8sXgSDxIoK+D3wgWXRccHYBUiQ= X-MC-Unique: 9uOQ2oZFOmazNX2rIubKSA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 07/10] conf: rename struct field for NVRAM template Date: Tue, 15 Feb 2022 18:54:35 +0000 Message-Id: <20220215185438.1720571-8-berrange@redhat.com> In-Reply-To: <20220215185438.1720571-1-berrange@redhat.com> References: <20220215185438.1720571-1-berrange@redhat.com> 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644951468086100001 This is to make it explicit that the template only applies to the NVRAM store, not the main loader binary, even if the loader is writable. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 10 +++++----- src/conf/domain_conf.h | 2 +- src/qemu/qemu_firmware.c | 8 ++++---- src/qemu/qemu_process.c | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 946a80c239..13ec64c19f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3528,7 +3528,7 @@ virDomainLoaderDefFree(virDomainLoaderDef *loader) =20 g_free(loader->path); g_free(loader->nvram); - g_free(loader->templt); + g_free(loader->nvramTemplate); g_free(loader); } =20 @@ -4821,7 +4821,7 @@ virDomainDefPostParseOs(virDomainDef *def) } =20 if (def->os.loader->readonly !=3D VIR_TRISTATE_BOOL_YES && - def->os.loader->templt && !def->os.loader->nvram) { + def->os.loader->nvramTemplate && !def->os.loader->nvram) { virReportError(VIR_ERR_XML_ERROR, "%s", _("NVRAM template without VARs path not permitted w= ith writable loader")); return -1; @@ -18243,7 +18243,7 @@ virDomainDefParseBootLoaderOptions(virDomainDef *de= f, =20 def->os.loader->nvram =3D virXPathString("string(./os/nvram[1])", ctxt= ); if (!fwAutoSelect) - def->os.loader->templt =3D virXPathString("string(./os/nvram[1]/@t= emplate)", ctxt); + def->os.loader->nvramTemplate =3D virXPathString("string(./os/nvra= m[1]/@template)", ctxt); =20 return 0; } @@ -26930,9 +26930,9 @@ virDomainLoaderDefFormat(virBuffer *buf, else virBufferAddLit(buf, "/>\n"); =20 - if (loader->nvram || loader->templt) { + if (loader->nvram || loader->nvramTemplate) { virBufferAddLit(buf, "templt); + virBufferEscapeString(buf, " template=3D'%s'", loader->nvramTempla= te); if (loader->nvram) virBufferEscapeString(buf, ">%s\n", loader->nvram); else diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b2922e8cff..9fcf842ee7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2220,7 +2220,7 @@ struct _virDomainLoaderDef { virDomainLoader type; virTristateBool secure; char *nvram; /* path to non-volatile RAM */ - char *templt; /* user override of path to master nvram */ + char *nvramTemplate; /* user override of path to master nvram */ }; =20 void virDomainLoaderDefFree(virDomainLoaderDef *loader); diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index a7373e3026..9ef4399838 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1136,14 +1136,14 @@ qemuFirmwareEnableFeatures(virQEMUDriver *driver, return -1; } =20 - VIR_FREE(def->os.loader->templt); - def->os.loader->templt =3D g_strdup(flash->nvram_template.filename= ); + VIR_FREE(def->os.loader->nvramTemplate); + def->os.loader->nvramTemplate =3D g_strdup(flash->nvram_template.f= ilename); =20 qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram); =20 VIR_DEBUG("decided on firmware '%s' template '%s' NVRAM '%s'", def->os.loader->path, - def->os.loader->templt, + def->os.loader->nvramTemplate, def->os.loader->nvram); break; =20 @@ -1309,7 +1309,7 @@ qemuFirmwareFillDomain(virQEMUDriver *driver, * its path in domain XML) but no template for NVRAM was * specified and the varstore doesn't exist ... */ if (!virDomainDefHasOldStyleROUEFI(def) || - def->os.loader->templt || + def->os.loader->nvramTemplate || virFileExists(def->os.loader->nvram)) return 0; =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 7066696f31..6057e25717 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4440,8 +4440,8 @@ qemuPrepareNVRAM(virQEMUDriver *driver, (virFileExists(loader->nvram) && !reset_nvram)) return 0; =20 - master_nvram_path =3D loader->templt; - if (!loader->templt) { + master_nvram_path =3D loader->nvramTemplate; + if (!loader->nvramTemplate) { size_t i; for (i =3D 0; i < cfg->nfirmwares; i++) { if (STREQ(cfg->firmwares[i]->name, loader->path)) { --=20 2.34.1 From nobody Tue May 14 18:09:05 2024 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=1644951617; cv=none; d=zohomail.com; s=zohoarc; b=W4EpiYOZIgffnadLiiiYq2fdMf8Zc272pf1tS/MqUv6LrbRAAwWQwZ7nsTVDYKrHeTyaxXsH7B+PeFnaymvAZ6B/KAj6+t3UtpDEFDmMBDpE48jQp1XCnYTf4PxzYIZVuYJz5usmDWDWYKc+qwYIxZv1q4xvjFPR7vrIoKXJCIo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644951617; 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=HvmAWYjzoZH4PjPfDXRjtt4KfCQRLYbMiHURUGkkspg=; b=FJivEpqSqA/zrTrZn1nzEKgJxau7I/GCKnE2imcJ3w0/DIA5eWZKirR7A9gCaSor1Td1Sfu8ASDNoaF6+aYzDl13YG5toTCaFEsdFGPU0qtSyiHFZYOQiR8bAzFNBSWbZgPmr1ZpvOperX1G0cLD4yfTQ1RNc6CjOvxOjyQTgdA= 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 1644951617666335.5862762882963; Tue, 15 Feb 2022 11:00:17 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-312-d44BKzB4P-SyBcfCEw9E_g-1; Tue, 15 Feb 2022 13:58:52 -0500 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 4218F80D6B0; Tue, 15 Feb 2022 18:58:47 +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 2139878AB1; Tue, 15 Feb 2022 18:58:47 +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 B8AF64A700; Tue, 15 Feb 2022 18:58:46 +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 21FIt4MJ029808 for ; Tue, 15 Feb 2022 13:55:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id BB7AC838F6; Tue, 15 Feb 2022 18:55:04 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.196.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4D2A838FD; Tue, 15 Feb 2022 18:54:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644951616; 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=HvmAWYjzoZH4PjPfDXRjtt4KfCQRLYbMiHURUGkkspg=; b=RJX2KOv8OsgzoGQkC9+xj3oaRpcsYyMG0M5R5F2tdVjsibgO43pB9eGXkPYZ0tWRUup5aS 3rurYwjV+f7JWyURMxmocdTyoXx7fOWJTlDFcLSXZGxS1mU0kSvzEAr586l5uLtNaMi3Qw NEONIofZg5xIKRJfZ+UwkDZSjojmzrc= X-MC-Unique: d44BKzB4P-SyBcfCEw9E_g-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 08/10] conf: switch nvram parsing to use XML node / property helpers Date: Tue, 15 Feb 2022 18:54:36 +0000 Message-Id: <20220215185438.1720571-9-berrange@redhat.com> In-Reply-To: <20220215185438.1720571-1-berrange@redhat.com> References: <20220215185438.1720571-1-berrange@redhat.com> 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644951620162100001 Instead of using XPath, parse the using the XML node and property helpers so the code is consistent with the parsing of . Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 13ec64c19f..6163910c91 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18229,21 +18229,30 @@ virDomainDefParseBootLoaderOptions(virDomainDef *= def, xmlXPathContextPtr ctxt) { xmlNodePtr loader_node =3D virXPathNode("./os/loader[1]", ctxt); + xmlNodePtr nvram_node =3D virXPathNode("./os/nvram[1]", ctxt); const bool fwAutoSelect =3D def->os.firmware !=3D VIR_DOMAIN_OS_DEF_FI= RMWARE_NONE; + virDomainLoaderDef *loader; =20 if (!loader_node) return 0; =20 - def->os.loader =3D g_new0(virDomainLoaderDef, 1); + def->os.loader =3D loader =3D g_new0(virDomainLoaderDef, 1); =20 if (virDomainLoaderDefParseXML(loader_node, def->os.loader, fwAutoSelect) < 0) return -1; =20 - def->os.loader->nvram =3D virXPathString("string(./os/nvram[1])", ctxt= ); - if (!fwAutoSelect) - def->os.loader->nvramTemplate =3D virXPathString("string(./os/nvra= m[1]/@template)", ctxt); + if (nvram_node) { + if (!(loader->nvram =3D virXMLNodeContentString(nvram_node))) + return -1; + + if (STREQ(loader->nvram, "")) + VIR_FREE(loader->nvram); + + if (!fwAutoSelect) + def->os.loader->nvramTemplate =3D virXMLPropString(nvram_node,= "template"); + } =20 return 0; } --=20 2.34.1 From nobody Tue May 14 18:09:05 2024 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=1644951610; cv=none; d=zohomail.com; s=zohoarc; b=hayRUZYCPLTXcEekg1+G7l5KH4FE/AGnBwPxBHtZ1FCCw8nJf5aFUrHnTDOHiRH0k+u0/cXeuWEuor+7qqe91P5fDAwKelcl90s5bAm+WyIV+aUtxRhg/UHbwT2aoNBqIQ1Hgh0VISzH6CW9mepbu+L9185NpU1j5JTl7y7SFpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644951610; 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=LUCzTkYasEKZ1W4XnRpLC042gPpxPaS6UB636xtqBso=; b=eYFNutf9Sm522wmKBgKL3XlyT8HgOyyqOCwuCImmAOWPv9u0xHpkM6RARP09KePSk/NfHeTAlEtfcxiSjxHJP3DdaFZdR/YPbt/q3/lFPpsexRRaTAmwy8tTSktQqBrjro1pUIxSkbnUyHhPwzVTiNY2GVVQJxFmHoPJ0AeUVzw= 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 1644951610258834.7743888340696; Tue, 15 Feb 2022 11:00:10 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-207-TRO8NCItPsqG2ddhtA2wzQ-1; Tue, 15 Feb 2022 13:58:56 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D57151091DAB; Tue, 15 Feb 2022 18:58:49 +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 B3BF47E2FF; Tue, 15 Feb 2022 18:58:49 +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 8594B4A707; Tue, 15 Feb 2022 18:58:49 +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 21FIt5uv029816 for ; Tue, 15 Feb 2022 13:55:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id E4733838F8; Tue, 15 Feb 2022 18:55:05 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.196.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23A5E838E5; Tue, 15 Feb 2022 18:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644951609; 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=LUCzTkYasEKZ1W4XnRpLC042gPpxPaS6UB636xtqBso=; b=Dnm+6/Psw8G4F/YTynN7O1L9LCFg2mIrPXbK+4TYRoIra8tbPxbL7gKscFO97M77BcUpEl pU7VzIt0WDUn82RYczfwtMQrrLlJOfW1+fwy+WqFHpQvrvo4UdicNW6Oc1bSC/ZuwnCwnJ gAmxccJYwTzIcnZdrHHVX/vQ9VrCLKc= X-MC-Unique: TRO8NCItPsqG2ddhtA2wzQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 09/10] conf: move nvram parsing into virDomainLoaderDefParseXML Date: Tue, 15 Feb 2022 18:54:37 +0000 Message-Id: <20220215185438.1720571-10-berrange@redhat.com> In-Reply-To: <20220215185438.1720571-1-berrange@redhat.com> References: <20220215185438.1720571-1-berrange@redhat.com> 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.12 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644951611082100001 The virDomainLoaderDef struct contains fields for both and elements, so it makes sense to parse them in the same method, just like we'll format them in the same method. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 92 ++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 52 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6163910c91..ac2e068aea 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17813,29 +17813,51 @@ virDomainDefMaybeAddHostdevSCSIcontroller(virDoma= inDef *def) } =20 static int -virDomainLoaderDefParseXML(xmlNodePtr node, - virDomainLoaderDef *loader, - bool fwAutoSelect) +virDomainLoaderDefParseXML(virDomainDef *def, + xmlXPathContextPtr ctxt) { - if (!fwAutoSelect) { - if (virXMLPropTristateBool(node, "readonly", VIR_XML_PROP_NONE, - &loader->readonly) < 0) - return -1; + xmlNodePtr loader_node =3D virXPathNode("./os/loader[1]", ctxt); + xmlNodePtr nvram_node =3D virXPathNode("./os/nvram[1]", ctxt); + const bool fwAutoSelect =3D def->os.firmware !=3D VIR_DOMAIN_OS_DEF_FI= RMWARE_NONE; + virDomainLoaderDef *loader; + + if (!loader_node && !nvram_node) + return 0; + + def->os.loader =3D loader =3D g_new0(virDomainLoaderDef, 1); + + if (loader_node) { + if (!fwAutoSelect) { + if (virXMLPropTristateBool(loader_node, "readonly", VIR_XML_PR= OP_NONE, + &loader->readonly) < 0) + return -1; + + if (virXMLPropEnum(loader_node, "type", virDomainLoaderTypeFro= mString, + VIR_XML_PROP_NONZERO, &loader->type) < 0) + return -1; =20 - if (virXMLPropEnum(node, "type", virDomainLoaderTypeFromString, - VIR_XML_PROP_NONZERO, &loader->type) < 0) + if (!(loader->path =3D virXMLNodeContentString(loader_node))) + return -1; + + if (STREQ(loader->path, "")) + VIR_FREE(loader->path); + } + + if (virXMLPropTristateBool(loader_node, "secure", VIR_XML_PROP_NON= E, + &loader->secure) < 0) return -1; + } =20 - if (!(loader->path =3D virXMLNodeContentString(node))) + if (nvram_node) { + if (!(loader->nvram =3D virXMLNodeContentString(nvram_node))) return -1; =20 - if (STREQ(loader->path, "")) - VIR_FREE(loader->path); - } + if (STREQ(loader->nvram, "")) + VIR_FREE(loader->nvram); =20 - if (virXMLPropTristateBool(node, "secure", VIR_XML_PROP_NONE, - &loader->secure) < 0) - return -1; + if (!fwAutoSelect) + loader->nvramTemplate =3D virXMLPropString(nvram_node, "templa= te"); + } =20 return 0; } @@ -18224,40 +18246,6 @@ virDomainDefParseBootFirmwareOptions(virDomainDef = *def, } =20 =20 -static int -virDomainDefParseBootLoaderOptions(virDomainDef *def, - xmlXPathContextPtr ctxt) -{ - xmlNodePtr loader_node =3D virXPathNode("./os/loader[1]", ctxt); - xmlNodePtr nvram_node =3D virXPathNode("./os/nvram[1]", ctxt); - const bool fwAutoSelect =3D def->os.firmware !=3D VIR_DOMAIN_OS_DEF_FI= RMWARE_NONE; - virDomainLoaderDef *loader; - - if (!loader_node) - return 0; - - def->os.loader =3D loader =3D g_new0(virDomainLoaderDef, 1); - - if (virDomainLoaderDefParseXML(loader_node, - def->os.loader, - fwAutoSelect) < 0) - return -1; - - if (nvram_node) { - if (!(loader->nvram =3D virXMLNodeContentString(nvram_node))) - return -1; - - if (STREQ(loader->nvram, "")) - VIR_FREE(loader->nvram); - - if (!fwAutoSelect) - def->os.loader->nvramTemplate =3D virXMLPropString(nvram_node,= "template"); - } - - return 0; -} - - static int virDomainDefParseBootAcpiOptions(virDomainDef *def, xmlXPathContextPtr ctxt) @@ -18322,7 +18310,7 @@ virDomainDefParseBootOptions(virDomainDef *def, if (virDomainDefParseBootFirmwareOptions(def, ctxt) < 0) return -1; =20 - if (virDomainDefParseBootLoaderOptions(def, ctxt) < 0) + if (virDomainLoaderDefParseXML(def, ctxt) < 0) return -1; =20 if (virDomainDefParseBootAcpiOptions(def, ctxt) < 0) @@ -18338,7 +18326,7 @@ virDomainDefParseBootOptions(virDomainDef *def, case VIR_DOMAIN_OSTYPE_UML: virDomainDefParseBootKernelOptions(def, ctxt); =20 - if (virDomainDefParseBootLoaderOptions(def, ctxt) < 0) + if (virDomainLoaderDefParseXML(def, ctxt) < 0) return -1; =20 break; --=20 2.34.1 From nobody Tue May 14 18:09:05 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=1644951470; cv=none; d=zohomail.com; s=zohoarc; b=mxcoIx0t8QPQYzFubN47qQ17Y5L7EewW1Ugf9C3AkPRq1JwXdu/v2cOgu8HAZVA0jQV8TY/5YxyK0nYFHfEOO/B/ImBz4vki6SEsa9pZCW6hh/zoruYK3UC6WqmM8bzT9xFooSZbQVYj84F9HAUid7GgkXX5HTl2K0W8dcJo4y4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644951470; 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=HbNe+/t3edBV9jQp4fyF2veQY1mFbVz19oEEIRlt1Q0=; b=adeASEfOs1LAbzVAzQlalI6O2xFAJjdO1/Ry5J2RM9qQ8zA+DmgRCFfKU1AJzNUQr1rFC0p60QqppswLHG9FYnXjzv3Vtg3At1CtJ+tiUwo9JgR6D76u1uJp9a8c+UH5wQ2MyKthqWIEWOh32pbCaDYE1Ki0NsL5WXXnoxtXqdM= 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 1644951470568402.2790302180565; Tue, 15 Feb 2022 10:57:50 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-642-iwwKXUVPM0-n5Cl9axTbnQ-1; Tue, 15 Feb 2022 13:57:45 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 41EA5801B0C; Tue, 15 Feb 2022 18:57:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 221087E91C; Tue, 15 Feb 2022 18:57:40 +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 E3EB91802E34; Tue, 15 Feb 2022 18:57:39 +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 21FIt7tw029825 for ; Tue, 15 Feb 2022 13:55:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 30392838F6; Tue, 15 Feb 2022 18:55:07 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.196.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id 541A9838E5; Tue, 15 Feb 2022 18:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644951469; 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=HbNe+/t3edBV9jQp4fyF2veQY1mFbVz19oEEIRlt1Q0=; b=cLjOqZ9POiLXWnhxnXNJUvTXJ/Lm/mKx0pyccAVhvfGf6tLG8M+QQBF5rf5AesCyehRype YLBX54sB7/Y18n75G6O0hlw3h9C3cS43Azl0vZ7n46I/Vx0fUVuIm7ljYsLpAzLtusXxQL hQztbeYBDbyyZDzH5v08ZX6eJZOHbBs= X-MC-Unique: iwwKXUVPM0-n5Cl9axTbnQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 10/10] conf: stop ignoring / with firmware auto-select Date: Tue, 15 Feb 2022 18:54:38 +0000 Message-Id: <20220215185438.1720571-11-berrange@redhat.com> In-Reply-To: <20220215185438.1720571-1-berrange@redhat.com> References: <20220215185438.1720571-1-berrange@redhat.com> 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.12 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644951472329100001 Currently if the firmware attribute is set then we silently ignore most of the and element configs. This changes the code so that we always fully parse the and but then use a post-parse method to explicitly reject invalid combinations. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 50 ++++++++++---- .../os-firmware-efi-bad-loader-path.err | 1 + .../os-firmware-efi-bad-loader-path.xml | 67 ++++++++++++++++++ .../os-firmware-efi-bad-loader-type.err | 1 + .../os-firmware-efi-bad-loader-type.xml | 67 ++++++++++++++++++ .../os-firmware-efi-bad-nvram-template.err | 1 + .../os-firmware-efi-bad-nvram-template.xml | 68 +++++++++++++++++++ tests/qemuxml2argvtest.c | 3 + 8 files changed, 243 insertions(+), 15 deletions(-) create mode 100644 tests/qemuxml2argvdata/os-firmware-efi-bad-loader-path.= err create mode 100644 tests/qemuxml2argvdata/os-firmware-efi-bad-loader-path.= xml create mode 100644 tests/qemuxml2argvdata/os-firmware-efi-bad-loader-type.= err create mode 100644 tests/qemuxml2argvdata/os-firmware-efi-bad-loader-type.= xml create mode 100644 tests/qemuxml2argvdata/os-firmware-efi-bad-nvram-templa= te.err create mode 100644 tests/qemuxml2argvdata/os-firmware-efi-bad-nvram-templa= te.xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ac2e068aea..542c9bda12 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4828,6 +4828,30 @@ virDomainDefPostParseOs(virDomainDef *def) } =20 if (def->os.firmware !=3D VIR_DOMAIN_OS_DEF_FIRMWARE_NONE) { + if (def->os.loader->path) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Loader path is not permitted with firmware a= ttribute")); + return -1; + } + + if (def->os.loader->type) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Loader type is not permitted with firmware a= ttribute")); + return -1; + } + + if (def->os.loader->readonly) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Loader read-only attribute is not permitted = with firmware attribute")); + return -1; + } + + if (def->os.loader->nvramTemplate) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("NVRAM template path is not permitted with fi= rmware attribute")); + return -1; + } + if (def->os.loader->nvram) { virReportError(VIR_ERR_XML_ERROR, "%s", _("NVRAM path is not permitted with firmware at= tribute")); @@ -17818,7 +17842,6 @@ virDomainLoaderDefParseXML(virDomainDef *def, { xmlNodePtr loader_node =3D virXPathNode("./os/loader[1]", ctxt); xmlNodePtr nvram_node =3D virXPathNode("./os/nvram[1]", ctxt); - const bool fwAutoSelect =3D def->os.firmware !=3D VIR_DOMAIN_OS_DEF_FI= RMWARE_NONE; virDomainLoaderDef *loader; =20 if (!loader_node && !nvram_node) @@ -17827,21 +17850,19 @@ virDomainLoaderDefParseXML(virDomainDef *def, def->os.loader =3D loader =3D g_new0(virDomainLoaderDef, 1); =20 if (loader_node) { - if (!fwAutoSelect) { - if (virXMLPropTristateBool(loader_node, "readonly", VIR_XML_PR= OP_NONE, - &loader->readonly) < 0) - return -1; + if (virXMLPropTristateBool(loader_node, "readonly", VIR_XML_PROP_N= ONE, + &loader->readonly) < 0) + return -1; =20 - if (virXMLPropEnum(loader_node, "type", virDomainLoaderTypeFro= mString, - VIR_XML_PROP_NONZERO, &loader->type) < 0) - return -1; + if (virXMLPropEnum(loader_node, "type", virDomainLoaderTypeFromStr= ing, + VIR_XML_PROP_NONZERO, &loader->type) < 0) + return -1; =20 - if (!(loader->path =3D virXMLNodeContentString(loader_node))) - return -1; + if (!(loader->path =3D virXMLNodeContentString(loader_node))) + return -1; =20 - if (STREQ(loader->path, "")) - VIR_FREE(loader->path); - } + if (STREQ(loader->path, "")) + VIR_FREE(loader->path); =20 if (virXMLPropTristateBool(loader_node, "secure", VIR_XML_PROP_NON= E, &loader->secure) < 0) @@ -17855,8 +17876,7 @@ virDomainLoaderDefParseXML(virDomainDef *def, if (STREQ(loader->nvram, "")) VIR_FREE(loader->nvram); =20 - if (!fwAutoSelect) - loader->nvramTemplate =3D virXMLPropString(nvram_node, "templa= te"); + loader->nvramTemplate =3D virXMLPropString(nvram_node, "template"); } =20 return 0; diff --git a/tests/qemuxml2argvdata/os-firmware-efi-bad-loader-path.err b/t= ests/qemuxml2argvdata/os-firmware-efi-bad-loader-path.err new file mode 100644 index 0000000000..a8dbd0d6d8 --- /dev/null +++ b/tests/qemuxml2argvdata/os-firmware-efi-bad-loader-path.err @@ -0,0 +1 @@ +XML error: Loader path is not permitted with firmware attribute diff --git a/tests/qemuxml2argvdata/os-firmware-efi-bad-loader-path.xml b/t= ests/qemuxml2argvdata/os-firmware-efi-bad-loader-path.xml new file mode 100644 index 0000000000..02eec67c35 --- /dev/null +++ b/tests/qemuxml2argvdata/os-firmware-efi-bad-loader-path.xml @@ -0,0 +1,67 @@ + + fedora + 63840878-0deb-4095-97e6-fc444d9bc9fa + 8192 + 8192 + 1 + + hvm + /some/path + + + + + + + + + + destroy + restart + restart + + + + + + /usr/bin/qemu-system-x86_64 + +
+ + + +
+ + + +
+ + + +
+ + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + diff --git a/tests/qemuxml2argvdata/os-firmware-efi-bad-loader-type.err b/t= ests/qemuxml2argvdata/os-firmware-efi-bad-loader-type.err new file mode 100644 index 0000000000..2824399628 --- /dev/null +++ b/tests/qemuxml2argvdata/os-firmware-efi-bad-loader-type.err @@ -0,0 +1 @@ +XML error: Loader type is not permitted with firmware attribute diff --git a/tests/qemuxml2argvdata/os-firmware-efi-bad-loader-type.xml b/t= ests/qemuxml2argvdata/os-firmware-efi-bad-loader-type.xml new file mode 100644 index 0000000000..9091a2a8ce --- /dev/null +++ b/tests/qemuxml2argvdata/os-firmware-efi-bad-loader-type.xml @@ -0,0 +1,67 @@ + + fedora + 63840878-0deb-4095-97e6-fc444d9bc9fa + 8192 + 8192 + 1 + + hvm + + + + + + + + + + + destroy + restart + restart + + + + + + /usr/bin/qemu-system-x86_64 + +
+ + + +
+ + + +
+ + + +
+ + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + diff --git a/tests/qemuxml2argvdata/os-firmware-efi-bad-nvram-template.err = b/tests/qemuxml2argvdata/os-firmware-efi-bad-nvram-template.err new file mode 100644 index 0000000000..866ef34ec4 --- /dev/null +++ b/tests/qemuxml2argvdata/os-firmware-efi-bad-nvram-template.err @@ -0,0 +1 @@ +XML error: NVRAM template path is not permitted with firmware attribute diff --git a/tests/qemuxml2argvdata/os-firmware-efi-bad-nvram-template.xml = b/tests/qemuxml2argvdata/os-firmware-efi-bad-nvram-template.xml new file mode 100644 index 0000000000..cf77ca5433 --- /dev/null +++ b/tests/qemuxml2argvdata/os-firmware-efi-bad-nvram-template.xml @@ -0,0 +1,68 @@ + + fedora + 63840878-0deb-4095-97e6-fc444d9bc9fa + 8192 + 8192 + 1 + + hvm + + /some/vars + + + + + + + + + + destroy + restart + restart + + + + + + /usr/bin/qemu-system-x86_64 + +
+ + + +
+ + + +
+ + + +
+ + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 8909dcd064..82105892b0 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3478,7 +3478,10 @@ mymain(void) =20 DO_TEST_CAPS_LATEST("os-firmware-bios"); DO_TEST_CAPS_LATEST("os-firmware-efi"); + DO_TEST_PARSE_ERROR_NOCAPS("os-firmware-efi-bad-loader-path"); + DO_TEST_PARSE_ERROR_NOCAPS("os-firmware-efi-bad-loader-type"); DO_TEST_PARSE_ERROR_NOCAPS("os-firmware-efi-bad-nvram-path"); + DO_TEST_PARSE_ERROR_NOCAPS("os-firmware-efi-bad-nvram-template"); DO_TEST_CAPS_LATEST("os-firmware-efi-secboot"); DO_TEST_CAPS_LATEST("os-firmware-efi-no-enrolled-keys"); DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64"); --=20 2.34.1