]> git.proxmox.com Git - pve-cluster.git/blob - data/src/status.h
pmxcfs: add IPC call to get multiple guest config properties at once
[pve-cluster.git] / data / src / status.h
1 /*
2 Copyright (C) 2010 - 2020 Proxmox Server Solutions GmbH
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Affero General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Affero General Public License for more details.
13
14 You should have received a copy of the GNU Affero General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 Author: Dietmar Maurer <dietmar@proxmox.com>
18
19 */
20
21 #ifndef _PVE_STATUS_H_
22 #define _PVE_STATUS_H_
23
24 #include <glib.h>
25
26 #include "dfsm.h"
27 #include "logger.h"
28 #include "memdb.h"
29
30 #define VMTYPE_QEMU 1
31 // FIXME: remove openvz stuff for 7.x
32 #define VMTYPE_OPENVZ 2
33 #define VMTYPE_LXC 3
34
35 #define CFS_MAX_STATUS_SIZE (32*1024)
36
37 typedef struct cfs_clnode cfs_clnode_t;
38 typedef struct cfs_clinfo cfs_clinfo_t;
39
40 void
41 cfs_status_init(void);
42
43 void
44 cfs_status_cleanup(void);
45
46 dfsm_t *
47 cfs_status_dfsm_new(void);
48
49 void
50 cfs_cluster_log(clog_entry_t *entry);
51
52 void
53 cfs_cluster_log_dump(
54 GString *str,
55 const char *user,
56 guint max_entries);
57
58 void
59 cfs_rrd_dump(GString *str);
60
61 int
62 cfs_status_set(
63 const char *key,
64 gpointer data,
65 size_t len);
66
67 void
68 cfs_status_set_clinfo(
69 cfs_clinfo_t *clinfo);
70
71 void
72 cfs_status_set_vmlist(
73 GHashTable *vmlist);
74
75 cfs_clnode_t *
76 cfs_clnode_new(
77 const char *name,
78 uint32_t nodeid,
79 uint32_t votes);
80
81 void
82 cfs_clnode_destroy(
83 cfs_clnode_t *clnode);
84
85 cfs_clinfo_t *
86 cfs_clinfo_new(
87 const char *cluster_name,
88 uint32_t cman_version);
89
90 gboolean
91 cfs_clinfo_destroy(
92 cfs_clinfo_t *clinfo);
93
94 gboolean
95 cfs_clinfo_add_node(
96 cfs_clinfo_t *clinfo,
97 cfs_clnode_t *clnode);
98
99 void
100 cfs_set_quorate(
101 uint32_t quorate,
102 gboolean quiet);
103
104 gboolean
105 cfs_is_quorate(void);
106
107 GHashTable *
108 vmlist_hash_new(void);
109
110 gboolean
111 vmlist_hash_insert_vm(
112 GHashTable *vmlist,
113 int vmtype,
114 guint32 vmid,
115 const char *nodename,
116 gboolean replace);
117
118 void
119 vmlist_register_vm(
120 int vmtype,
121 guint32 vmid,
122 const char *nodename);
123
124 void
125 vmlist_delete_vm(
126 guint32 vmid);
127
128 gboolean
129 vmlist_vm_exists(
130 guint32 vmid);
131
132 gboolean
133 vmlist_different_vm_exists(
134 int vmtype,
135 guint32 vmid,
136 const char *nodename);
137
138 void
139 record_memdb_change(const char *path);
140
141 void
142 record_memdb_reload(void);
143
144
145 int
146 cfs_create_status_msg(
147 GString *str,
148 const char *nodename,
149 const char *key);
150
151 int
152 cfs_create_version_msg(
153 GString *str);
154
155 int
156 cfs_create_vmlist_msg(
157 GString *str);
158
159 int
160 cfs_create_memberlist_msg(
161 GString *str);
162
163 int
164 cfs_create_guest_conf_property_msg(GString *str, memdb_t *memdb, const char *prop, uint32_t vmid);
165
166 int
167 cfs_create_guest_conf_properties_msg(GString *str, memdb_t *memdb, const char **props, uint8_t num_props, uint32_t vmid);
168
169 #endif /* _PVE_STATUS_H_ */