mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
Allow slices for block backed NVRAM
For NVRAM storage specifically, the guest-visible size is critical to correct handling of the OVMF address space. Allow specifying storage slices for NVRAM storage when the underlying block may be larger due to alignment/allocation restrictions. As qemuPrepareNVRAMBlock() does not support it, disallow slices with non-raw formats, and slice offsets. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
1 parent
3bca1ab993
commit
e5c111be7f
5 files changed
+131
-7
No files matched your search
@@ -707,8 +707,35 @@ qemuValidateDomainDefNvram(const virDomainDef *def,
|
||||
|
||||
switch (src->type) {
|
||||
case VIR_STORAGE_TYPE_FILE:
|
||||
case VIR_STORAGE_TYPE_BLOCK:
|
||||
case VIR_STORAGE_TYPE_NETWORK:
|
||||
if (src->sliceStorage) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("slices are not supported with non-block NVRAM"));
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_STORAGE_TYPE_BLOCK:
|
||||
if (src->sliceStorage) {
|
||||
if (src->sliceStorage->offset != 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("offset slices are not supported with NVRAM"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (src->format) {
|
||||
case VIR_STORAGE_FILE_RAW:
|
||||
case VIR_STORAGE_FILE_NONE:
|
||||
break;
|
||||
|
||||
default:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("NVRAM slices are not supported with format '%1$s'"),
|
||||
virStorageFileFormatTypeToString(src->format));
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_STORAGE_TYPE_DIR:
|
||||
@@ -728,12 +755,6 @@ qemuValidateDomainDefNvram(const virDomainDef *def,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (src->sliceStorage) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("slices are not supported with NVRAM"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (src->pr) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("persistent reservations are not supported with NVRAM"));
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
LC_ALL=C \
|
||||
PATH=/bin \
|
||||
HOME=/var/lib/libvirt/qemu/domain--1-guest \
|
||||
USER=test \
|
||||
LOGNAME=test \
|
||||
XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \
|
||||
XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \
|
||||
XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
|
||||
/usr/bin/qemu-system-x86_64 \
|
||||
-name guest=guest,debug-threads=on \
|
||||
-S \
|
||||
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \
|
||||
-blockdev '{"driver":"file","filename":"/usr/share/edk2/ovmf/OVMF_CODE.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}' \
|
||||
-blockdev '{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}' \
|
||||
-blockdev '{"driver":"host_device","filename":"/dev/lv/guest_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}' \
|
||||
-blockdev '{"driver":"raw","file":"libvirt-pflash1-storage","offset":0,"size":540672,"node-name":"libvirt-0-slice-sto","read-only":false}' \
|
||||
-machine pc-i440fx-10.0,usb=off,dump-guest-core=off,memory-backend=pc.ram,pflash0=libvirt-pflash0-format,pflash1=libvirt-0-slice-sto,acpi=on \
|
||||
-accel tcg \
|
||||
-cpu qemu64 \
|
||||
-m size=1048576k \
|
||||
-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
|
||||
-overcommit mem-lock=off \
|
||||
-smp 1,sockets=1,cores=1,threads=1 \
|
||||
-uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \
|
||||
-display none \
|
||||
-no-user-config \
|
||||
-nodefaults \
|
||||
-chardev socket,id=charmonitor,fd=@mon-fd@,server=on,wait=off \
|
||||
-object '{"qom-type":"monitor-qmp","id":"monitor","chardev":"charmonitor"}' \
|
||||
-rtc base=utc \
|
||||
-no-shutdown \
|
||||
-boot strict=on \
|
||||
-audiodev '{"id":"audio1","driver":"none"}' \
|
||||
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
|
||||
-msg timestamp=on
|
||||
@@ -0,0 +1,42 @@
|
||||
<domain type='qemu'>
|
||||
<name>guest</name>
|
||||
<uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid>
|
||||
<memory unit='KiB'>1048576</memory>
|
||||
<currentMemory unit='KiB'>1048576</currentMemory>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os firmware='efi'>
|
||||
<type arch='x86_64' machine='pc-i440fx-10.0'>hvm</type>
|
||||
<firmware>
|
||||
<feature enabled='no' name='enrolled-keys'/>
|
||||
<feature enabled='no' name='secure-boot'/>
|
||||
</firmware>
|
||||
<loader readonly='yes' type='pflash' format='raw'>/usr/share/edk2/ovmf/OVMF_CODE.fd</loader>
|
||||
<nvram template='/usr/share/edk2/ovmf/OVMF_VARS.fd' templateFormat='raw' type='block' format='raw'>
|
||||
<source dev='/dev/lv/guest_VARS.fd'>
|
||||
<slices>
|
||||
<slice type='storage' offset='0' size='540672'/>
|
||||
</slices>
|
||||
</source>
|
||||
</nvram>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
</features>
|
||||
<cpu mode='custom' match='exact' check='none'>
|
||||
<model fallback='forbid'>qemu64</model>
|
||||
</cpu>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<controller type='usb' index='0' model='none'/>
|
||||
<controller type='pci' index='0' model='pci-root'/>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
<input type='keyboard' bus='ps2'/>
|
||||
<audio id='1' type='none'/>
|
||||
<memballoon model='none'/>
|
||||
</devices>
|
||||
</domain>
|
||||
@@ -0,0 +1,25 @@
|
||||
<domain type='qemu'>
|
||||
<name>guest</name>
|
||||
<uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid>
|
||||
<memory unit='KiB'>1048576</memory>
|
||||
<vcpu placement='static'>1</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc-i440fx-10.0'>hvm</type>
|
||||
<loader readonly='yes' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.fd</loader>
|
||||
<nvram type='block'>
|
||||
<source dev='/dev/lv/guest_VARS.fd'>
|
||||
<slices>
|
||||
<slice type="storage" offset="0" size="540672"/>
|
||||
</slices>
|
||||
</source>
|
||||
</nvram>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
</features>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-x86_64</emulator>
|
||||
<controller type='usb' model='none'/>
|
||||
<memballoon model='none'/>
|
||||
</devices>
|
||||
</domain>
|
||||
@@ -1442,6 +1442,7 @@ mymain(void)
|
||||
DO_TEST_CAPS_LATEST("firmware-manual-efi-nvram-network-iscsi");
|
||||
DO_TEST_CAPS_LATEST("firmware-manual-efi-nvram-network-nbd");
|
||||
DO_TEST_CAPS_LATEST("firmware-manual-efi-nvram-file");
|
||||
DO_TEST_CAPS_LATEST("firmware-manual-efi-nvram-dev-slice");
|
||||
DO_TEST_CAPS_LATEST_PARSE_ERROR("firmware-manual-efi-nvram-stateless");
|
||||
|
||||
DO_TEST_CAPS_ARCH_LATEST_FULL("firmware-manual-efi-sev-snp", "x86_64",
|
||||
|
||||
Reference in new issue
Block a user