From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <f.ebner@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 0F7447298D
 for <pve-devel@lists.proxmox.com>; Wed, 26 May 2021 09:46:13 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 0460BD464
 for <pve-devel@lists.proxmox.com>; Wed, 26 May 2021 09:46:13 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 16FAED455
 for <pve-devel@lists.proxmox.com>; Wed, 26 May 2021 09:46:12 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id DE9BB4295B
 for <pve-devel@lists.proxmox.com>; Wed, 26 May 2021 09:46:11 +0200 (CEST)
To: pve-devel@lists.proxmox.com, l.stechauner@proxmox.com
References: <20210525132717.108343-1-l.stechauner@proxmox.com>
From: Fabian Ebner <f.ebner@proxmox.com>
Message-ID: <401e9c7d-d69a-7827-1aa3-1147aa31122f@proxmox.com>
Date: Wed, 26 May 2021 09:46:02 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.10.0
MIME-Version: 1.0
In-Reply-To: <20210525132717.108343-1-l.stechauner@proxmox.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.002 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -0.001 Looks like a legit reply (A)
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pve-devel] [PATCH manager] fix #3440: influxdb: remove
 duplicate vmid tag
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 26 May 2021 07:46:13 -0000

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@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);
>   }
>   
>