mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: command: Build -blockdev-s for backing of pflash
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> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
11d13ad8cf
commit
7d2f942af9
@ -9884,6 +9884,47 @@ 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 &&
|
||||
qemuBuildPflashBlockdevOne(cmd, priv->pflash0, priv->qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
if (priv->pflash1 &&
|
||||
qemuBuildPflashBlockdevOne(cmd, priv->pflash1, priv->qemuCaps) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static virJSONValuePtr
|
||||
qemuBuildDBusVMStateInfoPropsInternal(const char *alias,
|
||||
const char *addr)
|
||||
@ -10200,6 +10241,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");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user