qemu_command: Generate mem-reserve for controllers

Pretty straightforward. Just put mem-reserve attribute whenever
it's set. Previous commit ensures it's set only for valid
controller models.

Resolves: https://issues.redhat.com/browse/RHEL-7461
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Michal Privoznik 2023-09-11 15:59:53 +02:00
parent 772e33487a
commit c38720b337
2 changed files with 4 additions and 1 deletions

View File

@ -2776,6 +2776,7 @@ qemuBuildControllerPCIDevProps(virDomainControllerDef *def,
if (virJSONValueObjectAdd(&props, if (virJSONValueObjectAdd(&props,
"s:driver", modelName, "s:driver", modelName,
"i:chassis_nr", pciopts->chassisNr, "i:chassis_nr", pciopts->chassisNr,
"P:mem-reserve", pciopts->memReserve * 1024,
"s:id", def->info.alias, "s:id", def->info.alias,
NULL) < 0) NULL) < 0)
return -1; return -1;
@ -2816,6 +2817,7 @@ qemuBuildControllerPCIDevProps(virDomainControllerDef *def,
"i:chassis", pciopts->chassis, "i:chassis", pciopts->chassis,
"s:id", def->info.alias, "s:id", def->info.alias,
"T:hotplug", pciopts->hotplug, "T:hotplug", pciopts->hotplug,
"P:mem-reserve", pciopts->memReserve * 1024,
NULL) < 0) NULL) < 0)
return -1; return -1;
@ -2824,6 +2826,7 @@ qemuBuildControllerPCIDevProps(virDomainControllerDef *def,
if (virJSONValueObjectAdd(&props, if (virJSONValueObjectAdd(&props,
"s:driver", modelName, "s:driver", modelName,
"i:index", pciopts->targetIndex, "i:index", pciopts->targetIndex,
"P:mem-reserve", pciopts->memReserve * 1024,
"s:id", def->info.alias, "s:id", def->info.alias,
NULL) < 0) NULL) < 0)
return -1; return -1;

View File

@ -27,7 +27,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-q35-test/.config \
-no-shutdown \ -no-shutdown \
-boot strict=on \ -boot strict=on \
-device '{"driver":"i82801b11-bridge","id":"pci.1","bus":"pcie.0","addr":"0x1e"}' \ -device '{"driver":"i82801b11-bridge","id":"pci.1","bus":"pcie.0","addr":"0x1e"}' \
-device '{"driver":"pci-bridge","chassis_nr":56,"id":"pci.2","bus":"pci.1","addr":"0x0"}' \ -device '{"driver":"pci-bridge","chassis_nr":56,"mem-reserve":8392704,"id":"pci.2","bus":"pci.1","addr":"0x0"}' \
-device '{"driver":"ich9-usb-ehci1","id":"usb","bus":"pcie.0","addr":"0x1d.0x7"}' \ -device '{"driver":"ich9-usb-ehci1","id":"usb","bus":"pcie.0","addr":"0x1d.0x7"}' \
-device '{"driver":"ich9-usb-uhci1","masterbus":"usb.0","firstport":0,"bus":"pcie.0","multifunction":true,"addr":"0x1d"}' \ -device '{"driver":"ich9-usb-uhci1","masterbus":"usb.0","firstport":0,"bus":"pcie.0","multifunction":true,"addr":"0x1d"}' \
-device '{"driver":"ich9-usb-uhci2","masterbus":"usb.0","firstport":2,"bus":"pcie.0","addr":"0x1d.0x1"}' \ -device '{"driver":"ich9-usb-uhci2","masterbus":"usb.0","firstport":2,"bus":"pcie.0","addr":"0x1d.0x1"}' \