mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-02 17:20:30 +00:00
machine: split out helper for handling query-machines qmp command result
to be re-used in the vmstatus() call. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> Reviewed-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
parent
f8d2a1ce99
commit
ea71be24d6
@ -18,11 +18,8 @@ sub machine_type_is_q35 {
|
|||||||
return $conf->{machine} && ($conf->{machine} =~ m/q35/) ? 1 : 0;
|
return $conf->{machine} && ($conf->{machine} =~ m/q35/) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
# this only works if VM is running
|
sub current_from_query_machines {
|
||||||
sub get_current_qemu_machine {
|
my ($res) = @_;
|
||||||
my ($vmid) = @_;
|
|
||||||
|
|
||||||
my $res = PVE::QemuServer::Monitor::mon_cmd($vmid, 'query-machines');
|
|
||||||
|
|
||||||
my ($current, $pve_version, $default);
|
my ($current, $pve_version, $default);
|
||||||
foreach my $e (@$res) {
|
foreach my $e (@$res) {
|
||||||
@ -37,6 +34,15 @@ sub get_current_qemu_machine {
|
|||||||
return $current || $default || 'pc';
|
return $current || $default || 'pc';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# this only works if VM is running
|
||||||
|
sub get_current_qemu_machine {
|
||||||
|
my ($vmid) = @_;
|
||||||
|
|
||||||
|
my $res = PVE::QemuServer::Monitor::mon_cmd($vmid, 'query-machines');
|
||||||
|
|
||||||
|
return current_from_query_machines($res);
|
||||||
|
}
|
||||||
|
|
||||||
# returns a string with major.minor+pve<VERSION>, patch version-part is ignored
|
# returns a string with major.minor+pve<VERSION>, patch version-part is ignored
|
||||||
# as it's seldom ressembling a real QEMU machine type, so it would be '0' 99% of
|
# as it's seldom ressembling a real QEMU machine type, so it would be '0' 99% of
|
||||||
# the time anyway.. This explicitly separates pveversion from the machine.
|
# the time anyway.. This explicitly separates pveversion from the machine.
|
||||||
|
Loading…
Reference in New Issue
Block a user