]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Release <memory/> device address on failed hotplug
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 8 Feb 2021 14:21:16 +0000 (15:21 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 8 Feb 2021 19:05:08 +0000 (20:05 +0100)
commitf8f7bc254f3233ee15692fa0dd951cfbe2e59bf2
tree27bee5252c566483d4699a6613e470404f7fce27
parentb1e6324ca272acd69573571fcb5184b1ac417d1d
qemu: Release <memory/> device address on failed hotplug

A few commits back I've introduced new 'virtio-pmem' <memory/>
device. Since it's virtio it goes onto PCI bus. Therefore, on
hotplug new PCI address is generated (or provided one is
reserved). However, if hotplug fails (for whatever reason) the
address needs to be released. This is different to 'dimm' type of
address because for that type we don't keep a map of used slots
rather generate one on each address assign request. The map is
then thrown away. But for PCI addresses we keep internal state
and thus has to keep it updated. Therefore, this new
qemuDomainReleaseMemoryDeviceSlot() function is NOP for those
models which use 'dimm' address type ('dimm' and 'nvdimm').

While I'm at it, let's release the address in case of hot unplug.
Not that is supported (any such attempt fails with the following
error:

  "virtio based memory devices cannot be unplugged"

But if QEMU ever implements hot unplug then we don't have to
remember to fix our code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/qemu/qemu_domain_address.c
src/qemu/qemu_domain_address.h
src/qemu/qemu_hotplug.c