machine: get current: return early from loop if possible

No point iterating through the rest if we already got the current
machine.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fiona Ebner 2023-11-10 14:24:48 +01:00 committed by Thomas Lamprecht
parent 7d6a629269
commit be690b7a91

View File

@ -29,11 +29,12 @@ sub current_from_query_machines {
$current = $machine->{name};
# pve-version only exists for the current machine
$current .= "+$machine->{'pve-version'}" if $machine->{'pve-version'};
return $current;
}
}
# fallback to the default machine if current is not supported by qemu
return $current || $default || 'pc';
return $default || 'pc';
}
# this only works if VM is running