From: Stefan Reiter <s.reiter@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 3/7] api: add Machine module to query machine types
Date: Thu, 4 Mar 2021 13:52:05 +0100 [thread overview]
Message-ID: <20210304125209.24078-4-s.reiter@proxmox.com> (raw)
In-Reply-To: <20210304125209.24078-1-s.reiter@proxmox.com>
The file is provided by pve-qemu-kvm.
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
PVE/API2/Qemu/Machine.pm | 49 ++++++++++++++++++++++++++++++++++++++++
PVE/API2/Qemu/Makefile | 2 +-
2 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 PVE/API2/Qemu/Machine.pm
diff --git a/PVE/API2/Qemu/Machine.pm b/PVE/API2/Qemu/Machine.pm
new file mode 100644
index 0000000..c0a8c57
--- /dev/null
+++ b/PVE/API2/Qemu/Machine.pm
@@ -0,0 +1,49 @@
+package PVE::API2::Qemu::Machine;
+
+use strict;
+use warnings;
+
+use PVE::RESTHandler;
+use PVE::JSONSchema qw(get_standard_option);
+use PVE::Tools qw(file_get_contents);
+
+use base qw(PVE::RESTHandler);
+
+__PACKAGE__->register_method({
+ name => 'types',
+ path => '',
+ method => 'GET',
+ proxyto => 'node',
+ description => "Get available QEMU/KVM machine types.",
+ permissions => {
+ user => 'all',
+ },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => 'object',
+ properties => {
+ name => {
+ type => 'string',
+ description => "Name of machine type.",
+ },
+ },
+ },
+ },
+ code => sub {
+ my $content = eval {
+ file_get_contents("/usr/share/kvm/machine-versions-x86_64");
+ };
+ die "could not get supported machine versions (try updating 'pve-qemu-kvm') - $@" if $@;
+ my @data = split(m/\n/, $content);
+ @data = map { { name => $_ } } @data;
+ return \@data;
+ }});
+
+1;
diff --git a/PVE/API2/Qemu/Makefile b/PVE/API2/Qemu/Makefile
index f4b7be6..5d4abda 100644
--- a/PVE/API2/Qemu/Makefile
+++ b/PVE/API2/Qemu/Makefile
@@ -1,4 +1,4 @@
-SOURCES=Agent.pm CPU.pm
+SOURCES=Agent.pm CPU.pm Machine.pm
.PHONY: install
install:
--
2.20.1
next prev parent reply other threads:[~2021-03-04 12:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-04 12:52 [pve-devel] [PATCH 0/7] Work around QEMU 5.2 windows incompatibility Stefan Reiter
2021-03-04 12:52 ` [pve-devel] [PATCH pve-qemu 1/7] add static supported machines file Stefan Reiter
2021-03-05 21:27 ` [pve-devel] applied: " Thomas Lamprecht
2021-03-04 12:52 ` [pve-devel] [PATCH pve-qemu 2/7] add ACPI compat patch for 5.1 and older machine types Stefan Reiter
2021-03-05 21:27 ` [pve-devel] applied: " Thomas Lamprecht
2021-03-04 12:52 ` Stefan Reiter [this message]
2021-03-05 21:28 ` [pve-devel] applied: [PATCH qemu-server 3/7] api: add Machine module to query " Thomas Lamprecht
2021-03-04 12:52 ` [pve-devel] [PATCH qemu-server 4/7] add postinst with Windows device incompatibility workaround Stefan Reiter
2021-03-04 13:31 ` Stefan Reiter
2021-03-05 8:03 ` Fabian Ebner
2021-03-05 21:32 ` [pve-devel] NAK: " Thomas Lamprecht
2021-03-04 12:52 ` [pve-devel] [PATCH manager 5/7] api: register Qemu::Machine call Stefan Reiter
2021-03-05 21:33 ` [pve-devel] applied: " Thomas Lamprecht
2021-03-04 12:52 ` [pve-devel] [PATCH manager 6/7] ui: create MachineEdit window Stefan Reiter
2021-03-05 21:33 ` [pve-devel] applied: " Thomas Lamprecht
2021-03-04 12:52 ` [pve-devel] [PATCH manager 7/7] ui: MachineEdit: add option for machine version pinning Stefan Reiter
2021-03-05 21:36 ` [pve-devel] applied: " Thomas Lamprecht
2021-03-05 7:24 ` [pve-devel] [PATCH 0/7] Work around QEMU 5.2 windows incompatibility Fabian Ebner
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=20210304125209.24078-4-s.reiter@proxmox.com \
--to=s.reiter@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox