]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu_monitor: Switch to virDomainMemoryModel enum in qemuMonitorJSONGetMemoryDeviceInfo()
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 27 Feb 2023 09:58:27 +0000 (10:58 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 1 Mar 2023 12:40:40 +0000 (13:40 +0100)
commitf173f6a79c759b5d286940f5a58d43f38366ebae
treea3da7a9b384634c2894f9c59a75fb2be87381a82
parentb4851deb799c3e48cfb5e4c44f5560500e1ad6c7
qemu_monitor: Switch to virDomainMemoryModel enum in qemuMonitorJSONGetMemoryDeviceInfo()

When processing memory devices (as a reply from QEMU), a bunch of
STREQ()-s is used. Fortunately, the set of strings we process is
the same as virDomainMemoryModel enum. Therefore, we can use
virDomainMemoryModelTypeFromString() and then use integer
comparison (well, switch()). This has an upside: introducing a
new memory model lets us see what places need adjusting
immediately at compile time.

NB, this is in contrast with cmd line generator
(qemuBuildMemoryDeviceProps()), where more specific models are
generated (e.g. "pc-dimm", "virtio-mem-pci", etc.). But QEMU
reports back the parent model, instead of specific child
instance.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
src/qemu/qemu_monitor_json.c