~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to tools/libxen/src/xen_host.c

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
20
#include <stddef.h>
 
21
#include <stdlib.h>
 
22
 
 
23
#include "xen_internal.h"
 
24
#include <xen/api/xen_common.h>
 
25
#include <xen/api/xen_host.h>
 
26
#include <xen/api/xen_host_cpu.h>
 
27
#include <xen/api/xen_host_metrics.h>
 
28
#include <xen/api/xen_pbd.h>
 
29
#include <xen/api/xen_pif.h>
 
30
#include <xen/api/xen_sr.h>
 
31
#include <xen/api/xen_string_string_map.h>
 
32
#include <xen/api/xen_vm.h>
 
33
 
 
34
 
 
35
XEN_FREE(xen_host)
 
36
XEN_SET_ALLOC_FREE(xen_host)
 
37
XEN_ALLOC(xen_host_record)
 
38
XEN_SET_ALLOC_FREE(xen_host_record)
 
39
XEN_ALLOC(xen_host_record_opt)
 
40
XEN_RECORD_OPT_FREE(xen_host)
 
41
XEN_SET_ALLOC_FREE(xen_host_record_opt)
 
42
 
 
43
 
 
44
static const struct_member xen_host_record_struct_members[] =
 
45
    {
 
46
        { .key = "uuid",
 
47
          .type = &abstract_type_string,
 
48
          .offset = offsetof(xen_host_record, uuid) },
 
49
        { .key = "name_label",
 
50
          .type = &abstract_type_string,
 
51
          .offset = offsetof(xen_host_record, name_label) },
 
52
        { .key = "name_description",
 
53
          .type = &abstract_type_string,
 
54
          .offset = offsetof(xen_host_record, name_description) },
 
55
        { .key = "API_version_major",
 
56
          .type = &abstract_type_int,
 
57
          .offset = offsetof(xen_host_record, api_version_major) },
 
58
        { .key = "API_version_minor",
 
59
          .type = &abstract_type_int,
 
60
          .offset = offsetof(xen_host_record, api_version_minor) },
 
61
        { .key = "API_version_vendor",
 
62
          .type = &abstract_type_string,
 
63
          .offset = offsetof(xen_host_record, api_version_vendor) },
 
64
        { .key = "API_version_vendor_implementation",
 
65
          .type = &abstract_type_string_string_map,
 
66
          .offset = offsetof(xen_host_record, api_version_vendor_implementation) },
 
67
        { .key = "enabled",
 
68
          .type = &abstract_type_bool,
 
69
          .offset = offsetof(xen_host_record, enabled) },
 
70
        { .key = "software_version",
 
71
          .type = &abstract_type_string_string_map,
 
72
          .offset = offsetof(xen_host_record, software_version) },
 
73
        { .key = "other_config",
 
74
          .type = &abstract_type_string_string_map,
 
75
          .offset = offsetof(xen_host_record, other_config) },
 
76
        { .key = "capabilities",
 
77
          .type = &abstract_type_string_set,
 
78
          .offset = offsetof(xen_host_record, capabilities) },
 
79
        { .key = "cpu_configuration",
 
80
          .type = &abstract_type_string_string_map,
 
81
          .offset = offsetof(xen_host_record, cpu_configuration) },
 
82
        { .key = "sched_policy",
 
83
          .type = &abstract_type_string,
 
84
          .offset = offsetof(xen_host_record, sched_policy) },
 
85
        { .key = "supported_bootloaders",
 
86
          .type = &abstract_type_string_set,
 
87
          .offset = offsetof(xen_host_record, supported_bootloaders) },
 
88
        { .key = "resident_VMs",
 
89
          .type = &abstract_type_ref_set,
 
90
          .offset = offsetof(xen_host_record, resident_vms) },
 
91
        { .key = "logging",
 
92
          .type = &abstract_type_string_string_map,
 
93
          .offset = offsetof(xen_host_record, logging) },
 
94
        { .key = "PIFs",
 
95
          .type = &abstract_type_ref_set,
 
96
          .offset = offsetof(xen_host_record, pifs) },
 
97
        { .key = "suspend_image_sr",
 
98
          .type = &abstract_type_ref,
 
99
          .offset = offsetof(xen_host_record, suspend_image_sr) },
 
100
        { .key = "crash_dump_sr",
 
101
          .type = &abstract_type_ref,
 
102
          .offset = offsetof(xen_host_record, crash_dump_sr) },
 
103
        { .key = "PBDs",
 
104
          .type = &abstract_type_ref_set,
 
105
          .offset = offsetof(xen_host_record, pbds) },
 
106
        { .key = "host_CPUs",
 
107
          .type = &abstract_type_ref_set,
 
108
          .offset = offsetof(xen_host_record, host_cpus) },
 
109
        { .key = "metrics",
 
110
          .type = &abstract_type_ref,
 
111
          .offset = offsetof(xen_host_record, metrics) }
 
112
    };
 
113
 
 
114
const abstract_type xen_host_record_abstract_type_ =
 
115
    {
 
116
       .typename = STRUCT,
 
117
       .struct_size = sizeof(xen_host_record),
 
118
       .member_count =
 
119
           sizeof(xen_host_record_struct_members) / sizeof(struct_member),
 
120
       .members = xen_host_record_struct_members
 
121
    };
 
122
 
 
123
 
 
124
void
 
125
xen_host_record_free(xen_host_record *record)
 
126
{
 
127
    if (record == NULL)
 
128
    {
 
129
        return;
 
130
    }
 
131
    free(record->handle);
 
132
    free(record->uuid);
 
133
    free(record->name_label);
 
134
    free(record->name_description);
 
135
    free(record->api_version_vendor);
 
136
    xen_string_string_map_free(record->api_version_vendor_implementation);
 
137
    xen_string_string_map_free(record->software_version);
 
138
    xen_string_string_map_free(record->other_config);
 
139
    xen_string_set_free(record->capabilities);
 
140
    xen_string_string_map_free(record->cpu_configuration);
 
141
    free(record->sched_policy);
 
142
    xen_string_set_free(record->supported_bootloaders);
 
143
    xen_vm_record_opt_set_free(record->resident_vms);
 
144
    xen_string_string_map_free(record->logging);
 
145
    xen_pif_record_opt_set_free(record->pifs);
 
146
    xen_sr_record_opt_free(record->suspend_image_sr);
 
147
    xen_sr_record_opt_free(record->crash_dump_sr);
 
148
    xen_pbd_record_opt_set_free(record->pbds);
 
149
    xen_host_cpu_record_opt_set_free(record->host_cpus);
 
150
    xen_host_metrics_record_opt_free(record->metrics);
 
151
    free(record);
 
152
}
 
153
 
 
154
 
 
155
bool
 
156
xen_host_get_record(xen_session *session, xen_host_record **result, xen_host host)
 
157
{
 
158
    abstract_value param_values[] =
 
159
        {
 
160
            { .type = &abstract_type_string,
 
161
              .u.string_val = host }
 
162
        };
 
163
 
 
164
    abstract_type result_type = xen_host_record_abstract_type_;
 
165
 
 
166
    *result = NULL;
 
167
    XEN_CALL_("host.get_record");
 
168
 
 
169
    if (session->ok)
 
170
    {
 
171
       (*result)->handle = xen_strdup_((*result)->uuid);
 
172
    }
 
173
 
 
174
    return session->ok;
 
175
}
 
176
 
 
177
 
 
178
bool
 
179
xen_host_get_by_uuid(xen_session *session, xen_host *result, char *uuid)
 
180
{
 
181
    abstract_value param_values[] =
 
182
        {
 
183
            { .type = &abstract_type_string,
 
184
              .u.string_val = uuid }
 
185
        };
 
186
 
 
187
    abstract_type result_type = abstract_type_string;
 
188
 
 
189
    *result = NULL;
 
190
    XEN_CALL_("host.get_by_uuid");
 
191
    return session->ok;
 
192
}
 
193
 
 
194
 
 
195
bool
 
196
xen_host_get_by_name_label(xen_session *session, struct xen_host_set **result, char *label)
 
197
{
 
198
    abstract_value param_values[] =
 
199
        {
 
200
            { .type = &abstract_type_string,
 
201
              .u.string_val = label }
 
202
        };
 
203
 
 
204
    abstract_type result_type = abstract_type_string_set;
 
205
 
 
206
    *result = NULL;
 
207
    XEN_CALL_("host.get_by_name_label");
 
208
    return session->ok;
 
209
}
 
210
 
 
211
 
 
212
bool
 
213
xen_host_get_name_label(xen_session *session, char **result, xen_host host)
 
214
{
 
215
    abstract_value param_values[] =
 
216
        {
 
217
            { .type = &abstract_type_string,
 
218
              .u.string_val = host }
 
219
        };
 
220
 
 
221
    abstract_type result_type = abstract_type_string;
 
222
 
 
223
    *result = NULL;
 
224
    XEN_CALL_("host.get_name_label");
 
225
    return session->ok;
 
226
}
 
227
 
 
228
 
 
229
bool
 
230
xen_host_get_name_description(xen_session *session, char **result, xen_host host)
 
231
{
 
232
    abstract_value param_values[] =
 
233
        {
 
234
            { .type = &abstract_type_string,
 
235
              .u.string_val = host }
 
236
        };
 
237
 
 
238
    abstract_type result_type = abstract_type_string;
 
239
 
 
240
    *result = NULL;
 
241
    XEN_CALL_("host.get_name_description");
 
242
    return session->ok;
 
243
}
 
244
 
 
245
 
 
246
bool
 
247
xen_host_get_api_version_major(xen_session *session, int64_t *result, xen_host host)
 
248
{
 
249
    abstract_value param_values[] =
 
250
        {
 
251
            { .type = &abstract_type_string,
 
252
              .u.string_val = host }
 
253
        };
 
254
 
 
255
    abstract_type result_type = abstract_type_int;
 
256
 
 
257
    XEN_CALL_("host.get_API_version_major");
 
258
    return session->ok;
 
259
}
 
260
 
 
261
 
 
262
bool
 
263
xen_host_get_api_version_minor(xen_session *session, int64_t *result, xen_host host)
 
264
{
 
265
    abstract_value param_values[] =
 
266
        {
 
267
            { .type = &abstract_type_string,
 
268
              .u.string_val = host }
 
269
        };
 
270
 
 
271
    abstract_type result_type = abstract_type_int;
 
272
 
 
273
    XEN_CALL_("host.get_API_version_minor");
 
274
    return session->ok;
 
275
}
 
276
 
 
277
 
 
278
bool
 
279
xen_host_get_api_version_vendor(xen_session *session, char **result, xen_host host)
 
280
{
 
281
    abstract_value param_values[] =
 
282
        {
 
283
            { .type = &abstract_type_string,
 
284
              .u.string_val = host }
 
285
        };
 
286
 
 
287
    abstract_type result_type = abstract_type_string;
 
288
 
 
289
    *result = NULL;
 
290
    XEN_CALL_("host.get_API_version_vendor");
 
291
    return session->ok;
 
292
}
 
293
 
 
294
 
 
295
bool
 
296
xen_host_get_api_version_vendor_implementation(xen_session *session, xen_string_string_map **result, xen_host host)
 
297
{
 
298
    abstract_value param_values[] =
 
299
        {
 
300
            { .type = &abstract_type_string,
 
301
              .u.string_val = host }
 
302
        };
 
303
 
 
304
    abstract_type result_type = abstract_type_string_string_map;
 
305
 
 
306
    *result = NULL;
 
307
    XEN_CALL_("host.get_API_version_vendor_implementation");
 
308
    return session->ok;
 
309
}
 
310
 
 
311
 
 
312
bool
 
313
xen_host_get_enabled(xen_session *session, bool *result, xen_host host)
 
314
{
 
315
    abstract_value param_values[] =
 
316
        {
 
317
            { .type = &abstract_type_string,
 
318
              .u.string_val = host }
 
319
        };
 
320
 
 
321
    abstract_type result_type = abstract_type_bool;
 
322
 
 
323
    XEN_CALL_("host.get_enabled");
 
324
    return session->ok;
 
325
}
 
326
 
 
327
 
 
328
bool
 
329
xen_host_get_software_version(xen_session *session, xen_string_string_map **result, xen_host host)
 
330
{
 
331
    abstract_value param_values[] =
 
332
        {
 
333
            { .type = &abstract_type_string,
 
334
              .u.string_val = host }
 
335
        };
 
336
 
 
337
    abstract_type result_type = abstract_type_string_string_map;
 
338
 
 
339
    *result = NULL;
 
340
    XEN_CALL_("host.get_software_version");
 
341
    return session->ok;
 
342
}
 
343
 
 
344
 
 
345
bool
 
346
xen_host_get_other_config(xen_session *session, xen_string_string_map **result, xen_host host)
 
347
{
 
348
    abstract_value param_values[] =
 
349
        {
 
350
            { .type = &abstract_type_string,
 
351
              .u.string_val = host }
 
352
        };
 
353
 
 
354
    abstract_type result_type = abstract_type_string_string_map;
 
355
 
 
356
    *result = NULL;
 
357
    XEN_CALL_("host.get_other_config");
 
358
    return session->ok;
 
359
}
 
360
 
 
361
 
 
362
bool
 
363
xen_host_get_capabilities(xen_session *session, struct xen_string_set **result, xen_host host)
 
364
{
 
365
    abstract_value param_values[] =
 
366
        {
 
367
            { .type = &abstract_type_string,
 
368
              .u.string_val = host }
 
369
        };
 
370
 
 
371
    abstract_type result_type = abstract_type_string_set;
 
372
 
 
373
    *result = NULL;
 
374
    XEN_CALL_("host.get_capabilities");
 
375
    return session->ok;
 
376
}
 
377
 
 
378
 
 
379
bool
 
380
xen_host_get_cpu_configuration(xen_session *session, xen_string_string_map **result, xen_host host)
 
381
{
 
382
    abstract_value param_values[] =
 
383
        {
 
384
            { .type = &abstract_type_string,
 
385
              .u.string_val = host }
 
386
        };
 
387
 
 
388
    abstract_type result_type = abstract_type_string_string_map;
 
389
 
 
390
    *result = NULL;
 
391
    XEN_CALL_("host.get_cpu_configuration");
 
392
    return session->ok;
 
393
}
 
394
 
 
395
 
 
396
bool
 
397
xen_host_get_sched_policy(xen_session *session, char **result, xen_host host)
 
398
{
 
399
    abstract_value param_values[] =
 
400
        {
 
401
            { .type = &abstract_type_string,
 
402
              .u.string_val = host }
 
403
        };
 
404
 
 
405
    abstract_type result_type = abstract_type_string;
 
406
 
 
407
    *result = NULL;
 
408
    XEN_CALL_("host.get_sched_policy");
 
409
    return session->ok;
 
410
}
 
411
 
 
412
 
 
413
bool
 
414
xen_host_get_supported_bootloaders(xen_session *session, struct xen_string_set **result, xen_host host)
 
415
{
 
416
    abstract_value param_values[] =
 
417
        {
 
418
            { .type = &abstract_type_string,
 
419
              .u.string_val = host }
 
420
        };
 
421
 
 
422
    abstract_type result_type = abstract_type_string_set;
 
423
 
 
424
    *result = NULL;
 
425
    XEN_CALL_("host.get_supported_bootloaders");
 
426
    return session->ok;
 
427
}
 
428
 
 
429
 
 
430
bool
 
431
xen_host_get_resident_vms(xen_session *session, struct xen_vm_set **result, xen_host host)
 
432
{
 
433
    abstract_value param_values[] =
 
434
        {
 
435
            { .type = &abstract_type_string,
 
436
              .u.string_val = host }
 
437
        };
 
438
 
 
439
    abstract_type result_type = abstract_type_string_set;
 
440
 
 
441
    *result = NULL;
 
442
    XEN_CALL_("host.get_resident_VMs");
 
443
    return session->ok;
 
444
}
 
445
 
 
446
 
 
447
bool
 
448
xen_host_get_logging(xen_session *session, xen_string_string_map **result, xen_host host)
 
449
{
 
450
    abstract_value param_values[] =
 
451
        {
 
452
            { .type = &abstract_type_string,
 
453
              .u.string_val = host }
 
454
        };
 
455
 
 
456
    abstract_type result_type = abstract_type_string_string_map;
 
457
 
 
458
    *result = NULL;
 
459
    XEN_CALL_("host.get_logging");
 
460
    return session->ok;
 
461
}
 
462
 
 
463
 
 
464
bool
 
465
xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host host)
 
466
{
 
467
    abstract_value param_values[] =
 
468
        {
 
469
            { .type = &abstract_type_string,
 
470
              .u.string_val = host }
 
471
        };
 
472
 
 
473
    abstract_type result_type = abstract_type_string_set;
 
474
 
 
475
    *result = NULL;
 
476
    XEN_CALL_("host.get_PIFs");
 
477
    return session->ok;
 
478
}
 
479
 
 
480
 
 
481
bool
 
482
xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host host)
 
483
{
 
484
    abstract_value param_values[] =
 
485
        {
 
486
            { .type = &abstract_type_string,
 
487
              .u.string_val = host }
 
488
        };
 
489
 
 
490
    abstract_type result_type = abstract_type_string;
 
491
 
 
492
    *result = NULL;
 
493
    XEN_CALL_("host.get_suspend_image_sr");
 
494
    return session->ok;
 
495
}
 
496
 
 
497
 
 
498
bool
 
499
xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host host)
 
500
{
 
501
    abstract_value param_values[] =
 
502
        {
 
503
            { .type = &abstract_type_string,
 
504
              .u.string_val = host }
 
505
        };
 
506
 
 
507
    abstract_type result_type = abstract_type_string;
 
508
 
 
509
    *result = NULL;
 
510
    XEN_CALL_("host.get_crash_dump_sr");
 
511
    return session->ok;
 
512
}
 
513
 
 
514
 
 
515
bool
 
516
xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host host)
 
517
{
 
518
    abstract_value param_values[] =
 
519
        {
 
520
            { .type = &abstract_type_string,
 
521
              .u.string_val = host }
 
522
        };
 
523
 
 
524
    abstract_type result_type = abstract_type_string_set;
 
525
 
 
526
    *result = NULL;
 
527
    XEN_CALL_("host.get_PBDs");
 
528
    return session->ok;
 
529
}
 
530
 
 
531
 
 
532
bool
 
533
xen_host_get_host_cpus(xen_session *session, struct xen_host_cpu_set **result, xen_host host)
 
534
{
 
535
    abstract_value param_values[] =
 
536
        {
 
537
            { .type = &abstract_type_string,
 
538
              .u.string_val = host }
 
539
        };
 
540
 
 
541
    abstract_type result_type = abstract_type_string_set;
 
542
 
 
543
    *result = NULL;
 
544
    XEN_CALL_("host.get_host_CPUs");
 
545
    return session->ok;
 
546
}
 
547
 
 
548
 
 
549
bool
 
550
xen_host_get_metrics(xen_session *session, xen_host_metrics *result, xen_host host)
 
551
{
 
552
    abstract_value param_values[] =
 
553
        {
 
554
            { .type = &abstract_type_string,
 
555
              .u.string_val = host }
 
556
        };
 
557
 
 
558
    abstract_type result_type = abstract_type_string;
 
559
 
 
560
    *result = NULL;
 
561
    XEN_CALL_("host.get_metrics");
 
562
    return session->ok;
 
563
}
 
564
 
 
565
 
 
566
bool
 
567
xen_host_set_name_label(xen_session *session, xen_host host, char *label)
 
568
{
 
569
    abstract_value param_values[] =
 
570
        {
 
571
            { .type = &abstract_type_string,
 
572
              .u.string_val = host },
 
573
            { .type = &abstract_type_string,
 
574
              .u.string_val = label }
 
575
        };
 
576
 
 
577
    xen_call_(session, "host.set_name_label", param_values, 2, NULL, NULL);
 
578
    return session->ok;
 
579
}
 
580
 
 
581
 
 
582
bool
 
583
xen_host_set_name_description(xen_session *session, xen_host host, char *description)
 
584
{
 
585
    abstract_value param_values[] =
 
586
        {
 
587
            { .type = &abstract_type_string,
 
588
              .u.string_val = host },
 
589
            { .type = &abstract_type_string,
 
590
              .u.string_val = description }
 
591
        };
 
592
 
 
593
    xen_call_(session, "host.set_name_description", param_values, 2, NULL, NULL);
 
594
    return session->ok;
 
595
}
 
596
 
 
597
 
 
598
bool
 
599
xen_host_set_other_config(xen_session *session, xen_host host, xen_string_string_map *other_config)
 
600
{
 
601
    abstract_value param_values[] =
 
602
        {
 
603
            { .type = &abstract_type_string,
 
604
              .u.string_val = host },
 
605
            { .type = &abstract_type_string_string_map,
 
606
              .u.set_val = (arbitrary_set *)other_config }
 
607
        };
 
608
 
 
609
    xen_call_(session, "host.set_other_config", param_values, 2, NULL, NULL);
 
610
    return session->ok;
 
611
}
 
612
 
 
613
 
 
614
bool
 
615
xen_host_add_to_other_config(xen_session *session, xen_host host, char *key, char *value)
 
616
{
 
617
    abstract_value param_values[] =
 
618
        {
 
619
            { .type = &abstract_type_string,
 
620
              .u.string_val = host },
 
621
            { .type = &abstract_type_string,
 
622
              .u.string_val = key },
 
623
            { .type = &abstract_type_string,
 
624
              .u.string_val = value }
 
625
        };
 
626
 
 
627
    xen_call_(session, "host.add_to_other_config", param_values, 3, NULL, NULL);
 
628
    return session->ok;
 
629
}
 
630
 
 
631
 
 
632
bool
 
633
xen_host_remove_from_other_config(xen_session *session, xen_host host, char *key)
 
634
{
 
635
    abstract_value param_values[] =
 
636
        {
 
637
            { .type = &abstract_type_string,
 
638
              .u.string_val = host },
 
639
            { .type = &abstract_type_string,
 
640
              .u.string_val = key }
 
641
        };
 
642
 
 
643
    xen_call_(session, "host.remove_from_other_config", param_values, 2, NULL, NULL);
 
644
    return session->ok;
 
645
}
 
646
 
 
647
 
 
648
bool
 
649
xen_host_set_logging(xen_session *session, xen_host host, xen_string_string_map *logging)
 
650
{
 
651
    abstract_value param_values[] =
 
652
        {
 
653
            { .type = &abstract_type_string,
 
654
              .u.string_val = host },
 
655
            { .type = &abstract_type_string_string_map,
 
656
              .u.set_val = (arbitrary_set *)logging }
 
657
        };
 
658
 
 
659
    xen_call_(session, "host.set_logging", param_values, 2, NULL, NULL);
 
660
    return session->ok;
 
661
}
 
662
 
 
663
 
 
664
bool
 
665
xen_host_add_to_logging(xen_session *session, xen_host host, char *key, char *value)
 
666
{
 
667
    abstract_value param_values[] =
 
668
        {
 
669
            { .type = &abstract_type_string,
 
670
              .u.string_val = host },
 
671
            { .type = &abstract_type_string,
 
672
              .u.string_val = key },
 
673
            { .type = &abstract_type_string,
 
674
              .u.string_val = value }
 
675
        };
 
676
 
 
677
    xen_call_(session, "host.add_to_logging", param_values, 3, NULL, NULL);
 
678
    return session->ok;
 
679
}
 
680
 
 
681
 
 
682
bool
 
683
xen_host_remove_from_logging(xen_session *session, xen_host host, char *key)
 
684
{
 
685
    abstract_value param_values[] =
 
686
        {
 
687
            { .type = &abstract_type_string,
 
688
              .u.string_val = host },
 
689
            { .type = &abstract_type_string,
 
690
              .u.string_val = key }
 
691
        };
 
692
 
 
693
    xen_call_(session, "host.remove_from_logging", param_values, 2, NULL, NULL);
 
694
    return session->ok;
 
695
}
 
696
 
 
697
 
 
698
bool
 
699
xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr suspend_image_sr)
 
700
{
 
701
    abstract_value param_values[] =
 
702
        {
 
703
            { .type = &abstract_type_string,
 
704
              .u.string_val = host },
 
705
            { .type = &abstract_type_string,
 
706
              .u.string_val = suspend_image_sr }
 
707
        };
 
708
 
 
709
    xen_call_(session, "host.set_suspend_image_sr", param_values, 2, NULL, NULL);
 
710
    return session->ok;
 
711
}
 
712
 
 
713
 
 
714
bool
 
715
xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr crash_dump_sr)
 
716
{
 
717
    abstract_value param_values[] =
 
718
        {
 
719
            { .type = &abstract_type_string,
 
720
              .u.string_val = host },
 
721
            { .type = &abstract_type_string,
 
722
              .u.string_val = crash_dump_sr }
 
723
        };
 
724
 
 
725
    xen_call_(session, "host.set_crash_dump_sr", param_values, 2, NULL, NULL);
 
726
    return session->ok;
 
727
}
 
728
 
 
729
 
 
730
bool
 
731
xen_host_disable(xen_session *session, xen_host host)
 
732
{
 
733
    abstract_value param_values[] =
 
734
        {
 
735
            { .type = &abstract_type_string,
 
736
              .u.string_val = host }
 
737
        };
 
738
 
 
739
    xen_call_(session, "host.disable", param_values, 1, NULL, NULL);
 
740
    return session->ok;
 
741
}
 
742
 
 
743
 
 
744
bool
 
745
xen_host_enable(xen_session *session, xen_host host)
 
746
{
 
747
    abstract_value param_values[] =
 
748
        {
 
749
            { .type = &abstract_type_string,
 
750
              .u.string_val = host }
 
751
        };
 
752
 
 
753
    xen_call_(session, "host.enable", param_values, 1, NULL, NULL);
 
754
    return session->ok;
 
755
}
 
756
 
 
757
 
 
758
bool
 
759
xen_host_shutdown(xen_session *session, xen_host host)
 
760
{
 
761
    abstract_value param_values[] =
 
762
        {
 
763
            { .type = &abstract_type_string,
 
764
              .u.string_val = host }
 
765
        };
 
766
 
 
767
    xen_call_(session, "host.shutdown", param_values, 1, NULL, NULL);
 
768
    return session->ok;
 
769
}
 
770
 
 
771
 
 
772
bool
 
773
xen_host_reboot(xen_session *session, xen_host host)
 
774
{
 
775
    abstract_value param_values[] =
 
776
        {
 
777
            { .type = &abstract_type_string,
 
778
              .u.string_val = host }
 
779
        };
 
780
 
 
781
    xen_call_(session, "host.reboot", param_values, 1, NULL, NULL);
 
782
    return session->ok;
 
783
}
 
784
 
 
785
 
 
786
bool
 
787
xen_host_dmesg(xen_session *session, char **result, xen_host host)
 
788
{
 
789
    abstract_value param_values[] =
 
790
        {
 
791
            { .type = &abstract_type_string,
 
792
              .u.string_val = host }
 
793
        };
 
794
 
 
795
    abstract_type result_type = abstract_type_string;
 
796
 
 
797
    *result = NULL;
 
798
    XEN_CALL_("host.dmesg");
 
799
    return session->ok;
 
800
}
 
801
 
 
802
 
 
803
bool
 
804
xen_host_dmesg_clear(xen_session *session, char **result, xen_host host)
 
805
{
 
806
    abstract_value param_values[] =
 
807
        {
 
808
            { .type = &abstract_type_string,
 
809
              .u.string_val = host }
 
810
        };
 
811
 
 
812
    abstract_type result_type = abstract_type_string;
 
813
 
 
814
    *result = NULL;
 
815
    XEN_CALL_("host.dmesg_clear");
 
816
    return session->ok;
 
817
}
 
818
 
 
819
 
 
820
bool
 
821
xen_host_get_log(xen_session *session, char **result, xen_host host)
 
822
{
 
823
    abstract_value param_values[] =
 
824
        {
 
825
            { .type = &abstract_type_string,
 
826
              .u.string_val = host }
 
827
        };
 
828
 
 
829
    abstract_type result_type = abstract_type_string;
 
830
 
 
831
    *result = NULL;
 
832
    XEN_CALL_("host.get_log");
 
833
    return session->ok;
 
834
}
 
835
 
 
836
 
 
837
bool
 
838
xen_host_send_debug_keys(xen_session *session, xen_host host, char *keys)
 
839
{
 
840
    abstract_value param_values[] =
 
841
        {
 
842
            { .type = &abstract_type_string,
 
843
              .u.string_val = host },
 
844
            { .type = &abstract_type_string,
 
845
              .u.string_val = keys }
 
846
        };
 
847
 
 
848
    xen_call_(session, "host.send_debug_keys", param_values, 2, NULL, NULL);
 
849
    return session->ok;
 
850
}
 
851
 
 
852
 
 
853
bool
 
854
xen_host_list_methods(xen_session *session, struct xen_string_set **result)
 
855
{
 
856
 
 
857
    abstract_type result_type = abstract_type_string_set;
 
858
 
 
859
    *result = NULL;
 
860
    xen_call_(session, "host.list_methods", NULL, 0, &result_type, result);
 
861
    return session->ok;
 
862
}
 
863
 
 
864
 
 
865
bool
 
866
xen_host_get_all(xen_session *session, struct xen_host_set **result)
 
867
{
 
868
 
 
869
    abstract_type result_type = abstract_type_string_set;
 
870
 
 
871
    *result = NULL;
 
872
    xen_call_(session, "host.get_all", NULL, 0, &result_type, result);
 
873
    return session->ok;
 
874
}
 
875
 
 
876
 
 
877
bool
 
878
xen_host_get_uuid(xen_session *session, char **result, xen_host host)
 
879
{
 
880
    abstract_value param_values[] =
 
881
        {
 
882
            { .type = &abstract_type_string,
 
883
              .u.string_val = host }
 
884
        };
 
885
 
 
886
    abstract_type result_type = abstract_type_string;
 
887
 
 
888
    *result = NULL;
 
889
    XEN_CALL_("host.get_uuid");
 
890
    return session->ok;
 
891
}