mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemuBuildFloppyCommandLineControllerOptionsExplicit: Generate via JSON
QEMU declares the bootindex types as: bootindexA=<int32> bootindexB=<int32> The driveA/driveB parameters were deprecated and removed in qemu-6.0. We'll keep them for compatibility, but they are not used with -blockdev. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
245e8a12fd
commit
926864ba45
@ -2183,32 +2183,29 @@ qemuBuildFloppyCommandLineControllerOptionsImplicit(virCommand *cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static int
|
||||||
qemuBuildFloppyCommandLineControllerOptionsExplicit(virCommand *cmd,
|
qemuBuildFloppyCommandLineControllerOptionsExplicit(virCommand *cmd,
|
||||||
unsigned int bootindexA,
|
unsigned int bootindexA,
|
||||||
unsigned int bootindexB,
|
unsigned int bootindexB,
|
||||||
const char *backendA,
|
const char *backendA,
|
||||||
const char *backendB)
|
const char *backendB,
|
||||||
|
virQEMUCaps *qemuCaps)
|
||||||
{
|
{
|
||||||
g_auto(virBuffer) fdc_opts = VIR_BUFFER_INITIALIZER;
|
g_autoptr(virJSONValue) props = NULL;
|
||||||
|
|
||||||
virBufferAddLit(&fdc_opts, "isa-fdc,");
|
if (virJSONValueObjectCreate(&props,
|
||||||
|
"s:driver", "isa-fdc",
|
||||||
|
"S:driveA", backendA,
|
||||||
|
"p:bootindexA", bootindexA,
|
||||||
|
"S:driveB", backendB,
|
||||||
|
"p:bootindexB", bootindexB,
|
||||||
|
NULL) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (backendA)
|
if (qemuBuildDeviceCommandlineFromJSON(cmd, props, qemuCaps) < 0)
|
||||||
virBufferAsprintf(&fdc_opts, "driveA=%s,", backendA);
|
return -1;
|
||||||
|
|
||||||
if (bootindexA > 0)
|
return 0;
|
||||||
virBufferAsprintf(&fdc_opts, "bootindexA=%u,", bootindexA);
|
|
||||||
|
|
||||||
if (backendB)
|
|
||||||
virBufferAsprintf(&fdc_opts, "driveB=%s,", backendB);
|
|
||||||
|
|
||||||
if (bootindexB > 0)
|
|
||||||
virBufferAsprintf(&fdc_opts, "bootindexB=%u,", bootindexB);
|
|
||||||
|
|
||||||
virBufferTrim(&fdc_opts, ",");
|
|
||||||
virCommandAddArg(cmd, "-device");
|
|
||||||
virCommandAddArgBuffer(cmd, &fdc_opts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2251,11 +2248,13 @@ qemuBuildFloppyCommandLineControllerOptions(virCommand *cmd,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (qemuDomainNeedsFDC(def)) {
|
if (qemuDomainNeedsFDC(def)) {
|
||||||
qemuBuildFloppyCommandLineControllerOptionsExplicit(cmd,
|
if (qemuBuildFloppyCommandLineControllerOptionsExplicit(cmd,
|
||||||
bootindexA,
|
bootindexA,
|
||||||
bootindexB,
|
bootindexB,
|
||||||
backendA,
|
backendA,
|
||||||
backendB);
|
backendB,
|
||||||
|
qemuCaps) < 0)
|
||||||
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
qemuBuildFloppyCommandLineControllerOptionsImplicit(cmd,
|
qemuBuildFloppyCommandLineControllerOptionsImplicit(cmd,
|
||||||
bootindexA,
|
bootindexA,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user