[pve-devel] [RFC manager 3/6] Broadcast supported CPU flags and allow 'cluster' CPU type

Stefan Reiter s.reiter at proxmox.com
Wed Jul 17 15:03:45 CEST 2019


pvestatd will read supported CPU flags once on startup (since these
most likely never change during runtime), then broadcasts them as a
key-value pair to the cluster.

Also add the 'cluster' CPU type to be selectable in the GUI.

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---
 PVE/Service/pvestatd.pm               | 11 +++++++++--
 www/manager6/form/CPUModelSelector.js |  4 ++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm
index e138b2e8..35f02066 100755
--- a/PVE/Service/pvestatd.pm
+++ b/PVE/Service/pvestatd.pm
@@ -47,12 +47,16 @@ my $cmdline = [$0, @ARGV];
 my %daemon_options = (restart_on_error => 5, stop_wait_time => 5);
 my $daemon = __PACKAGE__->new('pvestatd', $cmdline, %daemon_options);
 
+my $supported_cpuflags = '';
+
 sub init {
     my ($self) = @_;
 
     $opt_debug = $self->{debug};
 
     PVE::Cluster::cfs_update();
+
+    $supported_cpuflags = PVE::QemuServer::query_supported_cpu_flags();
 }
 
 sub shutdown {
@@ -91,7 +95,10 @@ sub update_node_status {
 
     my $cpuinfo = PVE::ProcFSTools::read_cpuinfo();
 
-    my $maxcpu = $cpuinfo->{cpus}; 
+    my $maxcpu = $cpuinfo->{cpus};
+
+    my $flag_string = join(" ", @$supported_cpuflags);
+    PVE::Cluster::broadcast_node_kv("cpuflags", $flag_string);
 
     my $subinfo = PVE::INotify::read_file('subscription');
     my $sublevel = $subinfo->{level} || '';
@@ -104,7 +111,7 @@ sub update_node_status {
 	$netin += $netdev->{$dev}->{receive};
 	$netout += $netdev->{$dev}->{transmit};
     }
- 
+
     my $meminfo = PVE::ProcFSTools::read_meminfo();
 
     my $dinfo = df('/', 1);     # output is bytes
diff --git a/www/manager6/form/CPUModelSelector.js b/www/manager6/form/CPUModelSelector.js
index 9eb5b0e9..7a2b572f 100644
--- a/www/manager6/form/CPUModelSelector.js
+++ b/www/manager6/form/CPUModelSelector.js
@@ -32,7 +32,7 @@ Ext.define('PVE.form.CPUModelSelector', {
 	['Opteron_G4', 'Opteron_G4'],
 	['Opteron_G5', 'Opteron_G5'],
 	['EPYC', 'EPYC'],
-	['host', 'host']
-
+	['host', 'host'],
+	['cluster', 'cluster']
     ]
 });
-- 
2.20.1





More information about the pve-devel mailing list