提交 3972a25f 编写于 作者: J John Ferlan

conf: Add check/error for domain supports cold/hotplug

https://bugzilla.redhat.com/show_bug.cgi?id=1624336

Add a check during virDomainDefCompatibleDevice whether the
domain supports cold/hotplug of a memory module even though
this duplicates the qemuDomainDefValidateMemoryHotplug check.

Without this check, the cold/hot plug would fail on the
subsequent mem_memory check (since it's 0). Adding a check
for max_memory > 0 would allow the subsequent hotplug check
to fail, but would cause coldplug to fail with the somewhat
opaque message "no free memory device slot available".
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
ACKed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 4f0854e7
...@@ -28923,6 +28923,13 @@ virDomainDefCompatibleDevice(virDomainDefPtr def, ...@@ -28923,6 +28923,13 @@ virDomainDefCompatibleDevice(virDomainDefPtr def,
if (dev->type == VIR_DOMAIN_DEVICE_MEMORY) { if (dev->type == VIR_DOMAIN_DEVICE_MEMORY) {
unsigned long long sz = dev->data.memory->size; unsigned long long sz = dev->data.memory->size;
if (!virDomainDefHasMemoryHotplug(def)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("cannot use/hotplug a memory device when domain "
"'maxMemory' is not defined"));
return -1;
}
if ((virDomainDefGetMemoryTotal(def) + sz) > def->mem.max_memory) { if ((virDomainDefGetMemoryTotal(def) + sz) > def->mem.max_memory) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Attaching memory device with size '%llu' would " _("Attaching memory device with size '%llu' would "
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册