]> git.proxmox.com Git - qemu-server.git/blob - PVE/API2/Qemu/Machine.pm
schema: fix description of migrate_downtime parameter
[qemu-server.git] / PVE / API2 / Qemu / Machine.pm
1 package PVE::API2::Qemu::Machine;
2
3 use strict;
4 use warnings;
5
6 use JSON;
7
8 use PVE::JSONSchema qw(get_standard_option);
9 use PVE::RESTHandler;
10 use PVE::Tools qw(file_get_contents);
11
12 use base qw(PVE::RESTHandler);
13
14 __PACKAGE__->register_method({
15 name => 'types',
16 path => '',
17 method => 'GET',
18 proxyto => 'node',
19 description => "Get available QEMU/KVM machine types.",
20 permissions => {
21 user => 'all',
22 },
23 parameters => {
24 additionalProperties => 0,
25 properties => {
26 node => get_standard_option('pve-node'),
27 },
28 },
29 returns => {
30 type => 'array',
31 items => {
32 type => 'object',
33 additionalProperties => 1,
34 properties => {
35 id => {
36 type => 'string',
37 description => "Full name of machine type and version.",
38 },
39 type => {
40 type => 'string',
41 enum => ['q35', 'i440fx'],
42 description => "The machine type.",
43 },
44 version => {
45 type => 'string',
46 description => "The machine version.",
47 },
48 },
49 },
50 },
51 code => sub {
52 my $machines = eval {
53 my $raw = file_get_contents('/usr/share/kvm/machine-versions-x86_64.json');
54 return from_json($raw, { utf8 => 1 });
55 };
56 die "could not load supported machine versions - $@\n" if $@;
57 return $machines;
58 }
59 });
60
61 1;