mirror of https://gitee.com/openkylin/libvirt.git
qemu: command: Extract formatting of -drive for pflash
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> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c78fadb57c
commit
316223b6ad
|
@ -9416,24 +9416,12 @@ qemuBuildRedirdevCommandLine(virLogManagerPtr logManager,
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
|
qemuBuldDomainLoaderPflashCommandLine(virCommandPtr cmd,
|
||||||
virDomainDefPtr def)
|
virDomainLoaderDefPtr loader)
|
||||||
{
|
{
|
||||||
virDomainLoaderDefPtr loader = def->os.loader;
|
|
||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
int unit = 0;
|
int unit = 0;
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||
if (loader->secure == VIR_TRISTATE_BOOL_YES) {
|
if (loader->secure == VIR_TRISTATE_BOOL_YES) {
|
||||||
virCommandAddArgList(cmd,
|
virCommandAddArgList(cmd,
|
||||||
"-global",
|
"-global",
|
||||||
|
@ -9463,6 +9451,26 @@ qemuBuildDomainLoaderCommandLine(virCommandPtr cmd,
|
||||||
virCommandAddArg(cmd, "-drive");
|
virCommandAddArg(cmd, "-drive");
|
||||||
virCommandAddArgBuffer(cmd, &buf);
|
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;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_LOADER_TYPE_NONE:
|
case VIR_DOMAIN_LOADER_TYPE_NONE:
|
||||||
|
|
Loading…
Reference in New Issue