[pve-devel] applied: [PATCH v5 qemu-server 02/12] memory: don't use foreach_reversedimm for unplug
Fiona Ebner
f.ebner at proxmox.com
Fri Mar 17 14:39:04 CET 2023
Am 24.02.23 um 13:09 schrieb Alexandre Derumier:
> simple use dimm_list() returned by qemu
>
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
Thanks! Applied with this follow-up:
> memory: hotplug: sort by numerical ID rather than slot when unplugging
>
> While, usually, the slot should match the ID, it's not explicitly
> guaranteed and relies on QEMU internals. Using the numerical ID is
> more future-proof and more consistent with plugging, where no slot
> information (except the maximum limit) is relied upon.
>
> Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
> ---
> PVE/QemuServer/Memory.pm | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/PVE/QemuServer/Memory.pm b/PVE/QemuServer/Memory.pm
> index 0f4229c5..0601dd6c 100644
> --- a/PVE/QemuServer/Memory.pm
> +++ b/PVE/QemuServer/Memory.pm
> @@ -201,7 +201,7 @@ sub qemu_memory_hotplug {
> my $dimms = qemu_memdevices_list($vmid, 'dimm');
>
> my $current_size = $memory;
> - for my $name (sort { $dimms->{$b}->{slot} <=> $dimms->{$a}->{slot} } keys %$dimms) {
> + for my $name (sort { ($b =~ /^dimm(\d+)$/)[0] <=> ($a =~ /^dimm(\d+)$/)[0] } keys %$dimms) {
>
> my $dimm_size = $dimms->{$name}->{size} / 1024 / 1024;
>
More information about the pve-devel
mailing list