From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 7D4659662 for ; Mon, 4 Sep 2023 13:40:26 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 636E9E24D for ; Mon, 4 Sep 2023 13:39:56 +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)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 4 Sep 2023 13:39:54 +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 8A1C641038 for ; Mon, 4 Sep 2023 13:39:54 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Mon, 4 Sep 2023 13:39:45 +0200 Message-Id: <20230904113949.940431-2-f.ebner@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230904113949.940431-1-f.ebner@proxmox.com> References: <20230904113949.940431-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.079 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu-server 1/5] move parse_number_sets() helper to helpers module 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: , X-List-Received-Date: Mon, 04 Sep 2023 11:40:26 -0000 In preparation to move parse_numa() to the memory module. No functional change intended. Signed-off-by: Fiona Ebner --- PVE/QemuServer.pm | 16 +--------------- PVE/QemuServer/Helpers.pm | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index bf1de179..ed604a80 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -49,7 +49,7 @@ use PVE::Tools qw(run_command file_read_firstline file_get_contents dir_glob_for use PVE::QMPClient; use PVE::QemuConfig; -use PVE::QemuServer::Helpers qw(min_version config_aware_timeout windows_version); +use PVE::QemuServer::Helpers qw(config_aware_timeout min_version parse_number_sets windows_version); use PVE::QemuServer::Cloudinit; use PVE::QemuServer::CGroup; use PVE::QemuServer::CPUConfig qw(print_cpu_device get_cpu_options); @@ -1930,20 +1930,6 @@ sub print_vga_device { return "$type,id=${vgaid}${memory}${max_outputs}${pciaddr}${edidoff}"; } -sub parse_number_sets { - my ($set) = @_; - my $res = []; - foreach my $part (split(/;/, $set)) { - if ($part =~ /^\s*(\d+)(?:-(\d+))?\s*$/) { - die "invalid range: $part ($2 < $1)\n" if defined($2) && $2 < $1; - push @$res, [ $1, $2 ]; - } else { - die "invalid range: $part\n"; - } - } - return $res; -} - sub parse_numa { my ($data) = @_; diff --git a/PVE/QemuServer/Helpers.pm b/PVE/QemuServer/Helpers.pm index ee3979df..99eb33a0 100644 --- a/PVE/QemuServer/Helpers.pm +++ b/PVE/QemuServer/Helpers.pm @@ -13,6 +13,7 @@ use base 'Exporter'; our @EXPORT_OK = qw( min_version config_aware_timeout +parse_number_sets windows_version ); @@ -186,6 +187,20 @@ sub pvecfg_min_version { die "internal error: cannot check version of invalid string '$verstr'"; } +sub parse_number_sets { + my ($set) = @_; + my $res = []; + foreach my $part (split(/;/, $set)) { + if ($part =~ /^\s*(\d+)(?:-(\d+))?\s*$/) { + die "invalid range: $part ($2 < $1)\n" if defined($2) && $2 < $1; + push @$res, [ $1, $2 ]; + } else { + die "invalid range: $part\n"; + } + } + return $res; +} + sub windows_version { my ($ostype) = @_; -- 2.39.2