From 261b67e4aa449fedc6a67448f84cb3fa608cbeda Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Mon, 4 Sep 2023 13:39:45 +0200 Subject: [PATCH] move parse_number_sets() helper to helpers module 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 b52dfbf4..f2da943e 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) = @_;