[pve-devel] [PATCH qemu-server 1/5] move parse_number_sets() helper to helpers module
Fiona Ebner
f.ebner at proxmox.com
Mon Sep 4 13:39:45 CEST 2023
In preparation to move parse_numa() to the memory module.
No functional change intended.
Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
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
More information about the pve-devel
mailing list