]> git.proxmox.com Git - pve-cluster.git/blob - data/src/status.h
9f521605dd6aa65faaf41d71e25039a02bd0d48e
[pve-cluster.git] / data / src / status.h
1 /*
2 Copyright (C) 2010-2015 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 #define VMTYPE_OPENVZ 2
32 #define VMTYPE_LXC 3
33
34 #define CFS_MAX_STATUS_SIZE (32*1024)
35
36 typedef struct cfs_clnode cfs_clnode_t;
37 typedef struct cfs_clinfo cfs_clinfo_t;
38
39 void
40 cfs_status_init(void);
41
42 void
43 cfs_status_cleanup(void);
44
45 dfsm_t *
46 cfs_status_dfsm_new(void);
47
48 void
49 cfs_cluster_log(clog_entry_t *entry);
50
51 void
52 cfs_cluster_log_dump(
53 GString *str,
54 const char *user,
55 guint max_entries);
56
57 void
58 cfs_rrd_dump(GString *str);
59
60 int
61 cfs_status_set(
62 const char *key,
63 gpointer data,
64 size_t len);
65
66 void
67 cfs_status_set_clinfo(
68 cfs_clinfo_t *clinfo);
69
70 void
71 cfs_status_set_vmlist(
72 GHashTable *vmlist);
73
74 cfs_clnode_t *
75 cfs_clnode_new(
76 const char *name,
77 uint32_t nodeid,
78 uint32_t votes);
79
80 void
81 cfs_clnode_destroy(
82 cfs_clnode_t *clnode);
83
84 cfs_clinfo_t *
85 cfs_clinfo_new(
86 const char *cluster_name,
87 uint32_t cman_version);
88
89 gboolean
90 cfs_clinfo_destroy(
91 cfs_clinfo_t *clinfo);
92
93 gboolean
94 cfs_clinfo_add_node(
95 cfs_clinfo_t *clinfo,
96 cfs_clnode_t *clnode);
97
98 void
99 cfs_set_quorate(
100 uint32_t quorate,
101 gboolean quiet);
102
103 gboolean
104 cfs_is_quorate(void);
105
106 GHashTable *
107 vmlist_hash_new(void);
108
109 gboolean
110 vmlist_hash_insert_vm(
111 GHashTable *vmlist,
112 int vmtype,
113 guint32 vmid,
114 const char *nodename,
115 gboolean replace);
116
117 void
118 vmlist_register_vm(
119 int vmtype,
120 guint32 vmid,
121 const char *nodename);
122
123 void
124 vmlist_delete_vm(
125 guint32 vmid);
126
127 gboolean
128 vmlist_vm_exists(
129 guint32 vmid);
130
131 gboolean
132 vmlist_different_vm_exists(
133 int vmtype,
134 guint32 vmid,
135 const char *nodename);
136
137 void
138 record_memdb_change(const char *path);
139
140 void
141 record_memdb_reload(void);
142
143
144 int
145 cfs_create_status_msg(
146 GString *str,
147 const char *nodename,
148 const char *key);
149
150 int
151 cfs_create_version_msg(
152 GString *str);
153
154 int
155 cfs_create_vmlist_msg(
156 GString *str);
157
158 int
159 cfs_create_memberlist_msg(
160 GString *str);
161
162 int
163 cfs_create_guest_conf_property_msg(GString *str, memdb_t *memdb, const char *prop, uint32_t vmid);
164
165 #endif /* _PVE_STATUS_H_ */