From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id DDEA61FF0C0 for ; Wed, 18 Nov 2026 16:44:28 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 3B5DF218AE; Wed, 18 Nov 2026 16:43:42 +0100 (CET) From: Jonas Theisen To: pve-devel@lists.proxmox.com Subject: [PATCH manager 12/15] pvestatd: broadcast host CPU information relevant for live migration Date: Wed, 18 Nov 2026 16:40:43 +0100 Message-ID: <20261118154207.424260-13-j.theisen@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261118154207.424260-1-j.theisen@proxmox.com> References: <20261118154207.424260-1-j.theisen@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1795016563692 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.085 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: DRU7GLMRXALDM5XBYMR7B74RXKBZNBGE X-Message-ID-Hash: DRU7GLMRXALDM5XBYMR7B74RXKBZNBGE X-MailFrom: j.theisen@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: qemu-server checks whether the CPU of a target node can run a VM after a live migration, for example whether it supports the TSC frequency a VM with 'hv-reenlightenment' requires, or has the same vendor and model as the source for VMs with the 'host' CPU model. Broadcast the information qemu-server provides for this, currently the CPU vendor and model name, TSC frequency and TSC scaling support of the node, so that the source node of a migration can check this. The information cannot change while pvestatd runs, so it is only queried once, but broadcast again if the node key-value entry got lost. Signed-off-by: Jonas Theisen --- PVE/Service/pvestatd.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm index cec66e00..91d244b3 100755 --- a/PVE/Service/pvestatd.pm +++ b/PVE/Service/pvestatd.pm @@ -21,6 +21,7 @@ use PVE::NodeConfig; use PVE::Cluster qw(cfs_read_file); use PVE::Storage; use PVE::QemuServer; +use PVE::QemuServer::Helpers; use PVE::QemuServer::Monitor; use PVE::LXC; use PVE::CGroup; @@ -166,6 +167,25 @@ my sub broadcast_static_node_info { } } +# the host CPU cannot change while pvestatd is running +my $host_cpu_info; + +my sub broadcast_host_cpu_info { + if (!defined($host_cpu_info)) { + $host_cpu_info = eval { PVE::QemuServer::Helpers::get_host_cpu_info() }; + if (my $err = $@) { + syslog('err', "unable to query host CPU information - $err"); + return; + } + } + + my $info = JSON->new->canonical->encode($host_cpu_info); + + # re-broadcast if the entry got lost, for example after a restart of pmxcfs + my $old = PVE::Cluster::get_node_kv('host-cpu-info', $nodename)->{$nodename}; + PVE::Cluster::broadcast_node_kv('host-cpu-info', $info) if ($old // '') ne $info; +} + my ($cached_ip_links, $cached_ip_link_last_update) = (undef, 0); my $MAX_IP_LINK_CACHE_AGE_SECONDS = 15 * 60; # every 15 minutes @@ -291,6 +311,7 @@ sub update_node_status { PVE::PullMetric::update($pull_txn, 'node', $node_metric, $ctime); broadcast_static_node_info($maxcpu, $meminfo->{memtotal}); + broadcast_host_cpu_info(); } sub auto_ballooning { -- 2.47.3