mirror of
git://git.proxmox.com/git/qemu-server.git
synced 2025-01-08 21:18:03 +03:00
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 <f.ebner@proxmox.com>
This commit is contained in:
parent
61b172d806
commit
261b67e4aa
@ -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) = @_;
|
||||
|
||||
|
@ -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) = @_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user