ia64/xen-unstable

view tools/libxen/include/xen_host.h @ 14052:2840b5e7f585

Added C bindings for host.supported_bootloaders.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Wed Feb 21 00:04:59 2007 +0000 (2007-02-21)
parents e0e300fda3f0
children f3aa6e34aeb1
line source
1 /*
2 * Copyright (c) 2006-2007, XenSource Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library 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 GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
19 #ifndef XEN_HOST_H
20 #define XEN_HOST_H
22 #include "xen_common.h"
23 #include "xen_host_cpu_decl.h"
24 #include "xen_host_decl.h"
25 #include "xen_host_metrics_decl.h"
26 #include "xen_pbd_decl.h"
27 #include "xen_pif_decl.h"
28 #include "xen_sr_decl.h"
29 #include "xen_string_set.h"
30 #include "xen_string_string_map.h"
31 #include "xen_vm_decl.h"
34 /*
35 * The host class.
36 *
37 * A physical host.
38 */
41 /**
42 * Free the given xen_host. The given handle must have been allocated
43 * by this library.
44 */
45 extern void
46 xen_host_free(xen_host host);
49 typedef struct xen_host_set
50 {
51 size_t size;
52 xen_host *contents[];
53 } xen_host_set;
55 /**
56 * Allocate a xen_host_set of the given size.
57 */
58 extern xen_host_set *
59 xen_host_set_alloc(size_t size);
61 /**
62 * Free the given xen_host_set. The given set must have been allocated
63 * by this library.
64 */
65 extern void
66 xen_host_set_free(xen_host_set *set);
69 typedef struct xen_host_record
70 {
71 xen_host handle;
72 char *uuid;
73 char *name_label;
74 char *name_description;
75 xen_string_string_map *software_version;
76 xen_string_string_map *other_config;
77 struct xen_string_set *supported_bootloaders;
78 struct xen_vm_record_opt_set *resident_vms;
79 xen_string_string_map *logging;
80 struct xen_pif_record_opt_set *pifs;
81 struct xen_sr_record_opt *suspend_image_sr;
82 struct xen_sr_record_opt *crash_dump_sr;
83 struct xen_pbd_record_opt_set *pbds;
84 struct xen_host_cpu_record_opt_set *host_cpus;
85 struct xen_host_metrics_record_opt *metrics;
86 } xen_host_record;
88 /**
89 * Allocate a xen_host_record.
90 */
91 extern xen_host_record *
92 xen_host_record_alloc(void);
94 /**
95 * Free the given xen_host_record, and all referenced values. The
96 * given record must have been allocated by this library.
97 */
98 extern void
99 xen_host_record_free(xen_host_record *record);
102 typedef struct xen_host_record_opt
103 {
104 bool is_record;
105 union
106 {
107 xen_host handle;
108 xen_host_record *record;
109 } u;
110 } xen_host_record_opt;
112 /**
113 * Allocate a xen_host_record_opt.
114 */
115 extern xen_host_record_opt *
116 xen_host_record_opt_alloc(void);
118 /**
119 * Free the given xen_host_record_opt, and all referenced values. The
120 * given record_opt must have been allocated by this library.
121 */
122 extern void
123 xen_host_record_opt_free(xen_host_record_opt *record_opt);
126 typedef struct xen_host_record_set
127 {
128 size_t size;
129 xen_host_record *contents[];
130 } xen_host_record_set;
132 /**
133 * Allocate a xen_host_record_set of the given size.
134 */
135 extern xen_host_record_set *
136 xen_host_record_set_alloc(size_t size);
138 /**
139 * Free the given xen_host_record_set, and all referenced values. The
140 * given set must have been allocated by this library.
141 */
142 extern void
143 xen_host_record_set_free(xen_host_record_set *set);
147 typedef struct xen_host_record_opt_set
148 {
149 size_t size;
150 xen_host_record_opt *contents[];
151 } xen_host_record_opt_set;
153 /**
154 * Allocate a xen_host_record_opt_set of the given size.
155 */
156 extern xen_host_record_opt_set *
157 xen_host_record_opt_set_alloc(size_t size);
159 /**
160 * Free the given xen_host_record_opt_set, and all referenced values.
161 * The given set must have been allocated by this library.
162 */
163 extern void
164 xen_host_record_opt_set_free(xen_host_record_opt_set *set);
167 /**
168 * Get a record containing the current state of the given host.
169 */
170 extern bool
171 xen_host_get_record(xen_session *session, xen_host_record **result, xen_host host);
174 /**
175 * Get a reference to the host instance with the specified UUID.
176 */
177 extern bool
178 xen_host_get_by_uuid(xen_session *session, xen_host *result, char *uuid);
181 /**
182 * Get all the host instances with the given label.
183 */
184 extern bool
185 xen_host_get_by_name_label(xen_session *session, struct xen_host_set **result, char *label);
188 /**
189 * Get the uuid field of the given host.
190 */
191 extern bool
192 xen_host_get_uuid(xen_session *session, char **result, xen_host host);
195 /**
196 * Get the name/label field of the given host.
197 */
198 extern bool
199 xen_host_get_name_label(xen_session *session, char **result, xen_host host);
202 /**
203 * Get the name/description field of the given host.
204 */
205 extern bool
206 xen_host_get_name_description(xen_session *session, char **result, xen_host host);
209 /**
210 * Get the software_version field of the given host.
211 */
212 extern bool
213 xen_host_get_software_version(xen_session *session, xen_string_string_map **result, xen_host host);
216 /**
217 * Get the other_config field of the given host.
218 */
219 extern bool
220 xen_host_get_other_config(xen_session *session, xen_string_string_map **result, xen_host host);
223 /**
224 * Get the supported_bootloaders field of the given host.
225 */
226 extern bool
227 xen_host_get_supported_bootloaders(xen_session *session, struct xen_string_set **result, xen_host host);
230 /**
231 * Get the resident_VMs field of the given host.
232 */
233 extern bool
234 xen_host_get_resident_vms(xen_session *session, struct xen_vm_set **result, xen_host host);
237 /**
238 * Get the logging field of the given host.
239 */
240 extern bool
241 xen_host_get_logging(xen_session *session, xen_string_string_map **result, xen_host host);
244 /**
245 * Get the PIFs field of the given host.
246 */
247 extern bool
248 xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host host);
251 /**
252 * Get the suspend_image_sr field of the given host.
253 */
254 extern bool
255 xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host host);
258 /**
259 * Get the crash_dump_sr field of the given host.
260 */
261 extern bool
262 xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host host);
265 /**
266 * Get the PBDs field of the given host.
267 */
268 extern bool
269 xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host host);
272 /**
273 * Get the host_CPUs field of the given host.
274 */
275 extern bool
276 xen_host_get_host_cpus(xen_session *session, struct xen_host_cpu_set **result, xen_host host);
279 /**
280 * Get the metrics field of the given host.
281 */
282 extern bool
283 xen_host_get_metrics(xen_session *session, xen_host_metrics *result, xen_host host);
286 /**
287 * Set the name/label field of the given host.
288 */
289 extern bool
290 xen_host_set_name_label(xen_session *session, xen_host host, char *label);
293 /**
294 * Set the name/description field of the given host.
295 */
296 extern bool
297 xen_host_set_name_description(xen_session *session, xen_host host, char *description);
300 /**
301 * Set the other_config field of the given host.
302 */
303 extern bool
304 xen_host_set_other_config(xen_session *session, xen_host host, xen_string_string_map *other_config);
307 /**
308 * Add the given key-value pair to the other_config field of the given
309 * host.
310 */
311 extern bool
312 xen_host_add_to_other_config(xen_session *session, xen_host host, char *key, char *value);
315 /**
316 * Remove the given key and its corresponding value from the
317 * other_config field of the given host. If the key is not in that Map, then
318 * do nothing.
319 */
320 extern bool
321 xen_host_remove_from_other_config(xen_session *session, xen_host host, char *key);
324 /**
325 * Set the logging field of the given host.
326 */
327 extern bool
328 xen_host_set_logging(xen_session *session, xen_host host, xen_string_string_map *logging);
331 /**
332 * Add the given key-value pair to the logging field of the given host.
333 */
334 extern bool
335 xen_host_add_to_logging(xen_session *session, xen_host host, char *key, char *value);
338 /**
339 * Remove the given key and its corresponding value from the logging
340 * field of the given host. If the key is not in that Map, then do nothing.
341 */
342 extern bool
343 xen_host_remove_from_logging(xen_session *session, xen_host host, char *key);
346 /**
347 * Set the suspend_image_sr field of the given host.
348 */
349 extern bool
350 xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr suspend_image_sr);
353 /**
354 * Set the crash_dump_sr field of the given host.
355 */
356 extern bool
357 xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr crash_dump_sr);
360 /**
361 * Puts the host into a state in which no new VMs can be started.
362 * Currently active VMs on the host continue to execute.
363 */
364 extern bool
365 xen_host_disable(xen_session *session, xen_host host);
368 /**
369 * Puts the host into a state in which new VMs can be started.
370 */
371 extern bool
372 xen_host_enable(xen_session *session, xen_host host);
375 /**
376 * Shutdown the host. (This function can only be called if there are no
377 * currently running VMs on the host and it is disabled.)
378 */
379 extern bool
380 xen_host_shutdown(xen_session *session, xen_host host);
383 /**
384 * Reboot the host. (This function can only be called if there are no
385 * currently running VMs on the host and it is disabled.)
386 */
387 extern bool
388 xen_host_reboot(xen_session *session, xen_host host);
391 /**
392 * Get the host xen dmesg.
393 */
394 extern bool
395 xen_host_dmesg(xen_session *session, char **result, xen_host host);
398 /**
399 * Return a list of all the hosts known to the system.
400 */
401 extern bool
402 xen_host_get_all(xen_session *session, struct xen_host_set **result);
405 #endif