mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-13 19:26:11 +00:00
move 'windows_version' to Helpers
to avoid a cyclic dependency when we want to use that in PVE::QemuServer::USB Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
2b938c7d88
commit
238af88edc
@ -978,7 +978,7 @@ __PACKAGE__->register_method({
|
||||
my $machine = $conf->{machine};
|
||||
if (!$machine || $machine =~ m/^(?:pc|q35|virt)$/) {
|
||||
# always pin Windows' machine version on create, they get to easily confused
|
||||
if (PVE::QemuServer::windows_version($conf->{ostype})) {
|
||||
if (PVE::QemuServer::Helpers::windows_version($conf->{ostype})) {
|
||||
$conf->{machine} = PVE::QemuServer::windows_get_pinned_machine_version($machine);
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,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);
|
||||
use PVE::QemuServer::Helpers qw(min_version config_aware_timeout windows_version);
|
||||
use PVE::QemuServer::Cloudinit;
|
||||
use PVE::QemuServer::CGroup;
|
||||
use PVE::QemuServer::CPUConfig qw(print_cpu_device get_cpu_options);
|
||||
@ -7960,24 +7960,6 @@ sub scsihw_infos {
|
||||
return ($maxdev, $controller, $controller_prefix);
|
||||
}
|
||||
|
||||
sub windows_version {
|
||||
my ($ostype) = @_;
|
||||
|
||||
return 0 if !$ostype;
|
||||
|
||||
my $winversion = 0;
|
||||
|
||||
if($ostype eq 'wxp' || $ostype eq 'w2k3' || $ostype eq 'w2k') {
|
||||
$winversion = 5;
|
||||
} elsif($ostype eq 'w2k8' || $ostype eq 'wvista') {
|
||||
$winversion = 6;
|
||||
} elsif ($ostype =~ m/^win(\d+)$/) {
|
||||
$winversion = $1;
|
||||
}
|
||||
|
||||
return $winversion;
|
||||
}
|
||||
|
||||
sub resolve_dst_disk_format {
|
||||
my ($storecfg, $storeid, $src_volname, $format) = @_;
|
||||
my ($defFormat, $validFormats) = PVE::Storage::storage_default_format($storecfg, $storeid);
|
||||
|
@ -12,6 +12,7 @@ use Storable qw(dclone);
|
||||
use PVE::Tools qw(run_command file_set_contents);
|
||||
use PVE::Storage;
|
||||
use PVE::QemuServer;
|
||||
use PVE::QemuServer::Helpers;
|
||||
|
||||
use constant CLOUDINIT_DISK_SIZE => 4 * 1024 * 1024; # 4MiB in bytes
|
||||
|
||||
@ -71,7 +72,7 @@ sub get_cloudinit_format {
|
||||
# the new predicatble network device naming scheme.
|
||||
if (defined(my $ostype = $conf->{ostype})) {
|
||||
return 'configdrive2'
|
||||
if PVE::QemuServer::windows_version($ostype);
|
||||
if PVE::QemuServer::Helpers::windows_version($ostype);
|
||||
}
|
||||
|
||||
return 'nocloud';
|
||||
|
@ -13,6 +13,7 @@ use base 'Exporter';
|
||||
our @EXPORT_OK = qw(
|
||||
min_version
|
||||
config_aware_timeout
|
||||
windows_version
|
||||
);
|
||||
|
||||
my $nodename = PVE::INotify::nodename();
|
||||
@ -185,4 +186,22 @@ sub pvecfg_min_version {
|
||||
die "internal error: cannot check version of invalid string '$verstr'";
|
||||
}
|
||||
|
||||
sub windows_version {
|
||||
my ($ostype) = @_;
|
||||
|
||||
return 0 if !$ostype;
|
||||
|
||||
my $winversion = 0;
|
||||
|
||||
if($ostype eq 'wxp' || $ostype eq 'w2k3' || $ostype eq 'w2k') {
|
||||
$winversion = 5;
|
||||
} elsif($ostype eq 'w2k8' || $ostype eq 'wvista') {
|
||||
$winversion = 6;
|
||||
} elsif ($ostype =~ m/^win(\d+)$/) {
|
||||
$winversion = $1;
|
||||
}
|
||||
|
||||
return $winversion;
|
||||
}
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user