mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-06 17:17:56 +03:00
qemu: Fill virtio-mem/virtio-pmem .memaddr at runtime
After a QEMU domain is started, among other thing we query memory device information. And while memory address is returned by QEMU for all models, we store it only for DIMMs and NVDIMMs. Do store it for VIRTIO_MEM and VIRTIO_PMEM too. This effectively reports the address the virtio-mem/virtio-pmem is mapped to in live XML. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
677156f662
commit
2c15506254
@ -8544,7 +8544,11 @@ qemuDomainUpdateMemoryDeviceInfo(virDomainObj *vm,
|
||||
|
||||
switch (mem->model) {
|
||||
case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM:
|
||||
mem->currentsize = VIR_DIV_UP(dimm->size, 1024);
|
||||
case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM:
|
||||
if (mem->model == VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM) {
|
||||
mem->currentsize = VIR_DIV_UP(dimm->size, 1024);
|
||||
}
|
||||
mem->address = dimm->address;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_MEMORY_MODEL_DIMM:
|
||||
@ -8554,7 +8558,6 @@ qemuDomainUpdateMemoryDeviceInfo(virDomainObj *vm,
|
||||
mem->info.addr.dimm.base = dimm->address;
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM:
|
||||
case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
|
||||
case VIR_DOMAIN_MEMORY_MODEL_NONE:
|
||||
case VIR_DOMAIN_MEMORY_MODEL_LAST:
|
||||
|
@ -7268,6 +7268,7 @@ qemuMonitorJSONGetMemoryDeviceInfo(qemuMonitor *mon,
|
||||
case VIR_DOMAIN_MEMORY_MODEL_DIMM:
|
||||
case VIR_DOMAIN_MEMORY_MODEL_NVDIMM:
|
||||
case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM:
|
||||
case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM:
|
||||
/* While 'id' attribute is marked as optional in QEMU's QAPI
|
||||
* specification, Libvirt always sets it. Thus we can fail if not
|
||||
* present. */
|
||||
@ -7308,13 +7309,21 @@ qemuMonitorJSONGetMemoryDeviceInfo(qemuMonitor *mon,
|
||||
return -1;
|
||||
|
||||
}
|
||||
} else if (model == VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM) {
|
||||
} else if (model == VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM ||
|
||||
model == VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM) {
|
||||
if (virJSONValueObjectGetNumberUlong(dimminfo, "size",
|
||||
&meminfo->size) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("malformed/missing size in virtio memory info"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virJSONValueObjectGetNumberUlong(dimminfo, "memaddr",
|
||||
&meminfo->address) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("malformed/missing memaddr in virtio memory info"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@ -7339,7 +7348,6 @@ qemuMonitorJSONGetMemoryDeviceInfo(qemuMonitor *mon,
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM:
|
||||
case VIR_DOMAIN_MEMORY_MODEL_NONE:
|
||||
case VIR_DOMAIN_MEMORY_MODEL_LAST:
|
||||
/* type not handled yet */
|
||||
|
Loading…
Reference in New Issue
Block a user