mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
conf: Move hypervisor specific nhugepage checks
Commit 82327038 moved a couple of checks out of the XML parser into the domain validation; however, those checks seem to be more useful as hypervisor specific checks rather than the more general domain conf checks (nothing in the docs indicate a specific error). Fortunately only QEMU was processing the memoryBacking, thus add the changes to qemuDomainDefValidateMemory and change the code a bit to make usage of the similar deref to def->mem and the mem->nhugepages filter. Signed-off-by: John Ferlan <jferlan@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
972acbded1
commit
61d340a27d
@ -6187,23 +6187,6 @@ virDomainDefMemtuneValidate(const virDomainDef *def)
|
||||
size_t i;
|
||||
ssize_t pos = virDomainNumaGetNodeCount(def->numa) - 1;
|
||||
|
||||
if (mem->nhugepages == 0)
|
||||
return 0;
|
||||
|
||||
if (mem->allocation == VIR_DOMAIN_MEMORY_ALLOCATION_ONDEMAND) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("hugepages are not allowed with memory "
|
||||
"allocation ondemand"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mem->source == VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("hugepages are not allowed with anonymous "
|
||||
"memory source"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < mem->nhugepages; i++) {
|
||||
size_t j;
|
||||
ssize_t nextBit;
|
||||
|
@ -3953,18 +3953,35 @@ static int
|
||||
qemuDomainDefValidateMemory(const virDomainDef *def)
|
||||
{
|
||||
const long system_page_size = virGetSystemPageSizeKB();
|
||||
const virDomainMemtune *mem = &def->mem;
|
||||
|
||||
if (mem->nhugepages == 0)
|
||||
return 0;
|
||||
|
||||
if (mem->allocation == VIR_DOMAIN_MEMORY_ALLOCATION_ONDEMAND) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("hugepages are not allowed with memory "
|
||||
"allocation ondemand"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mem->source == VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("hugepages are not allowed with anonymous "
|
||||
"memory source"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* We can't guarantee any other mem.access
|
||||
* if no guest NUMA nodes are defined. */
|
||||
if (def->mem.nhugepages != 0 &&
|
||||
def->mem.hugepages[0].size != system_page_size &&
|
||||
if (mem->hugepages[0].size != system_page_size &&
|
||||
virDomainNumaGetNodeCount(def->numa) == 0 &&
|
||||
def->mem.access != VIR_DOMAIN_MEMORY_ACCESS_DEFAULT &&
|
||||
def->mem.access != VIR_DOMAIN_MEMORY_ACCESS_PRIVATE) {
|
||||
mem->access != VIR_DOMAIN_MEMORY_ACCESS_DEFAULT &&
|
||||
mem->access != VIR_DOMAIN_MEMORY_ACCESS_PRIVATE) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("memory access mode '%s' not supported "
|
||||
"without guest numa node"),
|
||||
virDomainMemoryAccessTypeToString(def->mem.access));
|
||||
virDomainMemoryAccessTypeToString(mem->access));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user