]> git.proxmox.com Git - qemu-server.git/commitdiff
machine: get current: return early from loop if possible
authorFiona Ebner <f.ebner@proxmox.com>
Fri, 10 Nov 2023 13:24:48 +0000 (14:24 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sun, 12 Nov 2023 17:48:01 +0000 (18:48 +0100)
No point iterating through the rest if we already got the current
machine.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
PVE/QemuServer/Machine.pm

index 85cfb89cc8168e3a8388c73756f11c3fc0916cfd..c9fc9a3d66cbddc8df5c500fa08375259691264b 100644 (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