From nobody Mon Apr 29 13:27:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 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=1573833132; cv=none; d=zoho.com; s=zohoarc; b=PXBCa0X4RAaoaxr/HuaRgo+ZyFpQ256X8tuf4yhLUexa4It/Ovm1pTu1DAqDQ5xpwaPuvIprXkkV3YqWP1c9+g9ezuxnGOU1J79r34sHlGiK0ybmEB1aY2xKHG0mrPXgk835oGlWuL0cVyBIl5IFL2lAdBKrj16Iq3ZRxJn6T+U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573833132; 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=vYSenJRTJbKzfcD8qxtrPKxR5Aa97BNJLz209L6zGt4=; b=dSpAmCG467GT3shTZA75KjDkyd2uqyK41ArfkNLeQWujiHGkbUR50fvHRgNLuM1hqydMh5PSIVGbVgk8Wc4NCjfeLZpowjFMotNtkGf2RZKYbzokUIMCPQtglxd0QlGWtB0bsasuA4mV4r5l8KoZiDB05z0druyWh+uthEpNFCo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1573833132741152.69189700049765; Fri, 15 Nov 2019 07:52:12 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-305-7jtdejzQMSOhnJmYfZrNHQ-1; Fri, 15 Nov 2019 10:52:09 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 66DCB1883521; Fri, 15 Nov 2019 15:52:02 +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 E821410016E8; Fri, 15 Nov 2019 15:52:01 +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 CC63618089CF; Fri, 15 Nov 2019 15:52:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAFFpvt6007012 for ; Fri, 15 Nov 2019 10:51:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 377D61D9; Fri, 15 Nov 2019 15:51:57 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id B776B5D6D0 for ; Fri, 15 Nov 2019 15:51:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573833131; 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=vYSenJRTJbKzfcD8qxtrPKxR5Aa97BNJLz209L6zGt4=; b=AuGxM6AFRiL1WPpiR435SnoMpAxah97wEi1yPmU7KjBmhJOYjwuMyTZYmonATohGXKccTQ jhJfZ18pQ5WUyPlBrWss85nHXqwZACoKZx5GnFjv4+rRJX0GHzVIltydUhn86+tAb+OC9I hHuwW6Y6uZdIK3vYeaZBx24SwYpOVNU= From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 15 Nov 2019 16:51:47 +0100 Message-Id: <0bc74d2bf6a5d8b8bd33686cf084bf029676e581.1573832995.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/6] qemu: command: Extract formatting of -drive for pflash 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.22 X-MC-Unique: 7jtdejzQMSOhnJmYfZrNHQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Extract the old way to instantiate pflash devices to hold the firmware via -drive to a separate function so that it can later be conditionally disabled when -blockdev will be used. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 72 +++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ca1bd12594..c82d13483e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9416,53 +9416,61 @@ qemuBuildRedirdevCommandLine(virLogManagerPtr logMa= nager, static void -qemuBuildDomainLoaderCommandLine(virCommandPtr cmd, - virDomainDefPtr def) +qemuBuldDomainLoaderPflashCommandLine(virCommandPtr cmd, + virDomainLoaderDefPtr loader) { - virDomainLoaderDefPtr loader =3D def->os.loader; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; int unit =3D 0; - if (!loader) - return; + if (loader->secure =3D=3D VIR_TRISTATE_BOOL_YES) { + virCommandAddArgList(cmd, + "-global", + "driver=3Dcfi.pflash01,property=3Dsecure,valu= e=3Don", + NULL); + } - switch ((virDomainLoader) loader->type) { - case VIR_DOMAIN_LOADER_TYPE_ROM: - virCommandAddArg(cmd, "-bios"); - virCommandAddArg(cmd, loader->path); - break; + virBufferAddLit(&buf, "file=3D"); + virQEMUBuildBufferEscapeComma(&buf, loader->path); + virBufferAsprintf(&buf, ",if=3Dpflash,format=3Draw,unit=3D%d", unit); + unit++; - case VIR_DOMAIN_LOADER_TYPE_PFLASH: + if (loader->readonly) { + virBufferAsprintf(&buf, ",readonly=3D%s", + virTristateSwitchTypeToString(loader->readonly)); + } - if (loader->secure =3D=3D VIR_TRISTATE_BOOL_YES) { - virCommandAddArgList(cmd, - "-global", - "driver=3Dcfi.pflash01,property=3Dsecure,= value=3Don", - NULL); - } + virCommandAddArg(cmd, "-drive"); + virCommandAddArgBuffer(cmd, &buf); + if (loader->nvram) { + virBufferFreeAndReset(&buf); virBufferAddLit(&buf, "file=3D"); - virQEMUBuildBufferEscapeComma(&buf, loader->path); + virQEMUBuildBufferEscapeComma(&buf, loader->nvram); virBufferAsprintf(&buf, ",if=3Dpflash,format=3Draw,unit=3D%d", uni= t); - unit++; - - if (loader->readonly) { - virBufferAsprintf(&buf, ",readonly=3D%s", - virTristateSwitchTypeToString(loader->readon= ly)); - } virCommandAddArg(cmd, "-drive"); virCommandAddArgBuffer(cmd, &buf); + } +} - if (loader->nvram) { - virBufferFreeAndReset(&buf); - virBufferAddLit(&buf, "file=3D"); - virQEMUBuildBufferEscapeComma(&buf, loader->nvram); - virBufferAsprintf(&buf, ",if=3Dpflash,format=3Draw,unit=3D%d",= unit); - virCommandAddArg(cmd, "-drive"); - virCommandAddArgBuffer(cmd, &buf); - } +static void +qemuBuildDomainLoaderCommandLine(virCommandPtr cmd, + virDomainDefPtr def) +{ + virDomainLoaderDefPtr loader =3D def->os.loader; + + if (!loader) + return; + + switch ((virDomainLoader) loader->type) { + case VIR_DOMAIN_LOADER_TYPE_ROM: + virCommandAddArg(cmd, "-bios"); + virCommandAddArg(cmd, loader->path); + break; + + case VIR_DOMAIN_LOADER_TYPE_PFLASH: + qemuBuldDomainLoaderPflashCommandLine(cmd, loader); break; case VIR_DOMAIN_LOADER_TYPE_NONE: --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 13:27:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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=1573833141; cv=none; d=zoho.com; s=zohoarc; b=AAQ2abQlzKWbT6veMSwLG1vp90ouQb42BUZbMjISBpmSiqCfbJk8WnX+1VfjseZC0Nbv5Jeks2GcrOTlnJJl0MkitiTMPQa252XZfJT7laU/zon/OOz0TJfIZrNxxvEMTmeT1imgRkc7TKV22BxrxLGB63BXwQGBNwpHNSwIrME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573833141; 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=JmDN5CVvDQUZ2CeSfYp4tZcU8rC4AxmsgikTWJlYyXs=; b=ClWhJhE97Lxr4IBGoi6wg9pWsUCj6ASehFjCpCZJEfPI1SIdfIHoKxPnibI2PumKLpIs8TA59gXsRl535f6GALScIgKt0l6b4EdF3vLHQ6DwpWonF2NYMXt71jXh/ZFGXH7Rm+EFb5xc1LxLWexZ5LMVbz9zlciKUWX87xcjobg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1573833141465112.7856145449058; Fri, 15 Nov 2019 07:52:21 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-28-g50ijnMeNtW0xY-CacuvmQ-1; Fri, 15 Nov 2019 10:52:17 -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 07CE91005512; Fri, 15 Nov 2019 15:52:12 +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 D6A085ED32; Fri, 15 Nov 2019 15:52:11 +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 8F0BE18089D7; Fri, 15 Nov 2019 15:52:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAFFpwh0007018 for ; Fri, 15 Nov 2019 10:51:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id 053171D9; Fri, 15 Nov 2019 15:51:58 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 844855D6D0 for ; Fri, 15 Nov 2019 15:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573833140; 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=JmDN5CVvDQUZ2CeSfYp4tZcU8rC4AxmsgikTWJlYyXs=; b=Bv93GCoiK3VKMMNs5qKTT6sg3rbepA5fJC6PYsp7s5blu0btcDi72M2RWb4bdKKeRfowDY Rk/At2ehgTNXmeoz9veGdHWJS7U/u4P5tKMA1AdHDdXbRosY1e+GmL5SEDUFT6ewRO4ODG 81OTXeX3oSq0Sxct8BrQj966mr32EoE= From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 15 Nov 2019 16:51:48 +0100 Message-Id: <6cf1e245bdcc90db32468e5c2312a9ec9511b914.1573832995.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/6] qemu: domain: Store virStorageSources representing pflash backing 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 X-MC-Unique: g50ijnMeNtW0xY-CacuvmQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" To allow converting the pflash drives to blockdev we will need a virStorageSource to allow using our helpers. Temporarily prior to coverting loader data to a virStorageSoruce add private data which will house this. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_domain.c | 5 +++++ src/qemu/qemu_domain.h | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e14b414518..0285669b24 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2167,6 +2167,11 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePt= r priv) virHashRemoveAll(priv->blockjobs); virHashRemoveAll(priv->dbusVMStates); + + virObjectUnref(priv->pflash0); + priv->pflash0 =3D NULL; + virObjectUnref(priv->pflash1); + priv->pflash1 =3D NULL; } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 98a9540275..a545edb022 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -397,6 +397,12 @@ struct _qemuDomainObjPrivate { virHashTablePtr dbusVMStates; bool disableSlirp; + + /* Until we add full support for backing chains for pflash drives, the= se + * pointers hold the temporary virStorageSources for creating the -blo= ckdev + * commandline for pflash drives. */ + virStorageSourcePtr pflash0; + virStorageSourcePtr pflash1; }; #define QEMU_DOMAIN_PRIVATE(vm) \ --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 13:27:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 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=1573833145; cv=none; d=zoho.com; s=zohoarc; b=gWOgMvhQml0EJN8a3+8J+fXPGegQeHVZWHvH4z7bTh9XvpG342EZ9SYCZ9xVa81wvTn9NH0rI46HvfB0zf41Ra9oGJ3fbrI5umW+J4TlBPLV5MwP5DiMIgzxmPsHsjlUQ5/CLkXNKNVy6CFNQ7MObMLUuMIXYVANEAG256PMEbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573833145; 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=YIqO34ZKFUKjij6TQU7JOvC4LVPOvD7XMxauHPP//jk=; b=WK5n2eIqGd0bEJEB64jXXDvrovTrnLzbOM0M7iSvlbYoGKNCd6IHaRZWtP20lByRaiSmSKLafNossH/aX7Id/Rdv14KN4aAc2bZQAdrn+2tQpv3qMRUN8Tp2O3oTyvR06f7AyhQ9XgMM1dEkKhlC7NTIfjzO5HvnnM1fpOo3tW4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1573833145148254.96434189372394; Fri, 15 Nov 2019 07:52:25 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-113-h3uwVfpjPMK6AdoaKk5sEw-1; Fri, 15 Nov 2019 10:52:22 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9E68D802B4A; Fri, 15 Nov 2019 15:52:15 +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 6F6006013C; Fri, 15 Nov 2019 15:52:15 +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 1B3AE4E562; Fri, 15 Nov 2019 15:52:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAFFpw0w007028 for ; Fri, 15 Nov 2019 10:51:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id C43061D9; Fri, 15 Nov 2019 15:51:58 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 507EC5D6D0 for ; Fri, 15 Nov 2019 15:51:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573833144; 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=YIqO34ZKFUKjij6TQU7JOvC4LVPOvD7XMxauHPP//jk=; b=RAJQrfF3FSNFn45jQ3dGBA5djVuaO/KHv/nbpBx08ajnG60lfBI4nR7E5mmVLnOOC9Sj80 YsWTmJJeUGaWNGPEffbs0Ze9KLSYihW/ird3G4ZQDPui+t7J6XpXGaiBlYceXWDBtHB1xx 3HviFl+s2HIcNEcZ9TN/ebxflTnd1Pk= From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 15 Nov 2019 16:51:49 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/6] qemu: domain: Introduce helper to convert into virStorageSource X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: h3uwVfpjPMK6AdoaKk5sEw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add a helper which will covert the PFLASH code file and variable file into the virStorageSource objects stored in private data so that we can use them with -blockdev while keeping the infrastructure to determine the path to the loaders intact. This is a temporary solution until we will want to do snapshots of the pflash where we will be forced do track the full backing chain in the XML. In the meanwhile just convert it partially so that we can stop using -drive. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_domain.c | 58 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 3 +++ 2 files changed, 61 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0285669b24..33b91e51e1 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -15583,3 +15583,61 @@ qemuDomainSupportsCheckpointsBlockjobs(virDomainOb= jPtr vm) return 0; } + +/** + * qemuDomainInitializePflashStorageSource: + * + * This helper converts the specification of the source of the 'loader' in= case + * PFLASH is required to virStorageSources in case QEMU_CAPS_BLOCKDEV is p= resent. + * + * This helper is used in the intermediate state when we don't support full + * backing chains for pflash drives in the XML. + * + * The nodenames used here have a different prefix to allow for a later + * conversion. The prefixes are 'libvirt-pflash0-storage', + * 'libvirt-pflash0-format' for pflash0 and 'libvirt-pflash1-storage' and + * 'libvirt-pflash1-format' for pflash1. + */ +int +qemuDomainInitializePflashStorageSource(virDomainObjPtr vm) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + virDomainDefPtr def =3D vm->def; + g_autoptr(virStorageSource) pflash0 =3D NULL; + g_autoptr(virStorageSource) pflash1 =3D NULL; + + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) + return 0; + + if (!def->os.loader || + def->os.loader->type !=3D VIR_DOMAIN_LOADER_TYPE_PFLASH) + return 0; + + if (!(pflash0 =3D virStorageSourceNew())) + return -1; + + pflash0->type =3D VIR_STORAGE_TYPE_FILE; + pflash0->format =3D VIR_STORAGE_FILE_RAW; + pflash0->path =3D g_strdup(def->os.loader->path); + pflash0->readonly =3D def->os.loader->readonly; + pflash0->nodeformat =3D g_strdup("libvirt-pflash0-format"); + pflash0->nodestorage =3D g_strdup("libvirt-pflash0-storage"); + + + if (def->os.loader->nvram) { + if (!(pflash1 =3D virStorageSourceNew())) + return -1; + + pflash1->type =3D VIR_STORAGE_TYPE_FILE; + pflash1->format =3D VIR_STORAGE_FILE_RAW; + pflash1->path =3D g_strdup(def->os.loader->nvram); + pflash1->readonly =3D false; + pflash1->nodeformat =3D g_strdup("libvirt-pflash1-format"); + pflash1->nodestorage =3D g_strdup("libvirt-pflash1-storage"); + } + + priv->pflash0 =3D g_steal_pointer(&pflash0); + priv->pflash1 =3D g_steal_pointer(&pflash1); + + return 0; +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index a545edb022..db45a932dc 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1235,3 +1235,6 @@ qemuDomainSupportsCheckpointsBlockjobs(virDomainObjPt= r vm) int qemuDomainMakeCPUMigratable(virCPUDefPtr cpu); + +int +qemuDomainInitializePflashStorageSource(virDomainObjPtr vm); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 13:27:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1573833140; cv=none; d=zoho.com; s=zohoarc; b=G78jjW95txRDMGE/LcRXADJeG/a58t7Sf88mAG2Bv7ymRtVKjvfRkgBrK3bCJCkAP+PFBmrR3IqFQAxteH2sQheUjAN0i6ZYqrho4SjiCp+s9YXaXW69Gx4j+fNcs/xpa9zeeI3zvkQ/yEaY17yq8ayYZvaZw0XzsVN87qpAPvc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573833140; 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=MtwO6ZXbZdZ979qeKzE+9vTcar7CjTZPkD+HikvaaBQ=; b=hLXGjZT3HRxnMwDI4urzAFuficRh+voyvwz9RXXkkzVlyUlI6Dr8V7HnICw6rn2w6savyfdzYAKoaNJyC+F1O+0Y8AZlgPdkUMLNhB5V/ypd62Kq8ZHfXrrFF9QpXyIiVWIN0KB7eEbXmDZl3zhdOgelG39pMLSuHC4/JAYLtr8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 157383314014093.8132521459039; Fri, 15 Nov 2019 07:52:20 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-292-_enssHCFPSitoTlT6h8l2w-1; Fri, 15 Nov 2019 10:52:17 -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 0F438DB23; Fri, 15 Nov 2019 15:52:12 +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 DDCA063647; Fri, 15 Nov 2019 15:52:11 +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 961094BB78; Fri, 15 Nov 2019 15:52:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAFFpxOq007033 for ; Fri, 15 Nov 2019 10:51:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 90BBF1D9; Fri, 15 Nov 2019 15:51:59 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1BFF15D6D0 for ; Fri, 15 Nov 2019 15:51:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573833138; 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=MtwO6ZXbZdZ979qeKzE+9vTcar7CjTZPkD+HikvaaBQ=; b=G/jPj9NtNjkd7S616hEVol/+N21CaNXIb5vCTfSmEdSJwQt61Q21lFuMEsbFOIkor26ih3 4Kmna9igmLUxySL8c6XfaMGuzSasiL90OUkZgVaeozFJZGa3ChIZL3wqV1aELuzd6tjIfS rLLCm07q/pJjO/V98IMLrY0do5kPb70= From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 15 Nov 2019 16:51:50 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/6] qemu: command: Build -blockdev-s for backing of pflash 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 X-MC-Unique: _enssHCFPSitoTlT6h8l2w-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" As a first step we will build the blockdevs which will be supposed to back the pflash drives when moving away from -drive. This code is similar to the way we build the blockdevs for the disk, but skips the copy-on-read layer and doesn't implement any legacy approach. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_command.c | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c82d13483e..c1de2a398f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9884,6 +9884,49 @@ qemuBuildManagedPRCommandLine(virCommandPtr cmd, } +static int +qemuBuildPflashBlockdevOne(virCommandPtr cmd, + virStorageSourcePtr src, + virQEMUCapsPtr qemuCaps) +{ + g_autoptr(qemuBlockStorageSourceChainData) data =3D NULL; + size_t i; + + if (!(data =3D qemuBuildStorageSourceChainAttachPrepareBlockdev(src, + qemuCaps= ))) + return -1; + + for (i =3D data->nsrcdata; i > 0; i--) { + if (qemuBuildBlockStorageSourceAttachDataCommandline(cmd, + data->srcdata= [i - 1]) < 0) + return -1; + } + + return 0; +} + + +static int +qemuBuildPflashBlockdevCommandLine(virCommandPtr cmd, + qemuDomainObjPrivatePtr priv) +{ + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) + return 0; + + if (priv->pflash0) { + if (qemuBuildPflashBlockdevOne(cmd, priv->pflash0, priv->qemuCaps)= < 0) + return -1; + } + + if (priv->pflash1) { + if (qemuBuildPflashBlockdevOne(cmd, priv->pflash1, priv->qemuCaps)= < 0) + return -1; + } + + return 0; +} + + static virJSONValuePtr qemuBuildDBusVMStateInfoPropsInternal(const char *alias, const char *addr) @@ -10200,6 +10243,9 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, if (qemuBuildManagedPRCommandLine(cmd, def, priv) < 0) return NULL; + if (qemuBuildPflashBlockdevCommandLine(cmd, priv) < 0) + return NULL; + if (enableFips) virCommandAddArg(cmd, "-enable-fips"); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 13:27:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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=1573833147; cv=none; d=zoho.com; s=zohoarc; b=LjYa1DUlRwYPEY0wcSRxMCeW8suteymB7EYLiqJKOJf2B9Kh8HUdnrHPiLrSt/p+prxDLR3vOepwjM/a3OCCb+etxRjM/0thb4tlNMMw6ruvLS77cReED6VK6169/ILehEfkvYEXS87w49jwlL33xMh0cMukDgU9sPFe7xMiDiI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573833147; 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=5rlolmP252gNHzIqRjsheMOf4OWTtSj8FS8J5MuOF/w=; b=ji6dyAg9Rtpvys+XdpehOqzkHtTVVdj7kzNWs4niQ16UXrLZIgMae/H+uIN6dUtAtcUvhrJ0FCYkwfpv+13nlmjARnJmr5WHPINgdwAUr4UiArLsUok3X+P7l+Qp3LXPIa4hYDfk5147mU2vrz4FTCqlvrWXDCn3K9eo9Ot13qU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1573833147783595.637925350773; Fri, 15 Nov 2019 07:52:27 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-242-_1mbWi9NOj6eP2pFEtgRNQ-1; Fri, 15 Nov 2019 10:52:24 -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 272DB800686; Fri, 15 Nov 2019 15:52:19 +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 ED0EE75E42; Fri, 15 Nov 2019 15:52:18 +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 AF38A18089D0; Fri, 15 Nov 2019 15:52:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAFFq02h007039 for ; Fri, 15 Nov 2019 10:52:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5CFB31DA; Fri, 15 Nov 2019 15:52:00 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id DCB395D6D0 for ; Fri, 15 Nov 2019 15:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573833146; 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=5rlolmP252gNHzIqRjsheMOf4OWTtSj8FS8J5MuOF/w=; b=Z5aZGbnZFqx9aGIvpEbODM/KewhEpOhhzCsKXoFIMZjuodbmy0jqZeYECgNXyDLPsLyavX eV6Xp+azjqkWCEguczhBAxqS2wFvviW4ZOnlVsvkTs7Ym8zMX6RjEn13bEYCmnBsD01pF9 IFeW8N4LXEwmj6yGSTwLrQiIBVgqPUk= From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 15 Nov 2019 16:51:51 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/6] qemu: command: Build the 'pflash' drives via -machine 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 X-MC-Unique: _1mbWi9NOj6eP2pFEtgRNQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The old way to instantiate a pflash device via -drive was a hack since it's a platform device. The modern approach calls for configuring it via -machine and takes the node name as an argument. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_command.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c1de2a398f..ca864eaa6b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7043,7 +7043,8 @@ static int qemuBuildMachineCommandLine(virCommandPtr cmd, virQEMUDriverConfigPtr cfg, const virDomainDef *def, - virQEMUCapsPtr qemuCaps) + virQEMUCapsPtr qemuCaps, + qemuDomainObjPrivatePtr priv) { virTristateSwitch vmport =3D def->features[VIR_DOMAIN_FEATURE_VMPORT]; virTristateSwitch smm =3D def->features[VIR_DOMAIN_FEATURE_SMM]; @@ -7343,6 +7344,13 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, if (def->sev) virBufferAddLit(&buf, ",memory-encryption=3Dsev0"); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (priv->pflash0) + virBufferAsprintf(&buf, ",pflash0=3D%s", priv->pflash0->nodefo= rmat); + if (priv->pflash1) + virBufferAsprintf(&buf, ",pflash1=3D%s", priv->pflash1->nodefo= rmat); + } + virCommandAddArgBuffer(cmd, &buf); return 0; @@ -10249,7 +10257,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, if (enableFips) virCommandAddArg(cmd, "-enable-fips"); - if (qemuBuildMachineCommandLine(cmd, cfg, def, qemuCaps) < 0) + if (qemuBuildMachineCommandLine(cmd, cfg, def, qemuCaps, priv) < 0) return NULL; qemuBuildTSEGCommandLine(cmd, def); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 13:27:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1573833148; cv=none; d=zoho.com; s=zohoarc; b=aLzvW3HBviX7Z8oCZtOK9GaY9EpPD66CjJlMmuJY7OtQfbLsESZg5r/7OwTRJvR3EUebzjgrsDq0hn6K33BuunrkXF2Y6oTKKIlPXlbJ605Vqt80xHvuO0Zl9G4SqwUZX53KzpAnxpQZCOD7kLRLfcpfI1mMKnlawOv8xceDnJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573833148; 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=hvubqi1RHBZ68uUXA4I8Y1I9no9b8TrfBWN6CWFwwZE=; b=Uzqy49Bds2hP9ZMN8/WIkd+eTRhl45diSRqyzy0BP7xhw5LQCbw06Yvcr0Lg99pg67zE7dJli97R3iYL7w0xYL99y9Eb6Nd354ezKbGGP4g3ztl+MGYOAz0RQFhcx6CqUMx6yIpai7bA3bK4Xaab8n6ArDldi5ROr6lvdsZyjmc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1573833148119377.82428283208094; Fri, 15 Nov 2019 07:52:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-274-TGOsWXXbPhanHZ9ulSoMEA-1; Fri, 15 Nov 2019 10:52:25 -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 70F511005512; Fri, 15 Nov 2019 15:52:19 +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 4C22975E45; Fri, 15 Nov 2019 15:52:19 +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 0A4724E566; Fri, 15 Nov 2019 15:52:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAFFq13H007045 for ; Fri, 15 Nov 2019 10:52:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id 29BDA1DA; Fri, 15 Nov 2019 15:52:01 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id A96635D6D0 for ; Fri, 15 Nov 2019 15:52:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573833147; 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=hvubqi1RHBZ68uUXA4I8Y1I9no9b8TrfBWN6CWFwwZE=; b=djLJTNgog62Ojopun4zNZ8EqIIkHvcrUBHImikrEtbnQvCR+CwkLXkZZ9ocXu9o/m6H9o+ gQr5c/RuC4UikEiHPhujNyZCkRxPebVMsrFTA175mJLBsN0in9AfNEI+D2OMCMPvsFEZCy ctEueaspjMI3RUd/oUXek4JmVH4Nb7c= From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 15 Nov 2019 16:51:52 +0100 Message-Id: <5b8f803bf08b9a7833253d3f7b5685f6e94162eb.1573832995.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/6] qemu: Instantiate pflash via -machine when using blockdev 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 X-MC-Unique: TGOsWXXbPhanHZ9ulSoMEA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Install the convertor function which enables the internals that will use -blockdev to make qemu open the firmware image and stop using -drive. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_command.c | 14 ++++++++++---- src/qemu/qemu_process.c | 6 ++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ca864eaa6b..43e76a4e5c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9425,7 +9425,8 @@ qemuBuildRedirdevCommandLine(virLogManagerPtr logMana= ger, static void qemuBuldDomainLoaderPflashCommandLine(virCommandPtr cmd, - virDomainLoaderDefPtr loader) + virDomainLoaderDefPtr loader, + virQEMUCapsPtr qemuCaps) { g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; int unit =3D 0; @@ -9437,6 +9438,10 @@ qemuBuldDomainLoaderPflashCommandLine(virCommandPtr = cmd, NULL); } + /* with blockdev we instantiate the pflash when formatting -machine */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) + return; + virBufferAddLit(&buf, "file=3D"); virQEMUBuildBufferEscapeComma(&buf, loader->path); virBufferAsprintf(&buf, ",if=3Dpflash,format=3Draw,unit=3D%d", unit); @@ -9464,7 +9469,8 @@ qemuBuldDomainLoaderPflashCommandLine(virCommandPtr c= md, static void qemuBuildDomainLoaderCommandLine(virCommandPtr cmd, - virDomainDefPtr def) + virDomainDefPtr def, + virQEMUCapsPtr qemuCaps) { virDomainLoaderDefPtr loader =3D def->os.loader; @@ -9478,7 +9484,7 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd, break; case VIR_DOMAIN_LOADER_TYPE_PFLASH: - qemuBuldDomainLoaderPflashCommandLine(cmd, loader); + qemuBuldDomainLoaderPflashCommandLine(cmd, loader, qemuCaps); break; case VIR_DOMAIN_LOADER_TYPE_NONE: @@ -10265,7 +10271,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, if (qemuBuildCpuCommandLine(cmd, driver, def, qemuCaps) < 0) return NULL; - qemuBuildDomainLoaderCommandLine(cmd, def); + qemuBuildDomainLoaderCommandLine(cmd, def, qemuCaps); if (!migrateURI && !snapshot && qemuDomainAlignMemorySizes(def) < 0) return NULL; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 246934c634..2743af60a0 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6293,6 +6293,8 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver, VIR_DEBUG("Prepare bios/uefi paths"); if (qemuFirmwareFillDomain(driver, vm, flags) < 0) goto cleanup; + if (qemuDomainInitializePflashStorageSource(vm) < 0) + goto cleanup; VIR_DEBUG("Preparing external devices"); if (qemuExtDevicesPrepareDomain(driver, vm) < 0) @@ -8024,6 +8026,10 @@ qemuProcessReconnect(void *opaque) if (qemuDomainPerfRestart(obj) < 0) goto error; + /* recreate the pflash storage sources */ + if (qemuDomainInitializePflashStorageSource(obj) < 0) + goto error; + /* XXX: Need to change as long as lock is introduced for * qemu_driver->sharedDevices. */ --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list