mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: conf: Reject memory device if it would exceed configured max size
If the added memory device would exceed the maximum memory size, reject it. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1216046
This commit is contained in:
parent
ebe0bd5590
commit
406944e476
@ -21661,6 +21661,17 @@ virDomainDefCompatibleDevice(virDomainDefPtr def,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_MEMORY) {
|
||||
unsigned long long sz = dev->data.memory->size;
|
||||
|
||||
if ((virDomainDefGetMemoryActual(def) + sz) > def->mem.max_memory) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Attaching memory device with size '%llu' would "
|
||||
"exceed domain's maxMemory config"), sz);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user