ia64/xen-unstable

view tools/libxen/include/xen_host.h @ 14048:e0e300fda3f0

Remove host.create and host.destroy -- these never made any sense.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Tue Feb 20 22:46:21 2007 +0000 (2007-02-20)
parents c804da44b06c
children 2840b5e7f585
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_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 * Get all the host instances with the given label.
181 */
182 extern bool
183 xen_host_get_by_name_label(xen_session *session, struct xen_host_set **result, char *label);
186 /**
187 * Get the uuid field of the given host.
188 */
189 extern bool
190 xen_host_get_uuid(xen_session *session, char **result, xen_host host);
193 /**
194 * Get the name/label field of the given host.
195 */
196 extern bool
197 xen_host_get_name_label(xen_session *session, char **result, xen_host host);
200 /**
201 * Get the name/description field of the given host.
202 */
203 extern bool
204 xen_host_get_name_description(xen_session *session, char **result, xen_host host);
207 /**
208 * Get the software_version field of the given host.
209 */
210 extern bool
211 xen_host_get_software_version(xen_session *session, xen_string_string_map **result, xen_host host);
214 /**
215 * Get the other_config field of the given host.
216 */
217 extern bool
218 xen_host_get_other_config(xen_session *session, xen_string_string_map **result, xen_host host);
221 /**
222 * Get the resident_VMs field of the given host.
223 */
224 extern bool
225 xen_host_get_resident_vms(xen_session *session, struct xen_vm_set **result, xen_host host);
228 /**
229 * Get the logging field of the given host.
230 */
231 extern bool
232 xen_host_get_logging(xen_session *session, xen_string_string_map **result, xen_host host);
235 /**
236 * Get the PIFs field of the given host.
237 */
238 extern bool
239 xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host host);
242 /**
243 * Get the suspend_image_sr field of the given host.
244 */
245 extern bool
246 xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host host);
249 /**
250 * Get the crash_dump_sr field of the given host.
251 */
252 extern bool
253 xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host host);
256 /**
257 * Get the PBDs field of the given host.
258 */
259 extern bool
260 xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host host);
263 /**
264 * Get the host_CPUs field of the given host.
265 */
266 extern bool
267 xen_host_get_host_cpus(xen_session *session, struct xen_host_cpu_set **result, xen_host host);
270 /**
271 * Get the metrics field of the given host.
272 */
273 extern bool
274 xen_host_get_metrics(xen_session *session, xen_host_metrics *result, xen_host host);
277 /**
278 * Set the name/label field of the given host.
279 */
280 extern bool
281 xen_host_set_name_label(xen_session *session, xen_host host, char *label);
284 /**
285 * Set the name/description field of the given host.
286 */
287 extern bool
288 xen_host_set_name_description(xen_session *session, xen_host host, char *description);
291 /**
292 * Set the other_config field of the given host.
293 */
294 extern bool
295 xen_host_set_other_config(xen_session *session, xen_host host, xen_string_string_map *other_config);
298 /**
299 * Add the given key-value pair to the other_config field of the given
300 * host.
301 */
302 extern bool
303 xen_host_add_to_other_config(xen_session *session, xen_host host, char *key, char *value);
306 /**
307 * Remove the given key and its corresponding value from the
308 * other_config field of the given host. If the key is not in that Map, then
309 * do nothing.
310 */
311 extern bool
312 xen_host_remove_from_other_config(xen_session *session, xen_host host, char *key);
315 /**
316 * Set the logging field of the given host.
317 */
318 extern bool
319 xen_host_set_logging(xen_session *session, xen_host host, xen_string_string_map *logging);
322 /**
323 * Add the given key-value pair to the logging field of the given host.
324 */
325 extern bool
326 xen_host_add_to_logging(xen_session *session, xen_host host, char *key, char *value);
329 /**
330 * Remove the given key and its corresponding value from the logging
331 * field of the given host. If the key is not in that Map, then do nothing.
332 */
333 extern bool
334 xen_host_remove_from_logging(xen_session *session, xen_host host, char *key);
337 /**
338 * Set the suspend_image_sr field of the given host.
339 */
340 extern bool
341 xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr suspend_image_sr);
344 /**
345 * Set the crash_dump_sr field of the given host.
346 */
347 extern bool
348 xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr crash_dump_sr);
351 /**
352 * Puts the host into a state in which no new VMs can be started.
353 * Currently active VMs on the host continue to execute.
354 */
355 extern bool
356 xen_host_disable(xen_session *session, xen_host host);
359 /**
360 * Puts the host into a state in which new VMs can be started.
361 */
362 extern bool
363 xen_host_enable(xen_session *session, xen_host host);
366 /**
367 * Shutdown the host. (This function can only be called if there are no
368 * currently running VMs on the host and it is disabled.)
369 */
370 extern bool
371 xen_host_shutdown(xen_session *session, xen_host host);
374 /**
375 * Reboot the host. (This function can only be called if there are no
376 * currently running VMs on the host and it is disabled.)
377 */
378 extern bool
379 xen_host_reboot(xen_session *session, xen_host host);
382 /**
383 * Get the host xen dmesg.
384 */
385 extern bool
386 xen_host_dmesg(xen_session *session, char **result, xen_host host);
389 /**
390 * Return a list of all the hosts known to the system.
391 */
392 extern bool
393 xen_host_get_all(xen_session *session, struct xen_host_set **result);
396 #endif