mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: command: Introduce JSON variant of qemuBuildRomProps
Add a JSON variant of the generator 'rom' properties. For convenience both the old and new are for now marked as unused, which will be removed once the conversion is complete. The formatted properties have following types according to QEMU. 'virtio-blk-pci' was used as an example: rombar=<uint32> - (default: 1) romfile=<str> Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
feaeab09ea
commit
ab92e9decb
@ -1133,7 +1133,47 @@ qemuBuildVirtioDevStr(virBuffer *buf,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static int G_GNUC_UNUSED
|
||||
qemuBuildRomProps(virJSONValue *props,
|
||||
virDomainDeviceInfo *info)
|
||||
{
|
||||
const char *romfile = NULL;
|
||||
int rombar = -1;
|
||||
|
||||
if (info->romenabled == VIR_TRISTATE_BOOL_ABSENT &&
|
||||
info->rombar == VIR_TRISTATE_SWITCH_ABSENT &&
|
||||
!info->romfile)
|
||||
return 0;
|
||||
|
||||
if (info->romenabled == VIR_TRISTATE_BOOL_NO) {
|
||||
romfile = "";
|
||||
} else {
|
||||
romfile = info->romfile;
|
||||
|
||||
switch (info->rombar) {
|
||||
case VIR_TRISTATE_SWITCH_OFF:
|
||||
rombar = 0;
|
||||
break;
|
||||
case VIR_TRISTATE_SWITCH_ON:
|
||||
rombar = 1;
|
||||
break;
|
||||
case VIR_TRISTATE_SWITCH_ABSENT:
|
||||
case VIR_TRISTATE_SWITCH_LAST:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (virJSONValueObjectAdd(props,
|
||||
"k:rombar", rombar,
|
||||
"S:romfile", romfile,
|
||||
NULL) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int G_GNUC_UNUSED
|
||||
qemuBuildRomStr(virBuffer *buf,
|
||||
virDomainDeviceInfo *info)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user