ia64/xen-unstable

view tools/libxen/include/xen_host.h @ 14045:7819d9332fba

Split the VBD I/O statistics out into a VBD_metrics class. Document the
VBD.type field, and add it to the C bindings (this was already in Xend).

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Tue Feb 20 21:28:19 2007 +0000 (2007-02-20)
parents c804da44b06c
children e0e300fda3f0
line source
1 /*
2 * Copyright (c) 2006, 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_string_map.h"
30 #include "xen_vm_decl.h"
33 /*
34 * The host class.
35 *
36 * A physical host.
37 */
40 /**
41 * Free the given xen_host. The given handle must have been allocated
42 * by this library.
43 */
44 extern void
45 xen_host_free(xen_host host);
48 typedef struct xen_host_set
49 {
50 size_t size;
51 xen_host *contents[];
52 } xen_host_set;
54 /**
55 * Allocate a xen_host_set of the given size.
56 */
57 extern xen_host_set *
58 xen_host_set_alloc(size_t size);
60 /**
61 * Free the given xen_host_set. The given set must have been allocated
62 * by this library.
63 */
64 extern void
65 xen_host_set_free(xen_host_set *set);
68 typedef struct xen_host_record
69 {
70 xen_host handle;
71 char *uuid;
72 char *name_label;
73 char *name_description;
74 xen_string_string_map *software_version;
75 xen_string_string_map *other_config;
76 struct xen_vm_record_opt_set *resident_vms;
77 xen_string_string_map *logging;
78 struct xen_pif_record_opt_set *pifs;
79 struct xen_sr_record_opt *suspend_image_sr;
80 struct xen_sr_record_opt *crash_dump_sr;
81 struct xen_pbd_record_opt_set *pbds;
82 struct xen_host_cpu_record_opt_set *host_cpus;
83 struct xen_host_metrics_record_opt *metrics;
84 } xen_host_record;
86 /**
87 * Allocate a xen_host_record.
88 */
89 extern xen_host_record *
90 xen_host_record_alloc(void);
92 /**
93 * Free the given xen_host_record, and all referenced values. The
94 * given record must have been allocated by this library.
95 */
96 extern void
97 xen_host_record_free(xen_host_record *record);
100 typedef struct xen_host_record_opt
101 {
102 bool is_record;
103 union
104 {
105 xen_host handle;
106 xen_host_record *record;
107 } u;
108 } xen_host_record_opt;
110 /**
111 * Allocate a xen_host_record_opt.
112 */
113 extern xen_host_record_opt *
114 xen_host_record_opt_alloc(void);
116 /**
117 * Free the given xen_host_record_opt, and all referenced values. The
118 * given record_opt must have been allocated by this library.
119 */
120 extern void
121 xen_host_record_opt_free(xen_host_record_opt *record_opt);
124 typedef struct xen_host_record_set
125 {
126 size_t size;
127 xen_host_record *contents[];
128 } xen_host_record_set;
130 /**
131 * Allocate a xen_host_record_set of the given size.
132 */
133 extern xen_host_record_set *
134 xen_host_record_set_alloc(size_t size);
136 /**
137 * Free the given xen_host_record_set, and all referenced values. The
138 * given set must have been allocated by this library.
139 */
140 extern void
141 xen_host_record_set_free(xen_host_record_set *set);
145 typedef struct xen_host_record_opt_set
146 {
147 size_t size;
148 xen_host_record_opt *contents[];
149 } xen_host_record_opt_set;
151 /**
152 * Allocate a xen_host_record_opt_set of the given size.
153 */
154 extern xen_host_record_opt_set *
155 xen_host_record_opt_set_alloc(size_t size);
157 /**
158 * Free the given xen_host_record_opt_set, and all referenced values.
159 * The given set must have been allocated by this library.
160 */
161 extern void
162 xen_host_record_opt_set_free(xen_host_record_opt_set *set);
165 /**
166 * Get a record containing the current state of the given host.
167 */
168 extern bool
169 xen_host_get_record(xen_session *session, xen_host_record **result, xen_host host);
172 /**
173 * Get a reference to the host instance with the specified UUID.
174 */
175 extern bool
176 xen_host_get_by_uuid(xen_session *session, xen_host *result, char *uuid);
179 /**
180 * Create a new host instance, and return its handle.
181 */
182 extern bool
183 xen_host_create(xen_session *session, xen_host *result, xen_host_record *record);
186 /**
187 * Destroy the specified host instance.
188 */
189 extern bool
190 xen_host_destroy(xen_session *session, xen_host host);
193 /**
194 * Get all the host instances with the given label.
195 */
196 extern bool
197 xen_host_get_by_name_label(xen_session *session, struct xen_host_set **result, char *label);
200 /**
201 * Get the uuid field of the given host.
202 */
203 extern bool
204 xen_host_get_uuid(xen_session *session, char **result, xen_host host);
207 /**
208 * Get the name/label field of the given host.
209 */
210 extern bool
211 xen_host_get_name_label(xen_session *session, char **result, xen_host host);
214 /**
215 * Get the name/description field of the given host.
216 */
217 extern bool
218 xen_host_get_name_description(xen_session *session, char **result, xen_host host);
221 /**
222 * Get the software_version field of the given host.
223 */
224 extern bool
225 xen_host_get_software_version(xen_session *session, xen_string_string_map **result, xen_host host);
228 /**
229 * Get the other_config field of the given host.
230 */
231 extern bool
232 xen_host_get_other_config(xen_session *session, xen_string_string_map **result, xen_host host);
235 /**
236 * Get the resident_VMs field of the given host.
237 */
238 extern bool
239 xen_host_get_resident_vms(xen_session *session, struct xen_vm_set **result, xen_host host);
242 /**
243 * Get the logging field of the given host.
244 */
245 extern bool
246 xen_host_get_logging(xen_session *session, xen_string_string_map **result, xen_host host);
249 /**
250 * Get the PIFs field of the given host.
251 */
252 extern bool
253 xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host host);
256 /**
257 * Get the suspend_image_sr field of the given host.
258 */
259 extern bool
260 xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host host);
263 /**
264 * Get the crash_dump_sr field of the given host.
265 */
266 extern bool
267 xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host host);
270 /**
271 * Get the PBDs field of the given host.
272 */
273 extern bool
274 xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host host);
277 /**
278 * Get the host_CPUs field of the given host.
279 */
280 extern bool
281 xen_host_get_host_cpus(xen_session *session, struct xen_host_cpu_set **result, xen_host host);
284 /**
285 * Get the metrics field of the given host.
286 */
287 extern bool
288 xen_host_get_metrics(xen_session *session, xen_host_metrics *result, xen_host host);
291 /**
292 * Set the name/label field of the given host.
293 */
294 extern bool
295 xen_host_set_name_label(xen_session *session, xen_host host, char *label);
298 /**
299 * Set the name/description field of the given host.
300 */
301 extern bool
302 xen_host_set_name_description(xen_session *session, xen_host host, char *description);
305 /**
306 * Set the other_config field of the given host.
307 */
308 extern bool
309 xen_host_set_other_config(xen_session *session, xen_host host, xen_string_string_map *other_config);
312 /**
313 * Add the given key-value pair to the other_config field of the given
314 * host.
315 */
316 extern bool
317 xen_host_add_to_other_config(xen_session *session, xen_host host, char *key, char *value);
320 /**
321 * Remove the given key and its corresponding value from the
322 * other_config field of the given host. If the key is not in that Map, then
323 * do nothing.
324 */
325 extern bool
326 xen_host_remove_from_other_config(xen_session *session, xen_host host, char *key);
329 /**
330 * Set the logging field of the given host.
331 */
332 extern bool
333 xen_host_set_logging(xen_session *session, xen_host host, xen_string_string_map *logging);
336 /**
337 * Add the given key-value pair to the logging field of the given host.
338 */
339 extern bool
340 xen_host_add_to_logging(xen_session *session, xen_host host, char *key, char *value);
343 /**
344 * Remove the given key and its corresponding value from the logging
345 * field of the given host. If the key is not in that Map, then do nothing.
346 */
347 extern bool
348 xen_host_remove_from_logging(xen_session *session, xen_host host, char *key);
351 /**
352 * Set the suspend_image_sr field of the given host.
353 */
354 extern bool
355 xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr suspend_image_sr);
358 /**
359 * Set the crash_dump_sr field of the given host.
360 */
361 extern bool
362 xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr crash_dump_sr);
365 /**
366 * Puts the host into a state in which no new VMs can be started.
367 * Currently active VMs on the host continue to execute.
368 */
369 extern bool
370 xen_host_disable(xen_session *session, xen_host host);
373 /**
374 * Puts the host into a state in which new VMs can be started.
375 */
376 extern bool
377 xen_host_enable(xen_session *session, xen_host host);
380 /**
381 * Shutdown the host. (This function can only be called if there are no
382 * currently running VMs on the host and it is disabled.)
383 */
384 extern bool
385 xen_host_shutdown(xen_session *session, xen_host host);
388 /**
389 * Reboot the host. (This function can only be called if there are no
390 * currently running VMs on the host and it is disabled.)
391 */
392 extern bool
393 xen_host_reboot(xen_session *session, xen_host host);
396 /**
397 * Get the host xen dmesg.
398 */
399 extern bool
400 xen_host_dmesg(xen_session *session, char **result, xen_host host);
403 /**
404 * Return a list of all the hosts known to the system.
405 */
406 extern bool
407 xen_host_get_all(xen_session *session, struct xen_host_set **result);
410 #endif