[pve-devel] [PATCH manager] fix #3440: influxdb: remove duplicate vmid tag

Fabian Ebner f.ebner at proxmox.com
Wed May 26 09:46:02 CEST 2021


Am 25.05.21 um 15:27 schrieb Lorenz Stechauner:
> remove vmid from data part, it is already contained in object part.
> 
> Signed-off-by: Lorenz Stechauner <l.stechauner at proxmox.com>
> ---
> Tested with local udp listener. works as expected.
> 
>   PVE/Status/InfluxDB.pm | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/PVE/Status/InfluxDB.pm b/PVE/Status/InfluxDB.pm
> index 9e4b0d96..c50aa9c8 100644
> --- a/PVE/Status/InfluxDB.pm
> +++ b/PVE/Status/InfluxDB.pm
> @@ -94,6 +94,8 @@ sub update_qemu_status {
>       }
>       $object =~ s/\s/\\ /g;
>   
> +    # Duplicate keys may result in unwanted behavior
> +    delete $data->{vmid};

Note that this modifies $data for the caller as well, because it's a 
hash reference. Might not be a problem here (didn't check), but such 
things can lead to subtle (future) errors, so maybe there's a better 
alternative?

>       build_influxdb_payload($class, $txn, $data, $ctime, $object);
>   }
>   
> @@ -108,6 +110,8 @@ sub update_lxc_status {
>       }
>       $object =~ s/\s/\\ /g;
>   
> +    # Duplicate keys may result in unwanted behavior
> +    delete $data->{vmid};
>       build_influxdb_payload($class, $txn, $data, $ctime, $object);
>   }
>   
> 





More information about the pve-devel mailing list