mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-10-04 17:01:46 +00:00
machine: get current: make it clear that pve-version only exists for the current machine
by adding a comment and grouping the code better. See the PVE QEMU patch "PVE: Allow version code in machine type" for reference. The way the code was written previously made it look like a bug where $pve_version might be overwritten multiple times. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
081eed3b79
commit
7d6a629269
@ -21,14 +21,16 @@ sub machine_type_is_q35 {
|
|||||||
sub current_from_query_machines {
|
sub current_from_query_machines {
|
||||||
my ($machines) = @_;
|
my ($machines) = @_;
|
||||||
|
|
||||||
my ($current, $pve_version, $default);
|
my ($current, $default);
|
||||||
for my $machine ($machines->@*) {
|
for my $machine ($machines->@*) {
|
||||||
$default = $machine->{name} if $machine->{'is-default'};
|
$default = $machine->{name} if $machine->{'is-default'};
|
||||||
$current = $machine->{name} if $machine->{'is-current'};
|
|
||||||
$pve_version = $machine->{'pve-version'} if $machine->{'pve-version'};
|
|
||||||
}
|
|
||||||
|
|
||||||
$current .= "+$pve_version" if $current && $pve_version;
|
if ($machine->{'is-current'}) {
|
||||||
|
$current = $machine->{name};
|
||||||
|
# pve-version only exists for the current machine
|
||||||
|
$current .= "+$machine->{'pve-version'}" if $machine->{'pve-version'};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# fallback to the default machine if current is not supported by qemu
|
# fallback to the default machine if current is not supported by qemu
|
||||||
return $current || $default || 'pc';
|
return $current || $default || 'pc';
|
||||||
|
Loading…
Reference in New Issue
Block a user