mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-08 22:15:21 +00:00
domain_conf.c: auto-align pSeries NVDIMM in virDomainMemoryDefPostParse()
The alignment for the pSeries NVDIMM does not depend on runtime constraints. This means that it can be done in device parse time, instead of runtime, allowing the domain XML to reflect what the auto-alignment would do when the domain starts. This brings consistency between the NVDIMM size reported by the domain XML and what the guest sees, without impacting existing guests that are using an unaligned size - they'll work as usual, but the domain XML will be updated with the actual size of the NVDIMM. Reviewed-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
ace5931553
commit
d3f3c2c97f
@ -5396,6 +5396,24 @@ virDomainVsockDefPostParse(virDomainVsockDefPtr vsock)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virDomainMemoryDefPostParse(virDomainMemoryDefPtr mem,
|
||||
const virDomainDef *def)
|
||||
{
|
||||
/* Although only the QEMU driver implements PPC64 support, this
|
||||
* code is related to the platform specification (PAPR), i.e. it
|
||||
* is hypervisor agnostic, and any future PPC64 hypervisor driver
|
||||
* will have the same restriction.
|
||||
*/
|
||||
if (ARCH_IS_PPC64(def->os.arch) &&
|
||||
mem->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM &&
|
||||
virDomainNVDimmAlignSizePseries(mem) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev,
|
||||
const virDomainDef *def,
|
||||
@ -5437,6 +5455,10 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev,
|
||||
ret = virDomainVsockDefPostParse(dev->data.vsock);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_MEMORY:
|
||||
ret = virDomainMemoryDefPostParse(dev->data.memory, def);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_LEASE:
|
||||
case VIR_DOMAIN_DEVICE_FS:
|
||||
case VIR_DOMAIN_DEVICE_INPUT:
|
||||
@ -5451,7 +5473,6 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev,
|
||||
case VIR_DOMAIN_DEVICE_SHMEM:
|
||||
case VIR_DOMAIN_DEVICE_TPM:
|
||||
case VIR_DOMAIN_DEVICE_PANIC:
|
||||
case VIR_DOMAIN_DEVICE_MEMORY:
|
||||
case VIR_DOMAIN_DEVICE_IOMMU:
|
||||
case VIR_DOMAIN_DEVICE_AUDIO:
|
||||
ret = 0;
|
||||
|
@ -38,7 +38,7 @@
|
||||
<path>/tmp/nvdimm</path>
|
||||
</source>
|
||||
<target>
|
||||
<size unit='KiB'>550000</size>
|
||||
<size unit='KiB'>524416</size>
|
||||
<node>0</node>
|
||||
<label>
|
||||
<size unit='KiB'>128</size>
|
||||
|
Loading…
Reference in New Issue
Block a user