mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-13 12:46:06 +00:00
machine: improve code style in get_pve_version
This makes it a bit more obvious what happens and having an actual error for bogus $PVE_MACHINE_VERSION entries. Note that there was no auto-vivification before, as we never directly accessed $PVE_MACHINE_VERSION->{$verstr}->{highest} but used get_machine_pve_revisions to query a specific QEMU machine version's PVE revisions and then operated on the return value, and that method returns undef if there is no entry at all. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
a9a5d37bc6
commit
cbe9de99c5
@ -191,9 +191,11 @@ sub get_machine_pve_revisions {
|
|||||||
sub get_pve_version {
|
sub get_pve_version {
|
||||||
my ($verstr) = @_;
|
my ($verstr) = @_;
|
||||||
|
|
||||||
my $pve_machine = get_machine_pve_revisions($verstr);
|
if (my $pve_machine = get_machine_pve_revisions($verstr)) {
|
||||||
|
return $pve_machine->{highest} || die "internal error - machine version '$verstr' missing 'highest'";
|
||||||
|
}
|
||||||
|
|
||||||
return $pve_machine->{highest} // 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub can_run_pve_machine_version {
|
sub can_run_pve_machine_version {
|
||||||
|
Loading…
Reference in New Issue
Block a user