Bug 1624009

Summary: allow backing of pflash via -blockdev
Product: Red Hat Enterprise Linux 7 Reporter: Peter Krempa <pkrempa>
Component: qemu-kvm-rhevAssignee: Markus Armbruster <armbru>
Status: CLOSED ERRATA QA Contact: CongLi <coli>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 7.5CC: chayang, coli, jsuchane, juzhang, kchamart, kwolf, lersek, meili, mtessun, ngu, virt-maint
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.12.0-29.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1686552 1717155 (view as bug list) Environment:
Last Closed: 2019-08-22 09:18:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1436245, 1605127, 1686552, 1717155    

Description Peter Krempa 2018-08-30 16:24:27 UTC
Description of problem:
The 'pflash' device is instantiated by definig the -drive which is backing it. To allow snapshotting it along with the disks it would be beneficial to allow using -blockdev for it so that the same code can be reused.

Comment 2 Markus Armbruster 2018-09-26 09:03:48 UTC
We configure pflash devices with -drive if=pflash,...  Peter is looking for a way to configure them with -blockdev and -device.  I'll look into it.

Comment 3 Markus Armbruster 2019-03-13 13:26:31 UTC
Upstream merge commit eda1df0345f5a1e337e30367124dcb0e802bdfde provides -machine properties pflash0 and pflash1.  Use like this:

-blockdev node-name=pflash0,driver=file,read-only=on,filename=OVMF_CODE.fd \
-blockdev node-name=pflash1,driver=raw,filename=OVMF_VARS.fd \
-machine pflash0=pflash0,pflash1=pflash1

Comment 4 Markus Armbruster 2019-03-20 16:27:38 UTC
Fixed in upstream merge commit eda1df0345f5a1e337e30367124dcb0e802bdfde, will be in QEMU v4.0.

The fix supersedes the old way of configuring OVMF

    -drive if=pflash,format=raw,unit=0,readonly,file=/usr/share/edk2/ovmf/OVMF_CODE.fd \
    -drive if=pflash,format=raw,unit=1,file=copy-of-OVMF_VARS.fd

by

    -blockdev node-name=pflash0,driver=file,read-only=on,filename=/usr/share/edk2/ovmf/OVMF_CODE.fd \
    -blockdev node-name=pflash1,driver=file,filename=copy-of-OVMF_VARS.fd \
    -machine pflash0=pflash0,pflash1=pflash1

Backport has quite a few patches, but most of them apply cleanly or with only trivial conflicts.

Comment 8 Miroslav Rezanina 2019-05-17 15:47:13 UTC
Fix included in qemu-kvm-rhev-2.12.0-29.el7

Comment 10 CongLi 2019-05-20 10:14:46 UTC
Verified on qemu-kvm-rhev-2.12.0-29.el7.x86_64.    

pflash works well with blockdev.
-blockdev node-name=pflash0,read-only=on,driver=file,filename=/usr/share/OVMF/OVMF_CODE.secboot.fd \
-blockdev node-name=pflash1,driver=file,filename=/home/kvm_autotest_root/images/rhel77-64-virtio-scsi.qcow2.fd \
-machine pflash0=pflash0,pflash1=pflash1  \

Comment 12 errata-xmlrpc 2019-08-22 09:18:48 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:2553