mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-12 09:04:42 +00:00
implement get_current_qemu_machine
This commit is contained in:
parent
952958bc87
commit
ff556cf2a0
@ -4764,4 +4764,21 @@ sub clone_disk {
|
||||
return $disk;
|
||||
}
|
||||
|
||||
# this only works if VM is running
|
||||
sub get_current_qemu_machine {
|
||||
my ($vmid) = @_;
|
||||
|
||||
my $cmd = { execute => 'query-machines', arguments => {} };
|
||||
my $res = PVE::QemuServer::vm_qmp_command($vmid, $cmd);
|
||||
|
||||
my ($current, $default);
|
||||
foreach my $e (@$res) {
|
||||
$default = $e->{name} if $e->{'is-default'};
|
||||
$current = $e->{name} if $e->{'is-current'};
|
||||
}
|
||||
|
||||
# fallback to the default machine if current is not supported by qemu
|
||||
return $current || $default || 'pc';
|
||||
}
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user