提交 7d2f942a 编写于 作者: P Peter Krempa

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: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 11d13ad8
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册