[libvirt] [PATCH 0/6] qemu: Use -blockdev for pflash (blockdev-add saga)

To avoid using -drive as much as possible convert PFLASH to use -blockdev as well. Since -blockdev is not enabled yet use the following qemu namespace XML override to enable it for testing: <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'> ... <qemu:capabilities> <qemu:add capability='blockdev'/> </qemu:capabilities> </domain> Peter Krempa (6): qemu: command: Extract formatting of -drive for pflash qemu: domain: Store virStorageSources representing pflash backing qemu: domain: Introduce helper to convert <loader> into virStorageSource qemu: command: Build -blockdev-s for backing of pflash qemu: command: Build the 'pflash' drives via -machine qemu: Instantiate pflash via -machine when using blockdev src/qemu/qemu_command.c | 136 ++++++++++++++++++++++++++++++---------- src/qemu/qemu_domain.c | 63 +++++++++++++++++++ src/qemu/qemu_domain.h | 9 +++ src/qemu/qemu_process.c | 6 ++ 4 files changed, 180 insertions(+), 34 deletions(-) -- 2.23.0

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 <pkrempa@redhat.com> --- 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 logManager, static void -qemuBuildDomainLoaderCommandLine(virCommandPtr cmd, - virDomainDefPtr def) +qemuBuldDomainLoaderPflashCommandLine(virCommandPtr cmd, + virDomainLoaderDefPtr loader) { - virDomainLoaderDefPtr loader = def->os.loader; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; int unit = 0; - if (!loader) - return; + if (loader->secure == VIR_TRISTATE_BOOL_YES) { + virCommandAddArgList(cmd, + "-global", + "driver=cfi.pflash01,property=secure,value=on", + NULL); + } - switch ((virDomainLoader) loader->type) { - case VIR_DOMAIN_LOADER_TYPE_ROM: - virCommandAddArg(cmd, "-bios"); - virCommandAddArg(cmd, loader->path); - break; + virBufferAddLit(&buf, "file="); + virQEMUBuildBufferEscapeComma(&buf, loader->path); + virBufferAsprintf(&buf, ",if=pflash,format=raw,unit=%d", unit); + unit++; - case VIR_DOMAIN_LOADER_TYPE_PFLASH: + if (loader->readonly) { + virBufferAsprintf(&buf, ",readonly=%s", + virTristateSwitchTypeToString(loader->readonly)); + } - if (loader->secure == VIR_TRISTATE_BOOL_YES) { - virCommandAddArgList(cmd, - "-global", - "driver=cfi.pflash01,property=secure,value=on", - NULL); - } + virCommandAddArg(cmd, "-drive"); + virCommandAddArgBuffer(cmd, &buf); + if (loader->nvram) { + virBufferFreeAndReset(&buf); virBufferAddLit(&buf, "file="); - virQEMUBuildBufferEscapeComma(&buf, loader->path); + virQEMUBuildBufferEscapeComma(&buf, loader->nvram); virBufferAsprintf(&buf, ",if=pflash,format=raw,unit=%d", unit); - unit++; - - if (loader->readonly) { - virBufferAsprintf(&buf, ",readonly=%s", - virTristateSwitchTypeToString(loader->readonly)); - } virCommandAddArg(cmd, "-drive"); virCommandAddArgBuffer(cmd, &buf); + } +} - if (loader->nvram) { - virBufferFreeAndReset(&buf); - virBufferAddLit(&buf, "file="); - virQEMUBuildBufferEscapeComma(&buf, loader->nvram); - virBufferAsprintf(&buf, ",if=pflash,format=raw,unit=%d", unit); - virCommandAddArg(cmd, "-drive"); - virCommandAddArgBuffer(cmd, &buf); - } +static void +qemuBuildDomainLoaderCommandLine(virCommandPtr cmd, + virDomainDefPtr def) +{ + virDomainLoaderDefPtr loader = 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: -- 2.23.0

On Fri, Nov 15, 2019 at 04:51:47PM +0100, Peter Krempa wrote:
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 <pkrempa@redhat.com> --- src/qemu/qemu_command.c | 72 +++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 32 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

On Fri, Nov 15, 2019 at 04:51:47PM +0100, Peter Krempa wrote:
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 <pkrempa@redhat.com> --- src/qemu/qemu_command.c | 72 +++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 32 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

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 <pkrempa@redhat.com> --- 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(qemuDomainObjPrivatePtr priv) virHashRemoveAll(priv->blockjobs); virHashRemoveAll(priv->dbusVMStates); + + virObjectUnref(priv->pflash0); + priv->pflash0 = NULL; + virObjectUnref(priv->pflash1); + priv->pflash1 = 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, these + * pointers hold the temporary virStorageSources for creating the -blockdev + * commandline for pflash drives. */ + virStorageSourcePtr pflash0; + virStorageSourcePtr pflash1; }; #define QEMU_DOMAIN_PRIVATE(vm) \ -- 2.23.0

On Fri, Nov 15, 2019 at 04:51:48PM +0100, Peter Krempa wrote:
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 <pkrempa@redhat.com> --- src/qemu/qemu_domain.c | 5 +++++ src/qemu/qemu_domain.h | 6 ++++++ 2 files changed, 11 insertions(+)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

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 <pkrempa@redhat.com> --- 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(virDomainObjPtr 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 present. + * + * 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 = vm->privateData; + virDomainDefPtr def = vm->def; + g_autoptr(virStorageSource) pflash0 = NULL; + g_autoptr(virStorageSource) pflash1 = NULL; + + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) + return 0; + + if (!def->os.loader || + def->os.loader->type != VIR_DOMAIN_LOADER_TYPE_PFLASH) + return 0; + + if (!(pflash0 = virStorageSourceNew())) + return -1; + + pflash0->type = VIR_STORAGE_TYPE_FILE; + pflash0->format = VIR_STORAGE_FILE_RAW; + pflash0->path = g_strdup(def->os.loader->path); + pflash0->readonly = def->os.loader->readonly; + pflash0->nodeformat = g_strdup("libvirt-pflash0-format"); + pflash0->nodestorage = g_strdup("libvirt-pflash0-storage"); + + + if (def->os.loader->nvram) { + if (!(pflash1 = virStorageSourceNew())) + return -1; + + pflash1->type = VIR_STORAGE_TYPE_FILE; + pflash1->format = VIR_STORAGE_FILE_RAW; + pflash1->path = g_strdup(def->os.loader->nvram); + pflash1->readonly = false; + pflash1->nodeformat = g_strdup("libvirt-pflash1-format"); + pflash1->nodestorage = g_strdup("libvirt-pflash1-storage"); + } + + priv->pflash0 = g_steal_pointer(&pflash0); + priv->pflash1 = 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(virDomainObjPtr vm) int qemuDomainMakeCPUMigratable(virCPUDefPtr cpu); + +int +qemuDomainInitializePflashStorageSource(virDomainObjPtr vm); -- 2.23.0

On Fri, Nov 15, 2019 at 04:51:49PM +0100, Peter Krempa wrote:
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 <pkrempa@redhat.com> --- src/qemu/qemu_domain.c | 58 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 3 +++ 2 files changed, 61 insertions(+)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

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 <pkrempa@redhat.com> --- 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 = NULL; + size_t i; + + if (!(data = qemuBuildStorageSourceChainAttachPrepareBlockdev(src, + qemuCaps))) + return -1; + + for (i = 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"); -- 2.23.0

On Fri, Nov 15, 2019 at 04:51:50PM +0100, Peter Krempa wrote:
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 <pkrempa@redhat.com> --- src/qemu/qemu_command.c | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
+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; + }
These could have been done as single if()s but that's nitpicking & I don't strongly care, so regardless of whether you change it or not Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

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 <pkrempa@redhat.com> --- 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 = def->features[VIR_DOMAIN_FEATURE_VMPORT]; virTristateSwitch smm = def->features[VIR_DOMAIN_FEATURE_SMM]; @@ -7343,6 +7344,13 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, if (def->sev) virBufferAddLit(&buf, ",memory-encryption=sev0"); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (priv->pflash0) + virBufferAsprintf(&buf, ",pflash0=%s", priv->pflash0->nodeformat); + if (priv->pflash1) + virBufferAsprintf(&buf, ",pflash1=%s", priv->pflash1->nodeformat); + } + 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); -- 2.23.0

On Fri, Nov 15, 2019 at 04:51:51PM +0100, Peter Krempa wrote:
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 <pkrempa@redhat.com> --- src/qemu/qemu_command.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

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 <pkrempa@redhat.com> --- 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 logManager, static void qemuBuldDomainLoaderPflashCommandLine(virCommandPtr cmd, - virDomainLoaderDefPtr loader) + virDomainLoaderDefPtr loader, + virQEMUCapsPtr qemuCaps) { g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; int unit = 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="); virQEMUBuildBufferEscapeComma(&buf, loader->path); virBufferAsprintf(&buf, ",if=pflash,format=raw,unit=%d", unit); @@ -9464,7 +9469,8 @@ qemuBuldDomainLoaderPflashCommandLine(virCommandPtr cmd, static void qemuBuildDomainLoaderCommandLine(virCommandPtr cmd, - virDomainDefPtr def) + virDomainDefPtr def, + virQEMUCapsPtr qemuCaps) { virDomainLoaderDefPtr loader = 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. */ -- 2.23.0

On Fri, Nov 15, 2019 at 04:51:52PM +0100, Peter Krempa wrote:
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 <pkrempa@redhat.com> --- src/qemu/qemu_command.c | 14 ++++++++++---- src/qemu/qemu_process.c | 6 ++++++ 2 files changed, 16 insertions(+), 4 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Fri, Nov 15, 2019 at 04:51:46PM +0100, Peter Krempa wrote:
To avoid using -drive as much as possible convert PFLASH to use -blockdev as well.
Since -blockdev is not enabled yet use the following qemu namespace XML override to enable it for testing:
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'> ... <qemu:capabilities> <qemu:add capability='blockdev'/> </qemu:capabilities> </domain>
Peter Krempa (6): qemu: command: Extract formatting of -drive for pflash qemu: domain: Store virStorageSources representing pflash backing qemu: domain: Introduce helper to convert <loader> into virStorageSource qemu: command: Build -blockdev-s for backing of pflash qemu: command: Build the 'pflash' drives via -machine qemu: Instantiate pflash via -machine when using blockdev
src/qemu/qemu_command.c | 136 ++++++++++++++++++++++++++++++---------- src/qemu/qemu_domain.c | 63 +++++++++++++++++++ src/qemu/qemu_domain.h | 9 +++ src/qemu/qemu_process.c | 6 ++ 4 files changed, 180 insertions(+), 34 deletions(-)
There ought to be a file added to qemuxml2argvtest to validate the new -blockdev syntax for pflash. Maybe you have it further down in your queue of pending blockdev patches ? If not just send a followup to add a test, no need to repost this whole series. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Thu, Nov 21, 2019 at 06:14:01PM +0000, Daniel P. Berrangé wrote:
On Fri, Nov 15, 2019 at 04:51:46PM +0100, Peter Krempa wrote:
To avoid using -drive as much as possible convert PFLASH to use -blockdev as well.
Since -blockdev is not enabled yet use the following qemu namespace XML override to enable it for testing:
<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'> ... <qemu:capabilities> <qemu:add capability='blockdev'/> </qemu:capabilities> </domain>
Peter Krempa (6): qemu: command: Extract formatting of -drive for pflash qemu: domain: Store virStorageSources representing pflash backing qemu: domain: Introduce helper to convert <loader> into virStorageSource qemu: command: Build -blockdev-s for backing of pflash qemu: command: Build the 'pflash' drives via -machine qemu: Instantiate pflash via -machine when using blockdev
src/qemu/qemu_command.c | 136 ++++++++++++++++++++++++++++++---------- src/qemu/qemu_domain.c | 63 +++++++++++++++++++ src/qemu/qemu_domain.h | 9 +++ src/qemu/qemu_process.c | 6 ++ 4 files changed, 180 insertions(+), 34 deletions(-)
There ought to be a file added to qemuxml2argvtest to validate the new -blockdev syntax for pflash. Maybe you have it further down in your queue of pending blockdev patches ? If not just send a followup to add a test, no need to repost this whole series.
I've finally come to the patch in the blockdev series which adds testing coverage for pflash with -blockdev. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (3)
-
Daniel P. Berrangé
-
Ján Tomko
-
Peter Krempa