From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 1/3] machine: split out helper for handling query-machines qmp command result
Date: Mon, 1 Mar 2021 16:53:25 +0100 [thread overview]
Message-ID: <20210301155327.24841-1-f.ebner@proxmox.com> (raw)
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
next reply other threads:[~2021-03-01 15:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-01 15:53 Fabian Ebner [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210301155327.24841-1-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.