]> git.proxmox.com Git - pve-cluster.git/blob - data/PVE/API2/ClusterConfig.pm
ab807bd8ce00c4475b06eabda2d722410adc7612
[pve-cluster.git] / data / PVE / API2 / ClusterConfig.pm
1 package PVE::API2::ClusterConfig;
2
3 use strict;
4 use warnings;
5 use PVE::Tools;
6 use PVE::SafeSyslog;
7 use PVE::RESTHandler;
8 use PVE::RPCEnvironment;
9 use PVE::JSONSchema qw(get_standard_option);
10 use PVE::Cluster;
11
12 use base qw(PVE::RESTHandler);
13
14 __PACKAGE__->register_method({
15 name => 'index',
16 path => '',
17 method => 'GET',
18 description => "Directory index.",
19 parameters => {
20 additionalProperties => 0,
21 properties => {},
22 },
23 returns => {
24 type => 'array',
25 items => {
26 type => "object",
27 properties => {},
28 },
29 links => [ { rel => 'child', href => "{name}" } ],
30 },
31 code => sub {
32 my ($param) = @_;
33
34 my $result = [
35 { name => 'nodes' },
36 { name => 'totem' },
37 ];
38
39 return $result;
40 }});
41
42 __PACKAGE__->register_method({
43 name => 'nodes',
44 path => 'nodes',
45 method => 'GET',
46 description => "Corosync node list.",
47 parameters => {
48 additionalProperties => 0,
49 properties => {},
50 },
51 returns => {
52 type => 'array',
53 items => {
54 type => "object",
55 properties => {
56 node => { type => 'string' },
57 },
58 },
59 links => [ { rel => 'child', href => "{node}" } ],
60 },
61 code => sub {
62 my ($param) = @_;
63
64
65 my $conf = PVE::Cluster::cfs_read_file('corosync.conf');
66 my $nodelist = PVE::Cluster::corosync_nodelist($conf);
67
68 return PVE::RESTHandler::hash_to_array($nodelist, 'node');
69 }});
70
71 __PACKAGE__->register_method({
72 name => 'totem',
73 path => 'totem',
74 method => 'GET',
75 description => "Get corosync totem protocol settings.",
76 parameters => {
77 additionalProperties => 0,
78 properties => {},
79 },
80 returns => {
81 type => "object",
82 properties => {},
83 },
84 code => sub {
85 my ($param) = @_;
86
87
88 my $conf = PVE::Cluster::cfs_read_file('corosync.conf');
89
90 return PVE::Cluster::corosync_totem_config($conf);
91 }});
92
93 1;