public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server 1/3] machine: split out helper for handling query-machines qmp command result
@ 2021-03-01 15:53 Fabian Ebner
  2021-03-01 15:53 ` [pve-devel] [PATCH qemu-server 2/3] fix #3301: status: add currently running machine and QEMU version to full status Fabian Ebner
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Fabian Ebner @ 2021-03-01 15:53 UTC (permalink / raw)
  To: pve-devel

to be re-used in the vmstatus() call.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 PVE/QemuServer/Machine.pm | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/PVE/QemuServer/Machine.pm b/PVE/QemuServer/Machine.pm
index c168ade..2474951 100644
--- a/PVE/QemuServer/Machine.pm
+++ b/PVE/QemuServer/Machine.pm
@@ -18,11 +18,8 @@ sub machine_type_is_q35 {
     return $conf->{machine} && ($conf->{machine} =~ m/q35/) ? 1 : 0;
 }
 
-# this only works if VM is running
-sub get_current_qemu_machine {
-    my ($vmid) = @_;
-
-    my $res = PVE::QemuServer::Monitor::mon_cmd($vmid, 'query-machines');
+sub current_from_query_machines {
+    my ($res) = @_;
 
     my ($current, $pve_version, $default);
     foreach my $e (@$res) {
@@ -37,6 +34,15 @@ sub get_current_qemu_machine {
     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
 # 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.
-- 
2.20.1





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-08 12:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-01 15:53 [pve-devel] [PATCH qemu-server 1/3] machine: split out helper for handling query-machines qmp command result Fabian Ebner
2021-03-01 15:53 ` [pve-devel] [PATCH qemu-server 2/3] fix #3301: status: add currently running machine and QEMU version to full status Fabian Ebner
2021-03-04 12:58   ` [pve-devel] applied: " Thomas Lamprecht
2021-03-01 15:53 ` [pve-devel] [PATCH manager 3/3] fix #3301: ui: show currently running QEMU version Fabian Ebner
2021-03-04 12:51 ` [pve-devel] [PATCH qemu-server 1/3] machine: split out helper for handling query-machines qmp command result Stefan Reiter
2021-03-08 12:57   ` Fabian Ebner
2021-03-04 12:58 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal