source: trunk/packages/xen-3.1/xen-3.1/tools/libxen/include/xen/api/xen_host.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 11.5 KB
Line 
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 */
18
19#ifndef XEN_HOST_H
20#define XEN_HOST_H
21
22#include <xen/api/xen_common.h>
23#include <xen/api/xen_host_cpu_decl.h>
24#include <xen/api/xen_host_decl.h>
25#include <xen/api/xen_host_metrics_decl.h>
26#include <xen/api/xen_pbd_decl.h>
27#include <xen/api/xen_pif_decl.h>
28#include <xen/api/xen_sr_decl.h>
29#include <xen/api/xen_string_set.h>
30#include <xen/api/xen_string_string_map.h>
31#include <xen/api/xen_vm_decl.h>
32
33
34/*
35 * The host class.
36 *
37 * A physical host.
38 */
39
40
41/**
42 * Free the given xen_host.  The given handle must have been allocated
43 * by this library.
44 */
45extern void
46xen_host_free(xen_host host);
47
48
49typedef struct xen_host_set
50{
51    size_t size;
52    xen_host *contents[];
53} xen_host_set;
54
55/**
56 * Allocate a xen_host_set of the given size.
57 */
58extern xen_host_set *
59xen_host_set_alloc(size_t size);
60
61/**
62 * Free the given xen_host_set.  The given set must have been allocated
63 * by this library.
64 */
65extern void
66xen_host_set_free(xen_host_set *set);
67
68
69typedef struct xen_host_record
70{
71    xen_host handle;
72    char *uuid;
73    char *name_label;
74    char *name_description;
75    int64_t api_version_major;
76    int64_t api_version_minor;
77    char *api_version_vendor;
78    xen_string_string_map *api_version_vendor_implementation;
79    bool enabled;
80    xen_string_string_map *software_version;
81    xen_string_string_map *other_config;
82    struct xen_string_set *capabilities;
83    xen_string_string_map *cpu_configuration;
84    char *sched_policy;
85    struct xen_string_set *supported_bootloaders;
86    struct xen_vm_record_opt_set *resident_vms;
87    xen_string_string_map *logging;
88    struct xen_pif_record_opt_set *pifs;
89    struct xen_sr_record_opt *suspend_image_sr;
90    struct xen_sr_record_opt *crash_dump_sr;
91    struct xen_pbd_record_opt_set *pbds;
92    struct xen_host_cpu_record_opt_set *host_cpus;
93    struct xen_host_metrics_record_opt *metrics;
94} xen_host_record;
95
96/**
97 * Allocate a xen_host_record.
98 */
99extern xen_host_record *
100xen_host_record_alloc(void);
101
102/**
103 * Free the given xen_host_record, and all referenced values.  The
104 * given record must have been allocated by this library.
105 */
106extern void
107xen_host_record_free(xen_host_record *record);
108
109
110typedef struct xen_host_record_opt
111{
112    bool is_record;
113    union
114    {
115        xen_host handle;
116        xen_host_record *record;
117    } u;
118} xen_host_record_opt;
119
120/**
121 * Allocate a xen_host_record_opt.
122 */
123extern xen_host_record_opt *
124xen_host_record_opt_alloc(void);
125
126/**
127 * Free the given xen_host_record_opt, and all referenced values.  The
128 * given record_opt must have been allocated by this library.
129 */
130extern void
131xen_host_record_opt_free(xen_host_record_opt *record_opt);
132
133
134typedef struct xen_host_record_set
135{
136    size_t size;
137    xen_host_record *contents[];
138} xen_host_record_set;
139
140/**
141 * Allocate a xen_host_record_set of the given size.
142 */
143extern xen_host_record_set *
144xen_host_record_set_alloc(size_t size);
145
146/**
147 * Free the given xen_host_record_set, and all referenced values.  The
148 * given set must have been allocated by this library.
149 */
150extern void
151xen_host_record_set_free(xen_host_record_set *set);
152
153
154
155typedef struct xen_host_record_opt_set
156{
157    size_t size;
158    xen_host_record_opt *contents[];
159} xen_host_record_opt_set;
160
161/**
162 * Allocate a xen_host_record_opt_set of the given size.
163 */
164extern xen_host_record_opt_set *
165xen_host_record_opt_set_alloc(size_t size);
166
167/**
168 * Free the given xen_host_record_opt_set, and all referenced values.
169 * The given set must have been allocated by this library.
170 */
171extern void
172xen_host_record_opt_set_free(xen_host_record_opt_set *set);
173
174
175/**
176 * Get a record containing the current state of the given host.
177 */
178extern bool
179xen_host_get_record(xen_session *session, xen_host_record **result, xen_host host);
180
181
182/**
183 * Get a reference to the host instance with the specified UUID.
184 */
185extern bool
186xen_host_get_by_uuid(xen_session *session, xen_host *result, char *uuid);
187
188
189/**
190 * Get all the host instances with the given label.
191 */
192extern bool
193xen_host_get_by_name_label(xen_session *session, struct xen_host_set **result, char *label);
194
195
196/**
197 * Get the uuid field of the given host.
198 */
199extern bool
200xen_host_get_uuid(xen_session *session, char **result, xen_host host);
201
202
203/**
204 * Get the name/label field of the given host.
205 */
206extern bool
207xen_host_get_name_label(xen_session *session, char **result, xen_host host);
208
209
210/**
211 * Get the name/description field of the given host.
212 */
213extern bool
214xen_host_get_name_description(xen_session *session, char **result, xen_host host);
215
216
217/**
218 * Get the API_version/major field of the given host.
219 */
220extern bool
221xen_host_get_api_version_major(xen_session *session, int64_t *result, xen_host host);
222
223
224/**
225 * Get the API_version/minor field of the given host.
226 */
227extern bool
228xen_host_get_api_version_minor(xen_session *session, int64_t *result, xen_host host);
229
230
231/**
232 * Get the API_version/vendor field of the given host.
233 */
234extern bool
235xen_host_get_api_version_vendor(xen_session *session, char **result, xen_host host);
236
237
238/**
239 * Get the API_version/vendor_implementation field of the given host.
240 */
241extern bool
242xen_host_get_api_version_vendor_implementation(xen_session *session, xen_string_string_map **result, xen_host host);
243
244
245/**
246 * Get the enabled field of the given host.
247 */
248extern bool
249xen_host_get_enabled(xen_session *session, bool *result, xen_host host);
250
251
252/**
253 * Get the software_version field of the given host.
254 */
255extern bool
256xen_host_get_software_version(xen_session *session, xen_string_string_map **result, xen_host host);
257
258
259/**
260 * Get the other_config field of the given host.
261 */
262extern bool
263xen_host_get_other_config(xen_session *session, xen_string_string_map **result, xen_host host);
264
265
266/**
267 * Get the capabilities field of the given host.
268 */
269extern bool
270xen_host_get_capabilities(xen_session *session, struct xen_string_set **result, xen_host host);
271
272
273/**
274 * Get the cpu_configuration field of the given host.
275 */
276extern bool
277xen_host_get_cpu_configuration(xen_session *session, xen_string_string_map **result, xen_host host);
278
279
280/**
281 * Get the sched_policy field of the given host.
282 */
283extern bool
284xen_host_get_sched_policy(xen_session *session, char **result, xen_host host);
285
286
287/**
288 * Get the supported_bootloaders field of the given host.
289 */
290extern bool
291xen_host_get_supported_bootloaders(xen_session *session, struct xen_string_set **result, xen_host host);
292
293
294/**
295 * Get the resident_VMs field of the given host.
296 */
297extern bool
298xen_host_get_resident_vms(xen_session *session, struct xen_vm_set **result, xen_host host);
299
300
301/**
302 * Get the logging field of the given host.
303 */
304extern bool
305xen_host_get_logging(xen_session *session, xen_string_string_map **result, xen_host host);
306
307
308/**
309 * Get the PIFs field of the given host.
310 */
311extern bool
312xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host host);
313
314
315/**
316 * Get the suspend_image_sr field of the given host.
317 */
318extern bool
319xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host host);
320
321
322/**
323 * Get the crash_dump_sr field of the given host.
324 */
325extern bool
326xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host host);
327
328
329/**
330 * Get the PBDs field of the given host.
331 */
332extern bool
333xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host host);
334
335
336/**
337 * Get the host_CPUs field of the given host.
338 */
339extern bool
340xen_host_get_host_cpus(xen_session *session, struct xen_host_cpu_set **result, xen_host host);
341
342
343/**
344 * Get the metrics field of the given host.
345 */
346extern bool
347xen_host_get_metrics(xen_session *session, xen_host_metrics *result, xen_host host);
348
349
350/**
351 * Set the name/label field of the given host.
352 */
353extern bool
354xen_host_set_name_label(xen_session *session, xen_host host, char *label);
355
356
357/**
358 * Set the name/description field of the given host.
359 */
360extern bool
361xen_host_set_name_description(xen_session *session, xen_host host, char *description);
362
363
364/**
365 * Set the other_config field of the given host.
366 */
367extern bool
368xen_host_set_other_config(xen_session *session, xen_host host, xen_string_string_map *other_config);
369
370
371/**
372 * Add the given key-value pair to the other_config field of the given
373 * host.
374 */
375extern bool
376xen_host_add_to_other_config(xen_session *session, xen_host host, char *key, char *value);
377
378
379/**
380 * Remove the given key and its corresponding value from the
381 * other_config field of the given host.  If the key is not in that Map, then
382 * do nothing.
383 */
384extern bool
385xen_host_remove_from_other_config(xen_session *session, xen_host host, char *key);
386
387
388/**
389 * Set the logging field of the given host.
390 */
391extern bool
392xen_host_set_logging(xen_session *session, xen_host host, xen_string_string_map *logging);
393
394
395/**
396 * Add the given key-value pair to the logging field of the given host.
397 */
398extern bool
399xen_host_add_to_logging(xen_session *session, xen_host host, char *key, char *value);
400
401
402/**
403 * Remove the given key and its corresponding value from the logging
404 * field of the given host.  If the key is not in that Map, then do nothing.
405 */
406extern bool
407xen_host_remove_from_logging(xen_session *session, xen_host host, char *key);
408
409
410/**
411 * Set the suspend_image_sr field of the given host.
412 */
413extern bool
414xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr suspend_image_sr);
415
416
417/**
418 * Set the crash_dump_sr field of the given host.
419 */
420extern bool
421xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr crash_dump_sr);
422
423
424/**
425 * Puts the host into a state in which no new VMs can be started.
426 * Currently active VMs on the host continue to execute.
427 */
428extern bool
429xen_host_disable(xen_session *session, xen_host host);
430
431
432/**
433 * Puts the host into a state in which new VMs can be started.
434 */
435extern bool
436xen_host_enable(xen_session *session, xen_host host);
437
438
439/**
440 * Shutdown the host. (This function can only be called if there are no
441 * currently running VMs on the host and it is disabled.).
442 */
443extern bool
444xen_host_shutdown(xen_session *session, xen_host host);
445
446
447/**
448 * Reboot the host. (This function can only be called if there are no
449 * currently running VMs on the host and it is disabled.).
450 */
451extern bool
452xen_host_reboot(xen_session *session, xen_host host);
453
454
455/**
456 * Get the host xen dmesg.
457 */
458extern bool
459xen_host_dmesg(xen_session *session, char **result, xen_host host);
460
461
462/**
463 * Get the host xen dmesg, and clear the buffer.
464 */
465extern bool
466xen_host_dmesg_clear(xen_session *session, char **result, xen_host host);
467
468
469/**
470 * Get the host's log file.
471 */
472extern bool
473xen_host_get_log(xen_session *session, char **result, xen_host host);
474
475
476/**
477 * Inject the given string as debugging keys into Xen.
478 */
479extern bool
480xen_host_send_debug_keys(xen_session *session, xen_host host, char *keys);
481
482
483/**
484 * List all supported methods.
485 */
486extern bool
487xen_host_list_methods(xen_session *session, struct xen_string_set **result);
488
489
490/**
491 * Return a list of all the hosts known to the system.
492 */
493extern bool
494xen_host_get_all(xen_session *session, struct xen_host_set **result);
495
496
497#endif
Note: See TracBrowser for help on using the repository browser.