From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 0DE971FF15C for ; Fri, 17 Oct 2025 12:02:34 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D512B254AA; Fri, 17 Oct 2025 12:02:53 +0200 (CEST) Message-ID: <55218253-d4cf-4846-8d9f-9fc8610a094a@proxmox.com> Date: Fri, 17 Oct 2025 12:02:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Daniel Kral , Proxmox VE development discussion References: <20250930142021.366529-1-d.kral@proxmox.com> <20250930142021.366529-5-d.kral@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1760695367148 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.021 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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 ha-manager 1/9] implement static service stats cache X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Am 16.10.25 um 5:15 PM schrieb Daniel Kral: > On Thu Oct 16, 2025 at 1:12 PM CEST, Fiona Ebner wrote: >> Am 30.09.25 um 4:21 PM schrieb Daniel Kral: >>> @@ -497,6 +499,25 @@ sub get_datacenter_settings { >>> }; >>> } >>> >>> +sub get_static_service_stats { >>> + my ($self, $id) = @_; >>> + >>> + # undef if update_static_service_stats(...) failed before >>> + return undef if !defined($self->{static_service_stats}); >>> + >>> + return $self->{static_service_stats}->{$id} // {}; >> >> Can't returning '{}' when nothing is there lead to issues down the line? >> If we return undef instead, it's consistent with not having anything >> cached and the caller will fall back to loading the config. > > This return value type definitely needs improvement and/or better > documentation, but an undef $self->{static_service_stats}->{$id} value > indicates that it should fallback to the default value as none of the > properties requested by get_guest_config_properties(...) was included in > that particular guest config, e.g. no 'cores', 'sockets', and 'memory' > properties defined in a VM config. > When $self->{static_service_stats} itself is undef, then the static > cache couldn't be queried for some reason. Okay, so get_guest_config_properties() only includes guests that do have one of the queried properties explicitly set in its result. Thus, we cannot distinguish between the cache being created at a time when a guest did not exist yet or a guest with none of the queried properties explicitly set. If returning {} as a fallback, we get the wrong values in the former case, if returning undef as a fallback, we just have to explicitly load the config in the latter case. There probably are not many setups with many guests without any of the queried properties explicitly set, so that is unlikely to hurt performance in practice. _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel