~ubuntu-branches/ubuntu/maverick/libvirt/maverick-proposed

« back to all changes in this revision

Viewing changes to src/esx/esx_vi_types.c

  • Committer: Bazaar Package Importer
  • Author(s): Guido Günther
  • Date: 2010-04-19 18:11:57 UTC
  • mfrom: (0.2.6 upstream) (3.8.3 sid)
  • mto: This revision was merged to the branch mainline in revision 92.
  • Revision ID: james.westby@ubuntu.com-20100419181157-p8x7wvat9ovlae6m
Tags: 0.8.0-2
* [70fbcb6] New patch 0007-nwfilter-Don-t-crash-if-driverState- NULL.patch
  nwfilter: Don't crash if driverState == NULL (Closes: #577728)
* [d7d1abd] New patch 0008-Ignore-empty-type-statement-in-disk-
  element.patch Ignore empty type statement in disk element
  (Closes: #578347)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
/*
3
3
 * esx_vi_types.c: client for the VMware VI API 2.5 to manage ESX hosts
4
4
 *
5
 
 * Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
 
5
 * Copyright (C) 2010 Red Hat, Inc.
 
6
 * Copyright (C) 2009-2010 Matthias Bolte <matthias.bolte@googlemail.com>
6
7
 *
7
8
 * This library is free software; you can redistribute it and/or
8
9
 * modify it under the terms of the GNU Lesser General Public
31
32
#include "memory.h"
32
33
#include "logging.h"
33
34
#include "util.h"
34
 
#include "virterror_internal.h"
35
35
#include "esx_vi.h"
36
36
#include "esx_vi_types.h"
37
37
 
38
38
#define VIR_FROM_THIS VIR_FROM_ESX
39
39
 
40
 
#define ESX_VI_ERROR(code, fmt...)                                            \
41
 
    virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
42
 
                         __LINE__, fmt)
43
 
 
44
40
 
45
41
 
46
42
#define ESV_VI__XML_TAG__OPEN(_buffer, _element, _type)                       \
63
59
 
64
60
 
65
61
 
66
 
#define ESX_VI__TEMPLATE__ALLOC(_type)                                        \
 
62
#define ESX_VI__TEMPLATE__ALLOC(__type)                                       \
67
63
    int                                                                       \
68
 
    esxVI_##_type##_Alloc(esxVI_##_type **ptrptr)                             \
 
64
    esxVI_##__type##_Alloc(esxVI_##__type **ptrptr)                           \
69
65
    {                                                                         \
70
 
        return esxVI_Alloc((void **)ptrptr, sizeof(esxVI_##_type));           \
 
66
        if (esxVI_Alloc((void **)ptrptr, sizeof (esxVI_##__type)) < 0) {      \
 
67
            return -1;                                                        \
 
68
        }                                                                     \
 
69
                                                                              \
 
70
        (*ptrptr)->_type = esxVI_Type_##__type;                               \
 
71
                                                                              \
 
72
        return 0;                                                             \
71
73
    }
72
74
 
73
75
 
91
93
 
92
94
 
93
95
 
 
96
#define ESX_VI__TEMPLATE__VALIDATE(__type, _require)                          \
 
97
    int                                                                       \
 
98
    esxVI_##__type##_Validate(esxVI_##__type *item)                           \
 
99
    {                                                                         \
 
100
        const char *type_name = esxVI_Type_ToString(esxVI_Type_##__type);     \
 
101
                                                                              \
 
102
        if (item->_type <= esxVI_Type_Undefined ||                            \
 
103
            item->_type >= esxVI_Type_Other) {                                \
 
104
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                              \
 
105
                         "%s object has invalid dynamic type", type_name);    \
 
106
            return -1;                                                        \
 
107
        }                                                                     \
 
108
                                                                              \
 
109
        _require                                                              \
 
110
                                                                              \
 
111
        return 0;                                                             \
 
112
    }
 
113
 
 
114
 
 
115
 
 
116
#define ESX_VI__TEMPLATE__DEEP_COPY(_type, _deep_copy)                        \
 
117
    int                                                                       \
 
118
    esxVI_##_type##_DeepCopy(esxVI_##_type **dest, esxVI_##_type *src)        \
 
119
    {                                                                         \
 
120
        if (dest == NULL || *dest != NULL) {                                  \
 
121
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",                        \
 
122
                         _("Invalid argument"));                              \
 
123
            return -1;                                                        \
 
124
        }                                                                     \
 
125
                                                                              \
 
126
        if (src == NULL) {                                                    \
 
127
            return 0;                                                         \
 
128
        }                                                                     \
 
129
                                                                              \
 
130
        if (esxVI_##_type##_Alloc(dest) < 0) {                                \
 
131
            goto failure;                                                     \
 
132
        }                                                                     \
 
133
                                                                              \
 
134
        _deep_copy                                                            \
 
135
                                                                              \
 
136
        return 0;                                                             \
 
137
                                                                              \
 
138
      failure:                                                                \
 
139
        esxVI_##_type##_Free(dest);                                           \
 
140
                                                                              \
 
141
        return -1;                                                            \
 
142
    }
 
143
 
 
144
 
 
145
 
94
146
#define ESX_VI__TEMPLATE__LIST__APPEND(_type)                                 \
95
147
    int                                                                       \
96
148
    esxVI_##_type##_AppendToList(esxVI_##_type **list,  esxVI_##_type *item)  \
130
182
#define ESX_VI__TEMPLATE__LIST__SERIALIZE(_type)                              \
131
183
    int                                                                       \
132
184
    esxVI_##_type##_SerializeList(esxVI_##_type *list, const char *element,   \
133
 
                                  virBufferPtr output,                        \
134
 
                                  esxVI_Boolean required)                     \
 
185
                                  virBufferPtr output)                        \
135
186
    {                                                                         \
136
 
        return esxVI_List_Serialize((esxVI_List *)list, element,              \
137
 
                                    output, required,                         \
 
187
        return esxVI_List_Serialize((esxVI_List *)list, element, output,      \
138
188
                                    (esxVI_List_SerializeFunc)                \
139
189
                                      esxVI_##_type##_Serialize);             \
140
190
    }
159
209
                                    esxVI_##_type **ptrptr)                   \
160
210
    {                                                                         \
161
211
        if (anyType == NULL || ptrptr == NULL || *ptrptr != NULL) {           \
162
 
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");         \
 
212
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",                        \
 
213
                         _("Invalid argument"));                              \
163
214
            return -1;                                                        \
164
215
        }                                                                     \
165
216
                                                                              \
166
 
        if (STRNEQ(anyType->other, #_type)) {                                 \
 
217
        if (anyType->type != esxVI_Type_##_type) {                            \
167
218
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                              \
168
219
                         "Expecting type '%s' but found '%s'",                \
169
 
                         #_type, anyType->other);                             \
 
220
                         esxVI_Type_ToString(esxVI_Type_##_type),             \
 
221
                         anyType->other);                                     \
170
222
            return -1;                                                        \
171
223
        }                                                                     \
172
224
                                                                              \
173
 
        return esxVI_##_type##_Deserialize(anyType->_node, ptrptr);           \
 
225
        return esxVI_##_type##_Deserialize(anyType->node, ptrptr);            \
174
226
    }
175
227
 
176
228
 
177
229
 
178
 
#define ESX_VI__TEMPLATE__SERIALIZE_EXTRA(_type, _type_string, _serialize)    \
 
230
#define ESX_VI__TEMPLATE__SERIALIZE_EXTRA(_type, _extra, _serialize)          \
179
231
    int                                                                       \
180
232
    esxVI_##_type##_Serialize(esxVI_##_type *item,                            \
181
 
                              const char *element, virBufferPtr output,       \
182
 
                              esxVI_Boolean required)                         \
 
233
                              const char *element, virBufferPtr output)       \
183
234
    {                                                                         \
184
235
        if (element == NULL || output == NULL ) {                             \
185
 
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");         \
 
236
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",                        \
 
237
                         _("Invalid argument"));                              \
186
238
            return -1;                                                        \
187
239
        }                                                                     \
188
240
                                                                              \
189
241
        if (item == NULL) {                                                   \
190
 
            return esxVI_CheckSerializationNecessity(element, required);      \
191
 
        }                                                                     \
192
 
                                                                              \
193
 
        ESV_VI__XML_TAG__OPEN(output, element, _type_string);                 \
 
242
            return 0;                                                         \
 
243
        }                                                                     \
 
244
                                                                              \
 
245
        _extra                                                                \
 
246
                                                                              \
 
247
        if (esxVI_##_type##_Validate(item) < 0) {                             \
 
248
            return -1;                                                        \
 
249
        }                                                                     \
 
250
                                                                              \
 
251
        ESV_VI__XML_TAG__OPEN(output, element,                                \
 
252
                              esxVI_Type_ToString(esxVI_Type_##_type));       \
194
253
                                                                              \
195
254
        _serialize                                                            \
196
255
                                                                              \
202
261
 
203
262
 
204
263
#define ESX_VI__TEMPLATE__SERIALIZE(_type, _serialize)                        \
205
 
    ESX_VI__TEMPLATE__SERIALIZE_EXTRA(_type, #_type, _serialize)
206
 
 
207
 
 
208
 
 
209
 
#define ESX_VI__TEMPLATE__DESERIALIZE(_type, _deserialize, _require)          \
 
264
    ESX_VI__TEMPLATE__SERIALIZE_EXTRA(_type, /* nothing */, _serialize)
 
265
 
 
266
 
 
267
 
 
268
#define ESX_VI__TEMPLATE__DESERIALIZE(_type, _deserialize)                    \
210
269
    int                                                                       \
211
270
    esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type **ptrptr)      \
212
271
    {                                                                         \
213
272
        xmlNodePtr childNode = NULL;                                          \
214
273
                                                                              \
215
274
        if (ptrptr == NULL || *ptrptr != NULL) {                              \
216
 
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");         \
 
275
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",                        \
 
276
                         _("Invalid argument"));                              \
217
277
            return -1;                                                        \
218
278
        }                                                                     \
219
279
                                                                              \
234
294
            VIR_WARN("Unexpected '%s' property", childNode->name);            \
235
295
        }                                                                     \
236
296
                                                                              \
237
 
        _require                                                              \
 
297
        if (esxVI_##_type##_Validate(*ptrptr) < 0) {                          \
 
298
            goto failure;                                                     \
 
299
        }                                                                     \
238
300
                                                                              \
239
301
        return 0;                                                             \
240
302
                                                                              \
255
317
        long long value;                                                      \
256
318
                                                                              \
257
319
        if (number == NULL || *number != NULL) {                              \
258
 
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");         \
 
320
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",                        \
 
321
                         _("Invalid argument"));                              \
259
322
            return -1;                                                        \
260
323
        }                                                                     \
261
324
                                                                              \
302
365
 
303
366
 
304
367
 
305
 
#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(_type, _name, _required)        \
306
 
    if (esxVI_##_type##_Serialize(item->_name, #_name, output,                \
307
 
                                  esxVI_Boolean_##_required) < 0) {           \
308
 
        return -1;                                                            \
309
 
    }
310
 
 
311
 
 
312
 
 
313
 
#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(_type, _name, _required)  \
314
 
    if (esxVI_##_type##_SerializeValue(item->_name, #_name, output,           \
315
 
                                       esxVI_Boolean_##_required) < 0) {      \
316
 
        return -1;                                                            \
317
 
    }
318
 
 
319
 
 
320
 
 
321
 
#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(_type, _name, _required)   \
322
 
    if (esxVI_##_type##_SerializeList(item->_name, #_name, output,            \
323
 
                                      esxVI_Boolean_##_required) < 0) {       \
 
368
/*
 
369
 * Macros for property handling to be used as part of other macros
 
370
 */
 
371
 
 
372
#define ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY(_type, _name)                   \
 
373
    if (esxVI_##_type##_DeepCopy(&(*dest)->_name, src->_name) < 0) {          \
 
374
        goto failure;                                                         \
 
375
    }
 
376
 
 
377
 
 
378
 
 
379
#define ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_LIST(_type, _name)              \
 
380
    if (esxVI_##_type##_DeepCopyList(&(*dest)->_name, src->_name) < 0) {      \
 
381
        goto failure;                                                         \
 
382
    }
 
383
 
 
384
 
 
385
 
 
386
#define ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_VALUE(_type, _name)             \
 
387
    if (esxVI_##_type##_DeepCopyValue(&(*dest)->_name, src->_name) < 0) {     \
 
388
        goto failure;                                                         \
 
389
    }
 
390
 
 
391
 
 
392
 
 
393
#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(_type, _name)                   \
 
394
    if (esxVI_##_type##_Serialize(item->_name, #_name, output) < 0) {         \
 
395
        return -1;                                                            \
 
396
    }
 
397
 
 
398
 
 
399
 
 
400
#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(_type, _name)             \
 
401
    if (esxVI_##_type##_SerializeValue(item->_name, #_name, output) < 0) {    \
 
402
        return -1;                                                            \
 
403
    }
 
404
 
 
405
 
 
406
 
 
407
#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(_type, _name)              \
 
408
    if (esxVI_##_type##_SerializeList(item->_name, #_name, output) < 0) {     \
324
409
        return -1;                                                            \
325
410
    }
326
411
 
337
422
 
338
423
 
339
424
 
 
425
#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_IGNORE(_name)                 \
 
426
    if (xmlStrEqual(childNode->name, BAD_CAST #_name)) {                      \
 
427
        continue;                                                             \
 
428
    }
 
429
 
 
430
 
 
431
 
340
432
#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(_type, _name)           \
341
433
    if (xmlStrEqual(childNode->name, BAD_CAST #_name)) {                      \
342
434
        if (esxVI_##_type##_DeserializeValue(childNode,                       \
349
441
 
350
442
 
351
443
 
352
 
#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(_type, _expected,    \
353
 
                                                        _name)                \
354
 
    if (xmlStrEqual(childNode->name, BAD_CAST #_name)) {                      \
355
 
        if (esxVI_##_type##_Deserialize(childNode, &(*ptrptr)->_name,         \
356
 
                                        _expected) < 0) {                     \
357
 
            goto failure;                                                     \
358
 
        }                                                                     \
359
 
                                                                              \
360
 
        continue;                                                             \
361
 
    }
362
 
 
363
 
 
364
 
 
365
 
#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(_name)                   \
366
 
    if (xmlStrEqual(childNode->name, BAD_CAST #_name)) {                      \
367
 
        continue;                                                             \
368
 
    }
369
 
 
370
 
 
371
 
 
372
444
#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(_type, _name)            \
373
445
    if (xmlStrEqual(childNode->name, BAD_CAST #_name)) {                      \
374
446
        esxVI_##_type *_name##Item = NULL;                                    \
391
463
/*
392
464
 * A required property must be != 0 (NULL for pointers, "undefined" == 0 for
393
465
 * enumeration values).
 
466
 *
 
467
 * To be used as part of ESX_VI__TEMPLATE__VALIDATE.
394
468
 */
395
 
#define ESX_VI__TEMPLATE__PROPERTY__REQUIRED(_name)                           \
396
 
    if ((*ptrptr)->_name == 0) {                                              \
 
469
#define ESX_VI__TEMPLATE__PROPERTY__REQUIRE(_name)                            \
 
470
    if (item->_name == 0) {                                                   \
397
471
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                                  \
398
 
                     "Missing required '%s' property", #_name);               \
399
 
        goto failure;                                                         \
 
472
                     "%s object is missing the required '%s' property",       \
 
473
                     type_name, #_name);                                      \
 
474
        return -1;                                                            \
400
475
    }
401
476
 
402
477
 
403
478
 
 
479
/*
 
480
 * Macros to implement enumerations
 
481
 */
 
482
 
404
483
#define ESX_VI__TEMPLATE__ENUMERATION__CAST_FROM_ANY_TYPE(_type)              \
405
484
    int                                                                       \
406
485
    esxVI_##_type##_CastFromAnyType(esxVI_AnyType *anyType,                   \
415
494
#define ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(_type)                       \
416
495
    int                                                                       \
417
496
    esxVI_##_type##_Serialize(esxVI_##_type value, const char *element,       \
418
 
                              virBufferPtr output, esxVI_Boolean required)    \
 
497
                              virBufferPtr output)                            \
419
498
    {                                                                         \
420
499
        return esxVI_Enumeration_Serialize(&_esxVI_##_type##_Enumeration,     \
421
 
                                           value, element, output, required); \
 
500
                                           value, element, output);           \
422
501
    }
423
502
 
424
503
 
433
512
 
434
513
 
435
514
 
 
515
/*
 
516
 * Macros to implement dynamic dispatched functions
 
517
 */
 
518
 
 
519
#define ESX_VI__TEMPLATE__DISPATCH(__type, _dispatch, _error_return)          \
 
520
    switch (item->_type) {                                                    \
 
521
      _dispatch                                                               \
 
522
                                                                              \
 
523
      case esxVI_Type_##__type:                                               \
 
524
        break;                                                                \
 
525
                                                                              \
 
526
      default:                                                                \
 
527
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                                  \
 
528
                     "Call to %s for unexpected type '%s'", __FUNCTION__,     \
 
529
                     esxVI_Type_ToString(item->_type));                       \
 
530
        return _error_return;                                                 \
 
531
    }
 
532
 
 
533
 
 
534
 
 
535
#define ESX_VI__TEMPLATE__DISPATCH__FREE(_type)                               \
 
536
    case esxVI_Type_##_type:                                                  \
 
537
      esxVI_##_type##_Free((esxVI_##_type **)ptrptr);                         \
 
538
      return;
 
539
 
 
540
 
 
541
 
 
542
#define ESX_VI__TEMPLATE__DISPATCH__DEEP_COPY(_type)                          \
 
543
    case esxVI_Type_##_type:                                                  \
 
544
      return esxVI_##_type##_DeepCopy((esxVI_##_type **)dst,                  \
 
545
                                      (esxVI_##_type *)src);
 
546
 
 
547
 
 
548
 
 
549
#define ESX_VI__TEMPLATE__DISPATCH__SERIALIZE(_type)                          \
 
550
    case esxVI_Type_##_type:                                                  \
 
551
      return esxVI_##_type##_Serialize((esxVI_##_type *)item, element,        \
 
552
                                       output);
 
553
 
 
554
 
 
555
 
 
556
#define ESX_VI__TEMPLATE__DYNAMIC_FREE(__type, _dispatch, _body)              \
 
557
    ESX_VI__TEMPLATE__FREE(__type,                                            \
 
558
      ESX_VI__TEMPLATE__DISPATCH(__type, _dispatch, /* nothing */)            \
 
559
      _body)
 
560
 
 
561
 
 
562
 
 
563
#define ESX_VI__TEMPLATE__DYNAMIC_CAST(__type, _accept)                       \
 
564
    esxVI_##__type *                                                          \
 
565
    esxVI_##__type##_DynamicCast(void *item)                                  \
 
566
    {                                                                         \
 
567
        if (item == NULL) {                                                   \
 
568
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",                        \
 
569
                         _("Invalid argument"));                              \
 
570
            return NULL;                                                      \
 
571
        }                                                                     \
 
572
                                                                              \
 
573
        _accept                                                               \
 
574
                                                                              \
 
575
        return NULL;                                                          \
 
576
    }
 
577
 
 
578
 
 
579
 
 
580
#define ESX_VI__TEMPLATE__DYNAMIC_CAST__ACCEPT(__type)                        \
 
581
    if (((esxVI_Object *)item)->_type == esxVI_Type_##__type) {               \
 
582
        return item;                                                          \
 
583
    }
 
584
 
 
585
 
 
586
 
 
587
#define ESX_VI__TEMPLATE__DYNAMIC_SERIALIZE(__type, _dispatch, _serialize)    \
 
588
    ESX_VI__TEMPLATE__SERIALIZE_EXTRA(__type,                                 \
 
589
      ESX_VI__TEMPLATE__DISPATCH(__type, _dispatch, -1),                      \
 
590
      _serialize)
 
591
 
 
592
 
 
593
 
436
594
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
437
595
 * XSI: Type
438
596
 */
439
597
 
440
598
const char *
441
 
esxVI_Type_Name(esxVI_Type type)
 
599
esxVI_Type_ToString(esxVI_Type type)
442
600
{
443
601
    switch (type) {
 
602
      default:
444
603
      case esxVI_Type_Undefined:
445
 
        return "undefined";
 
604
        return "<undefined>";
446
605
 
447
606
      case esxVI_Type_Boolean:
448
607
        return "xsd:boolean";
449
608
 
 
609
      case esxVI_Type_AnyType:
 
610
        return "xsd:anyType";
 
611
 
450
612
      case esxVI_Type_String:
451
613
        return "xsd:string";
452
614
 
459
621
      case esxVI_Type_Long:
460
622
        return "xsd:long";
461
623
 
 
624
      case esxVI_Type_DateTime:
 
625
        return "xsd:dateTime";
 
626
 
 
627
      case esxVI_Type_Fault:
 
628
        return "Fault";
 
629
 
 
630
      case esxVI_Type_ManagedObjectReference:
 
631
        return "ManagedObjectReference";
 
632
 
 
633
#include "esx_vi_types.generated.typetostring"
 
634
 
462
635
      case esxVI_Type_Other:
463
 
        return "other";
464
 
 
465
 
      default:
466
 
        return "unknown";
467
 
    }
468
 
}
469
 
 
 
636
        return "<other>";
 
637
    }
 
638
}
 
639
 
 
640
esxVI_Type
 
641
esxVI_Type_FromString(const char *type)
 
642
{
 
643
    if (type == NULL || STREQ(type, "<undefined>")) {
 
644
        return esxVI_Type_Undefined;
 
645
    } else if (STREQ(type, "xsd:boolean")) {
 
646
        return esxVI_Type_Boolean;
 
647
    } else if (STREQ(type, "xsd:anyType")) {
 
648
        return esxVI_Type_AnyType;
 
649
    } else if (STREQ(type, "xsd:string")) {
 
650
        return esxVI_Type_String;
 
651
    } else if (STREQ(type, "xsd:short")) {
 
652
        return esxVI_Type_Short;
 
653
    } else if (STREQ(type, "xsd:int")) {
 
654
        return esxVI_Type_Int;
 
655
    } else if (STREQ(type, "xsd:long")) {
 
656
        return esxVI_Type_Long;
 
657
    } else if (STREQ(type, "xsd:dateTime")) {
 
658
        return esxVI_Type_DateTime;
 
659
    } else if (STREQ(type, "Fault")) {
 
660
        return esxVI_Type_Fault;
 
661
    } else if (STREQ(type, "ManagedObjectReference")) {
 
662
        return esxVI_Type_ManagedObjectReference;
 
663
    }
 
664
 
 
665
#include "esx_vi_types.generated.typefromstring"
 
666
 
 
667
    else {
 
668
        return esxVI_Type_Other;
 
669
    }
 
670
}
470
671
 
471
672
 
472
673
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
474
675
 */
475
676
 
476
677
static const esxVI_Enumeration _esxVI_Boolean_Enumeration = {
477
 
    "xsd:boolean", {
 
678
    esxVI_Type_Boolean, {
478
679
        { "true", esxVI_Boolean_True },
479
680
        { "false", esxVI_Boolean_False },
480
681
        { NULL, -1 },
482
683
};
483
684
 
484
685
/* esxVI_Boolean_Serialize */
485
 
ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(Boolean);
 
686
ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(Boolean)
486
687
 
487
688
/* esxVI_Boolean_Deserialize */
488
 
ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(Boolean);
 
689
ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(Boolean)
489
690
 
490
691
 
491
692
 
494
695
 */
495
696
 
496
697
/* esxVI_AnyType_Alloc */
497
 
ESX_VI__TEMPLATE__ALLOC(AnyType);
 
698
ESX_VI__TEMPLATE__ALLOC(AnyType)
498
699
 
499
700
/* esxVI_AnyType_Free */
500
701
ESX_VI__TEMPLATE__FREE(AnyType,
501
702
{
502
 
    xmlFreeNode(item->_node);
 
703
    xmlFreeNode(item->node);
503
704
    VIR_FREE(item->other);
504
705
    VIR_FREE(item->value);
505
 
});
 
706
})
506
707
 
507
708
int
508
709
esxVI_AnyType_ExpectType(esxVI_AnyType *anyType, esxVI_Type type)
509
710
{
510
711
    if (anyType->type != type) {
511
712
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
512
 
                     "Expecting type '%s' but found '%s'",
513
 
                     esxVI_Type_Name(type),
 
713
                     _("Expecting type '%s' but found '%s'"),
 
714
                     esxVI_Type_ToString(type),
514
715
                     anyType->type != esxVI_Type_Other
515
 
                       ? esxVI_Type_Name(anyType->type)
 
716
                       ? esxVI_Type_ToString(anyType->type)
516
717
                       : anyType->other);
517
718
        return -1;
518
719
    }
524
725
esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
525
726
{
526
727
    if (dest == NULL || *dest != NULL) {
527
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
 
728
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
528
729
        return -1;
529
730
    }
530
731
 
536
737
        goto failure;
537
738
    }
538
739
 
539
 
    (*dest)->_node = xmlCopyNode(src->_node, 1);
 
740
    (*dest)->_type = src->_type;
 
741
    (*dest)->node = xmlCopyNode(src->node, 1);
540
742
 
541
 
    if ((*dest)->_node == NULL) {
542
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not copy an XML node");
 
743
    if ((*dest)->node == NULL) {
 
744
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
 
745
                     _("Could not copy an XML node"));
543
746
        goto failure;
544
747
    }
545
748
 
586
789
int
587
790
esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
588
791
{
589
 
    long long number;
 
792
    long long int number;
590
793
 
591
794
    if (anyType == NULL || *anyType != NULL) {
592
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
 
795
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
593
796
        return -1;
594
797
    }
595
798
 
597
800
        return -1;
598
801
    }
599
802
 
600
 
    (*anyType)->_node = xmlCopyNode(node, 1);
 
803
    (*anyType)->node = xmlCopyNode(node, 1);
601
804
 
602
 
    if ((*anyType)->_node == NULL) {
603
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not copy an XML node");
 
805
    if ((*anyType)->node == NULL) {
 
806
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
 
807
                     _("Could not copy an XML node"));
604
808
        goto failure;
605
809
    }
606
810
 
610
814
                 BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
611
815
 
612
816
    if ((*anyType)->other == NULL) {
 
817
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
 
818
                     _("AnyType is missing 'type' property"));
 
819
        goto failure;
 
820
    }
 
821
 
 
822
    (*anyType)->type = esxVI_Type_FromString((*anyType)->other);
 
823
 
 
824
    if ((*anyType)->type == esxVI_Type_Undefined) {
613
825
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
614
 
                     "AnyType is missing 'type' property");
 
826
                     _("Unknown value '%s' for AnyType 'type' property"),
 
827
                     (*anyType)->other);
615
828
        goto failure;
616
829
    }
617
830
 
627
840
        }
628
841
    }
629
842
 
630
 
    #define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max)           \
 
843
#define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max)               \
631
844
        do {                                                                  \
632
845
            if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) {  \
633
846
                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                          \
634
 
                             "Unknown value '%s' for "_xsdType,               \
635
 
                             (*anyType)->value);                              \
 
847
                             _("Unknown value '%s' for %s"),                  \
 
848
                             (*anyType)->value, _xsdType);                    \
636
849
                goto failure;                                                 \
637
850
            }                                                                 \
638
851
                                                                              \
639
852
            if (number < (_min) || number > (_max)) {                         \
640
853
                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                          \
641
 
                             "Value '%s' is out of "_xsdType" range",         \
642
 
                             (*anyType)->value);                              \
 
854
                             _("Value '%s' is out of %s range"),              \
 
855
                             (*anyType)->value, _xsdType);                    \
643
856
                goto failure;                                                 \
644
857
            }                                                                 \
645
858
                                                                              \
646
 
            (*anyType)->type = esxVI_Type_##_type;                            \
647
859
            (*anyType)->_name = number;                                       \
648
860
        } while (0)
649
861
 
650
 
    if (STREQ((*anyType)->other, "xsd:boolean")) {
651
 
        (*anyType)->type = esxVI_Type_Boolean;
652
 
 
 
862
    switch ((*anyType)->type) {
 
863
      case esxVI_Type_Boolean:
653
864
        if (STREQ((*anyType)->value, "true")) {
654
865
            (*anyType)->boolean = esxVI_Boolean_True;
655
866
        } else if (STREQ((*anyType)->value, "false")) {
656
867
            (*anyType)->boolean = esxVI_Boolean_False;
657
868
        } else {
658
869
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
659
 
                         "Unknown value '%s' for xsd:boolean",
 
870
                         _("Unknown value '%s' for xsd:boolean"),
660
871
                         (*anyType)->value);
661
872
            goto failure;
662
873
        }
663
 
    } else if (STREQ((*anyType)->other, "xsd:string")) {
664
 
        (*anyType)->type = esxVI_Type_String;
 
874
 
 
875
        break;
 
876
 
 
877
      case esxVI_Type_String:
665
878
        (*anyType)->string = (*anyType)->value;
666
 
    } else if (STREQ((*anyType)->other, "xsd:short")) {
 
879
        break;
 
880
 
 
881
      case esxVI_Type_Short:
667
882
        _DESERIALIZE_NUMBER(Short, "xsd:short", int16, INT16_MIN, INT16_MAX);
668
 
    } else if (STREQ((*anyType)->other, "xsd:int")) {
 
883
        break;
 
884
 
 
885
      case esxVI_Type_Int:
669
886
        _DESERIALIZE_NUMBER(Int, "xsd:int", int32, INT32_MIN, INT32_MAX);
670
 
    } else if (STREQ((*anyType)->other, "xsd:long")) {
 
887
        break;
 
888
 
 
889
      case esxVI_Type_Long:
671
890
        _DESERIALIZE_NUMBER(Long, "xsd:long", int64, INT64_MIN, INT64_MAX);
 
891
        break;
 
892
 
 
893
      default:
 
894
        break;
672
895
    }
673
896
 
674
 
    #undef _DESERIALIZE_NUMBER
 
897
#undef _DESERIALIZE_NUMBER
675
898
 
676
899
    return 0;
677
900
 
688
911
 */
689
912
 
690
913
/* esxVI_String_Alloc */
691
 
ESX_VI__TEMPLATE__ALLOC(String);
 
914
ESX_VI__TEMPLATE__ALLOC(String)
692
915
 
693
916
/* esxVI_String_Free */
694
917
ESX_VI__TEMPLATE__FREE(String,
696
919
    esxVI_String_Free(&item->_next);
697
920
 
698
921
    VIR_FREE(item->value);
699
 
});
 
922
})
 
923
 
 
924
/* esxVI_String_Validate */
 
925
ESX_VI__TEMPLATE__VALIDATE(String,
 
926
{
 
927
    ESX_VI__TEMPLATE__PROPERTY__REQUIRE(value)
 
928
})
700
929
 
701
930
/* esxVI_String_AppendToList */
702
 
ESX_VI__TEMPLATE__LIST__APPEND(String);
 
931
ESX_VI__TEMPLATE__LIST__APPEND(String)
703
932
 
704
933
int
705
934
esxVI_String_AppendValueToList(esxVI_String **stringList, const char *value)
756
985
    return -1;
757
986
}
758
987
 
759
 
int
760
 
esxVI_String_DeepCopy(esxVI_String **dest, esxVI_String *src)
 
988
/* esxVI_String_DeepCopy */
 
989
ESX_VI__TEMPLATE__DEEP_COPY(String,
761
990
{
762
 
    if (dest == NULL || *dest != NULL) {
763
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
764
 
        return -1;
765
 
    }
766
 
 
767
 
    if (src == NULL) {
768
 
        return 0;
769
 
    }
770
 
 
771
 
    if (esxVI_String_Alloc(dest) < 0 ||
772
 
        esxVI_String_DeepCopyValue(&(*dest)->value, src->value)) {
773
 
        goto failure;
774
 
    }
775
 
 
776
 
    return 0;
777
 
 
778
 
  failure:
779
 
    esxVI_String_Free(dest);
780
 
 
781
 
    return -1;
782
 
}
 
991
    ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_VALUE(String, value)
 
992
})
783
993
 
784
994
/* esxVI_String_DeepCopyList */
785
 
ESX_VI__TEMPLATE__LIST__DEEP_COPY(String);
 
995
ESX_VI__TEMPLATE__LIST__DEEP_COPY(String)
786
996
 
787
997
int
788
998
esxVI_String_DeepCopyValue(char **dest, const char *src)
789
999
{
790
1000
    if (dest == NULL || *dest != NULL) {
791
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
 
1001
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
792
1002
        return -1;
793
1003
    }
794
1004
 
808
1018
 
809
1019
int
810
1020
esxVI_String_Serialize(esxVI_String *string, const char *element,
811
 
                       virBufferPtr output, esxVI_Boolean required)
 
1021
                       virBufferPtr output)
812
1022
{
813
1023
    return esxVI_String_SerializeValue(string != NULL ? string->value : NULL,
814
 
                                       element, output, required);
 
1024
                                       element, output);
815
1025
}
816
1026
 
817
1027
/* esxVI_String_SerializeList */
818
 
ESX_VI__TEMPLATE__LIST__SERIALIZE(String);
 
1028
ESX_VI__TEMPLATE__LIST__SERIALIZE(String)
819
1029
 
820
1030
int
821
1031
esxVI_String_SerializeValue(const char *value, const char *element,
822
 
                            virBufferPtr output, esxVI_Boolean required)
 
1032
                            virBufferPtr output)
823
1033
{
824
1034
    if (element == NULL || output == NULL) {
825
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
 
1035
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
826
1036
        return -1;
827
1037
    }
828
1038
 
829
1039
    if (value == NULL) {
830
 
        return esxVI_CheckSerializationNecessity(element, required);
 
1040
        return 0;
831
1041
    }
832
1042
 
833
1043
    ESV_VI__XML_TAG__OPEN(output, element, "xsd:string");
839
1049
    return 0;
840
1050
}
841
1051
 
842
 
int
843
 
esxVI_String_Deserialize(xmlNodePtr node, esxVI_String **string)
 
1052
/* esxVI_String_Deserialize */
 
1053
ESX_VI__TEMPLATE__DESERIALIZE(String,
844
1054
{
845
 
    if (string == NULL || *string != NULL) {
846
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
847
 
        return -1;
848
 
    }
849
 
 
850
 
    if (esxVI_String_Alloc(string) < 0) {
851
 
        return -1;
852
 
    }
853
 
 
854
 
    (*string)->value =
855
 
      (char *)xmlNodeListGetString(node->doc, node->children, 1);
856
 
 
857
 
    if ((*string)->value == NULL) {
858
 
        (*string)->value = strdup("");
859
 
 
860
 
        if ((*string)->value == NULL) {
861
 
            virReportOOMError();
862
 
            goto failure;
863
 
        }
864
 
    }
865
 
 
866
 
    return 0;
867
 
 
868
 
  failure:
869
 
    esxVI_String_Free(string);
870
 
 
871
 
    return -1;
872
 
}
 
1055
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, value)
 
1056
})
873
1057
 
874
1058
/* esxVI_String_DeserializeList */
875
 
ESX_VI__TEMPLATE__LIST__DESERIALIZE(String);
 
1059
ESX_VI__TEMPLATE__LIST__DESERIALIZE(String)
876
1060
 
877
1061
int
878
1062
esxVI_String_DeserializeValue(xmlNodePtr node, char **value)
879
1063
{
880
1064
    if (value == NULL || *value != NULL) {
881
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
 
1065
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
882
1066
        return -1;
883
1067
    }
884
1068
 
903
1087
 */
904
1088
 
905
1089
/* esxVI_Int_Alloc */
906
 
ESX_VI__TEMPLATE__ALLOC(Int);
 
1090
ESX_VI__TEMPLATE__ALLOC(Int)
907
1091
 
908
1092
/* esxVI_Int_Free */
909
1093
ESX_VI__TEMPLATE__FREE(Int,
910
1094
{
911
1095
    esxVI_Int_Free(&item->_next);
912
 
});
 
1096
})
 
1097
 
 
1098
/* esxVI_Int_Validate */
 
1099
ESX_VI__TEMPLATE__VALIDATE(Int,
 
1100
{
 
1101
})
913
1102
 
914
1103
/* esxVI_Int_AppendToList */
915
 
ESX_VI__TEMPLATE__LIST__APPEND(Int);
 
1104
ESX_VI__TEMPLATE__LIST__APPEND(Int)
916
1105
 
917
 
int
918
 
esxVI_Int_DeepCopy(esxVI_Int **dest, esxVI_Int *src)
 
1106
/* esxVI_Int_DeepCopy */
 
1107
ESX_VI__TEMPLATE__DEEP_COPY(Int,
919
1108
{
920
 
    if (dest == NULL || *dest != NULL) {
921
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
922
 
        return -1;
923
 
    }
924
 
 
925
 
    if (src == NULL) {
926
 
        return 0;
927
 
    }
928
 
 
929
 
    if (esxVI_Int_Alloc(dest) < 0) {
930
 
        goto failure;
931
 
    }
932
 
 
933
1109
    (*dest)->value = src->value;
934
 
 
935
 
    return 0;
936
 
 
937
 
  failure:
938
 
    esxVI_Int_Free(dest);
939
 
 
940
 
    return -1;
941
 
}
 
1110
})
942
1111
 
943
1112
/* esxVI_Int_Serialize */
944
 
ESX_VI__TEMPLATE__SERIALIZE_EXTRA(Int, "xsd:int",
 
1113
ESX_VI__TEMPLATE__SERIALIZE(Int,
945
1114
{
946
1115
    virBufferVSprintf(output, "%d", (int)item->value);
947
 
});
 
1116
})
948
1117
 
949
1118
/* esxVI_Int_SerializeList */
950
 
ESX_VI__TEMPLATE__LIST__SERIALIZE(Int);
 
1119
ESX_VI__TEMPLATE__LIST__SERIALIZE(Int)
951
1120
 
952
1121
/* esxVI_Int_Deserialize */
953
 
ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(Int, "xsd:int", INT32_MIN, INT32_MAX);
 
1122
ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(Int, "xsd:int", INT32_MIN, INT32_MAX)
954
1123
 
955
1124
 
956
1125
 
959
1128
 */
960
1129
 
961
1130
/* esxVI_Long_Alloc */
962
 
ESX_VI__TEMPLATE__ALLOC(Long);
 
1131
ESX_VI__TEMPLATE__ALLOC(Long)
963
1132
 
964
1133
/* esxVI_Long_Free */
965
1134
ESX_VI__TEMPLATE__FREE(Long,
966
1135
{
967
1136
    esxVI_Long_Free(&item->_next);
968
 
});
 
1137
})
 
1138
 
 
1139
/* esxVI_Long_Validate */
 
1140
ESX_VI__TEMPLATE__VALIDATE(Long,
 
1141
{
 
1142
})
969
1143
 
970
1144
/* esxVI_Long_AppendToList */
971
 
ESX_VI__TEMPLATE__LIST__APPEND(Long);
 
1145
ESX_VI__TEMPLATE__LIST__APPEND(Long)
972
1146
 
973
1147
/* esxVI_Long_Serialize */
974
 
ESX_VI__TEMPLATE__SERIALIZE_EXTRA(Long, "xsd:long",
 
1148
ESX_VI__TEMPLATE__SERIALIZE(Long,
975
1149
{
976
1150
    virBufferVSprintf(output, "%lld", (long long int)item->value);
977
 
});
 
1151
})
978
1152
 
979
1153
/* esxVI_Long_SerializeList */
980
 
ESX_VI__TEMPLATE__LIST__SERIALIZE(Long);
 
1154
ESX_VI__TEMPLATE__LIST__SERIALIZE(Long)
981
1155
 
982
1156
/* esxVI_Long_Deserialize */
983
 
ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(Long, "xsd:long", INT64_MIN, INT64_MAX);
 
1157
ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(Long, "xsd:long", INT64_MIN, INT64_MAX)
984
1158
 
985
1159
 
986
1160
 
989
1163
 */
990
1164
 
991
1165
/* esxVI_DateTime_Alloc */
992
 
ESX_VI__TEMPLATE__ALLOC(DateTime);
 
1166
ESX_VI__TEMPLATE__ALLOC(DateTime)
993
1167
 
994
1168
/* esxVI_DateTime_Free */
995
1169
ESX_VI__TEMPLATE__FREE(DateTime,
996
1170
{
997
1171
    VIR_FREE(item->value);
998
 
});
 
1172
})
 
1173
 
 
1174
/* esxVI_DateTime_Validate */
 
1175
ESX_VI__TEMPLATE__VALIDATE(DateTime,
 
1176
{
 
1177
    ESX_VI__TEMPLATE__PROPERTY__REQUIRE(value);
 
1178
})
 
1179
 
 
1180
/* esxVI_DateTime_DeepCopy */
 
1181
ESX_VI__TEMPLATE__DEEP_COPY(DateTime,
 
1182
{
 
1183
    ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_VALUE(String, value)
 
1184
})
999
1185
 
1000
1186
/* esxVI_DateTime_Serialize */
1001
 
ESX_VI__TEMPLATE__SERIALIZE_EXTRA(DateTime, "xsd:dateTime",
 
1187
ESX_VI__TEMPLATE__SERIALIZE(DateTime,
1002
1188
{
1003
1189
    virBufferAdd(output, item->value, -1);
1004
 
});
 
1190
})
1005
1191
 
1006
1192
int
1007
1193
esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
1008
1194
{
1009
1195
    if (dateTime == NULL || *dateTime != NULL) {
1010
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
 
1196
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
1011
1197
        return -1;
1012
1198
    }
1013
1199
 
1019
1205
      (char *)xmlNodeListGetString(node->doc, node->children, 1);
1020
1206
 
1021
1207
    if ((*dateTime)->value == NULL) {
1022
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
1023
 
                     "XML node doesn't contain text, expecting an "
1024
 
                     "xsd:dateTime value");
 
1208
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
 
1209
                     _("XML node doesn't contain text, expecting an "
 
1210
                       "xsd:dateTime value"));
1025
1211
        goto failure;
1026
1212
    }
1027
1213
 
1033
1219
    return -1;
1034
1220
}
1035
1221
 
1036
 
 
1037
 
 
1038
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1039
 
 * VI Enum: ManagedEntityStatus
1040
 
 */
1041
 
 
1042
 
static const esxVI_Enumeration _esxVI_ManagedEntityStatus_Enumeration = {
1043
 
    "ManagedEntityStatus", {
1044
 
        { "gray", esxVI_ManagedEntityStatus_Gray },
1045
 
        { "green", esxVI_ManagedEntityStatus_Green },
1046
 
        { "yellow", esxVI_ManagedEntityStatus_Yellow },
1047
 
        { "red", esxVI_ManagedEntityStatus_Red },
1048
 
        { NULL, -1 },
1049
 
    },
1050
 
};
1051
 
 
1052
 
/* esxVI_ManagedEntityStatus_CastFromAnyType */
1053
 
ESX_VI__TEMPLATE__ENUMERATION__CAST_FROM_ANY_TYPE(ManagedEntityStatus);
1054
 
 
1055
 
 
1056
 
 
1057
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1058
 
 * VI Enum: ObjectUpdateKind
1059
 
 */
1060
 
 
1061
 
static const esxVI_Enumeration _esxVI_ObjectUpdateKind_Enumeration = {
1062
 
    "ObjectUpdateKind", {
1063
 
        { "enter", esxVI_ObjectUpdateKind_Enter },
1064
 
        { "leave", esxVI_ObjectUpdateKind_Leave },
1065
 
        { "modify", esxVI_ObjectUpdateKind_Modify },
1066
 
        { NULL, -1 },
1067
 
    },
1068
 
};
1069
 
 
1070
 
/* esxVI_ObjectUpdateKind_Deserialize */
1071
 
ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(ObjectUpdateKind);
1072
 
 
1073
 
 
1074
 
 
1075
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1076
 
 * VI Enum: PerfSummaryType
1077
 
 */
1078
 
 
1079
 
static const esxVI_Enumeration _esxVI_PerfSummaryType_Enumeration = {
1080
 
    "PerfSummaryType", {
1081
 
        { "average", esxVI_PerfSummaryType_Average },
1082
 
        { "latest", esxVI_PerfSummaryType_Latest },
1083
 
        { "maximum", esxVI_PerfSummaryType_Maximum },
1084
 
        { "minimum", esxVI_PerfSummaryType_Minimum },
1085
 
        { "none", esxVI_PerfSummaryType_None },
1086
 
        { "summation", esxVI_PerfSummaryType_Summation },
1087
 
        { NULL, -1 },
1088
 
    },
1089
 
};
1090
 
 
1091
 
/* esxVI_PerfSummaryType_Deserialize */
1092
 
ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(PerfSummaryType);
1093
 
 
1094
 
 
1095
 
 
1096
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1097
 
 * VI Enum: PerfStatsType
1098
 
 */
1099
 
 
1100
 
static const esxVI_Enumeration _esxVI_PerfStatsType_Enumeration = {
1101
 
    "PerfStatsType", {
1102
 
        { "absolute", esxVI_PerfStatsType_Absolute },
1103
 
        { "delta", esxVI_PerfStatsType_Delta },
1104
 
        { "rate", esxVI_PerfStatsType_Rate },
1105
 
        { NULL, -1 },
1106
 
    },
1107
 
};
1108
 
 
1109
 
/* esxVI_PerfStatsType_Deserialize */
1110
 
ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(PerfStatsType);
1111
 
 
1112
 
 
1113
 
 
1114
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1115
 
 * VI Enum: PropertyChangeOp
1116
 
 */
1117
 
 
1118
 
static const esxVI_Enumeration _esxVI_PropertyChangeOp_Enumeration = {
1119
 
    "PropertyChangeOp", {
1120
 
        { "add", esxVI_PropertyChangeOp_Add },
1121
 
        { "remove", esxVI_PropertyChangeOp_Remove },
1122
 
        { "assign", esxVI_PropertyChangeOp_Assign },
1123
 
        { "indirectRemove", esxVI_PropertyChangeOp_IndirectRemove },
1124
 
        { NULL, -1 },
1125
 
    },
1126
 
};
1127
 
 
1128
 
/* esxVI_PropertyChangeOp_Deserialize */
1129
 
ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(PropertyChangeOp);
1130
 
 
1131
 
 
1132
 
 
1133
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1134
 
 * VI Enum: SharesLevel
1135
 
 */
1136
 
 
1137
 
static const esxVI_Enumeration _esxVI_SharesLevel_Enumeration = {
1138
 
    "SharesLevel", {
1139
 
        { "custom", esxVI_SharesLevel_Custom },
1140
 
        { "high", esxVI_SharesLevel_High },
1141
 
        { "low", esxVI_SharesLevel_Low },
1142
 
        { "normal", esxVI_SharesLevel_Normal },
1143
 
        { NULL, -1 },
1144
 
    },
1145
 
};
1146
 
 
1147
 
/* esxVI_SharesLevel_Serialize */
1148
 
ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(SharesLevel);
1149
 
 
1150
 
/* esxVI_SharesLevel_Deserialize */
1151
 
ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(SharesLevel);
1152
 
 
1153
 
 
1154
 
 
1155
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1156
 
 * VI Enum: TaskInfoState
1157
 
 */
1158
 
 
1159
 
static const esxVI_Enumeration _esxVI_TaskInfoState_Enumeration = {
1160
 
    "TaskInfoState", {
1161
 
        { "error", esxVI_TaskInfoState_Error },
1162
 
        { "queued", esxVI_TaskInfoState_Queued },
1163
 
        { "running", esxVI_TaskInfoState_Running },
1164
 
        { "success", esxVI_TaskInfoState_Success },
1165
 
        { NULL, -1 },
1166
 
    },
1167
 
};
1168
 
 
1169
 
/* esxVI_TaskInfoState_CastFromAnyType */
1170
 
ESX_VI__TEMPLATE__ENUMERATION__CAST_FROM_ANY_TYPE(TaskInfoState);
1171
 
 
1172
 
/* esxVI_TaskInfoState_Deserialize */
1173
 
ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(TaskInfoState);
1174
 
 
1175
 
 
1176
 
 
1177
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1178
 
 * VI Enum: VirtualMachineMovePriority
1179
 
 */
1180
 
 
1181
 
static const esxVI_Enumeration _esxVI_VirtualMachineMovePriority_Enumeration = {
1182
 
    "VirtualMachineMovePriority", {
1183
 
        { "lowPriority", esxVI_VirtualMachineMovePriority_LowPriority },
1184
 
        { "highPriority", esxVI_VirtualMachineMovePriority_HighPriority },
1185
 
        { "defaultPriority", esxVI_VirtualMachineMovePriority_DefaultPriority },
1186
 
        { NULL, -1 },
1187
 
    },
1188
 
};
1189
 
 
1190
 
/* esxVI_VirtualMachineMovePriority_Serialize */
1191
 
ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(VirtualMachineMovePriority);
1192
 
 
1193
 
 
1194
 
 
1195
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1196
 
 * VI Enum: VirtualMachinePowerState
1197
 
 */
1198
 
 
1199
 
static const esxVI_Enumeration _esxVI_VirtualMachinePowerState_Enumeration = {
1200
 
    "VirtualMachinePowerState", {
1201
 
        { "poweredOff", esxVI_VirtualMachinePowerState_PoweredOff },
1202
 
        { "poweredOn", esxVI_VirtualMachinePowerState_PoweredOn },
1203
 
        { "suspended", esxVI_VirtualMachinePowerState_Suspended },
1204
 
        { NULL, -1 },
1205
 
    },
1206
 
};
1207
 
 
1208
 
/* esxVI_VirtualMachinePowerState_CastFromAnyType */
1209
 
ESX_VI__TEMPLATE__ENUMERATION__CAST_FROM_ANY_TYPE(VirtualMachinePowerState);
1210
 
 
1211
 
/* esxVI_VirtualMachinePowerState_Serialize */
1212
 
ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(VirtualMachinePowerState);
 
1222
int
 
1223
esxVI_DateTime_ConvertToCalendarTime(esxVI_DateTime *dateTime,
 
1224
                                     time_t *secondsSinceEpoch)
 
1225
{
 
1226
    char value[64] = "";
 
1227
    char *tmp;
 
1228
    struct tm tm;
 
1229
    int milliseconds;
 
1230
    char sign;
 
1231
    int tz_hours;
 
1232
    int tz_minutes;
 
1233
    int tz_offset = 0;
 
1234
 
 
1235
    if (dateTime == NULL || secondsSinceEpoch == NULL) {
 
1236
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
 
1237
        return -1;
 
1238
    }
 
1239
 
 
1240
    if (virStrcpyStatic(value, dateTime->value) == NULL) {
 
1241
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
 
1242
                     _("xsd:dateTime value '%s' too long for destination"),
 
1243
                     dateTime->value);
 
1244
        return -1;
 
1245
    }
 
1246
 
 
1247
    /*
 
1248
     * expected format: [-]CCYY-MM-DDTHH:MM:SS[.ssssss][((+|-)HH:MM|Z)]
 
1249
     * typical example: 2010-04-05T12:13:55.316789+02:00
 
1250
     *
 
1251
     * see http://www.w3.org/TR/xmlschema-2/#dateTime
 
1252
     *
 
1253
     * map negative years to 0, since the base for time_t is the year 1970.
 
1254
     */
 
1255
    if (*value == '-') {
 
1256
        *secondsSinceEpoch = 0;
 
1257
        return 0;
 
1258
    }
 
1259
 
 
1260
    tmp = strptime(value, "%Y-%m-%dT%H:%M:%S", &tm);
 
1261
 
 
1262
    if (tmp == NULL) {
 
1263
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
 
1264
                     _("xsd:dateTime value '%s' has unexpected format"),
 
1265
                     dateTime->value);
 
1266
        return -1;
 
1267
    }
 
1268
 
 
1269
    if (*tmp != '\0') {
 
1270
        /* skip .ssssss part if present */
 
1271
        if (*tmp == '.' &&
 
1272
            virStrToLong_i(tmp + 1, &tmp, 10, &milliseconds) < 0) {
 
1273
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
 
1274
                         _("xsd:dateTime value '%s' has unexpected format"),
 
1275
                         dateTime->value);
 
1276
            return -1;
 
1277
        }
 
1278
 
 
1279
        /* parse timezone offset if present. if missing assume UTC */
 
1280
        if (*tmp == '+' || *tmp == '-') {
 
1281
            sign = *tmp;
 
1282
 
 
1283
            if (virStrToLong_i(tmp + 1, &tmp, 10, &tz_hours) < 0 ||
 
1284
                *tmp != ':' ||
 
1285
                virStrToLong_i(tmp + 1, NULL, 10, &tz_minutes) < 0) {
 
1286
                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
 
1287
                             _("xsd:dateTime value '%s' has unexpected format"),
 
1288
                             dateTime->value);
 
1289
                return -1;
 
1290
            }
 
1291
 
 
1292
            tz_offset = tz_hours * 60 * 60 + tz_minutes * 60;
 
1293
 
 
1294
            if (sign == '-') {
 
1295
                tz_offset = -tz_offset;
 
1296
            }
 
1297
        } else if (STREQ(tmp, "Z")) {
 
1298
            /* Z refers to UTC. tz_offset is already initialized to zero */
 
1299
        } else {
 
1300
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
 
1301
                         _("xsd:dateTime value '%s' has unexpected format"),
 
1302
                         dateTime->value);
 
1303
            return -1;
 
1304
        }
 
1305
    }
 
1306
 
 
1307
    /*
 
1308
     * xsd:dateTime represents local time relative to the optional timezone
 
1309
     * given as offset. pretend the local time is in UTC and use timegm in
 
1310
     * order to avoid interference with the timezone to this computer.
 
1311
     * apply timezone correction afterwards, because it's simpler than
 
1312
     * handling all the possible over- and underflows when trying to apply
 
1313
     * it to the tm struct.
 
1314
     */
 
1315
    *secondsSinceEpoch = timegm(&tm) - tz_offset;
 
1316
 
 
1317
    return 0;
 
1318
}
1213
1319
 
1214
1320
 
1215
1321
 
1225
1331
{
1226
1332
    VIR_FREE(item->faultcode);
1227
1333
    VIR_FREE(item->faultstring);
1228
 
});
 
1334
})
 
1335
 
 
1336
/* esxVI_Fault_Validate */
 
1337
ESX_VI__TEMPLATE__VALIDATE(Fault,
 
1338
{
 
1339
    ESX_VI__TEMPLATE__PROPERTY__REQUIRE(faultcode);
 
1340
    ESX_VI__TEMPLATE__PROPERTY__REQUIRE(faultstring);
 
1341
})
1229
1342
 
1230
1343
/* esxVI_Fault_Deserialize */
1231
1344
ESX_VI__TEMPLATE__DESERIALIZE(Fault,
1232
1345
{
1233
1346
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, faultcode);
1234
1347
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, faultstring);
1235
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(detail); /* FIXME */
1236
 
},
1237
 
{
1238
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(faultcode);
1239
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(faultstring);
1240
 
});
 
1348
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_IGNORE(detail); /* FIXME */
 
1349
})
1241
1350
 
1242
1351
 
1243
1352
 
1246
1355
 */
1247
1356
 
1248
1357
/* esxVI_ManagedObjectReference_Alloc */
1249
 
ESX_VI__TEMPLATE__ALLOC(ManagedObjectReference);
 
1358
ESX_VI__TEMPLATE__ALLOC(ManagedObjectReference)
1250
1359
 
1251
1360
/* esxVI_ManagedObjectReference_Free */
1252
1361
ESX_VI__TEMPLATE__FREE(ManagedObjectReference,
1255
1364
 
1256
1365
    VIR_FREE(item->type);
1257
1366
    VIR_FREE(item->value);
1258
 
});
 
1367
})
1259
1368
 
1260
 
int
1261
 
esxVI_ManagedObjectReference_DeepCopy(esxVI_ManagedObjectReference **dest,
1262
 
                                      esxVI_ManagedObjectReference *src)
 
1369
/* esxVI_ManagedObjectReference_DeepCopy */
 
1370
ESX_VI__TEMPLATE__DEEP_COPY(ManagedObjectReference,
1263
1371
{
1264
 
    if (dest == NULL || *dest != NULL) {
1265
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
1266
 
        return -1;
1267
 
    }
1268
 
 
1269
 
    if (src == NULL) {
1270
 
        return 0;
1271
 
    }
1272
 
 
1273
 
    if (esxVI_ManagedObjectReference_Alloc(dest) < 0 ||
1274
 
        esxVI_String_DeepCopyValue(&(*dest)->type, src->type) < 0 ||
1275
 
        esxVI_String_DeepCopyValue(&(*dest)->value, src->value) < 0) {
1276
 
        goto failure;
1277
 
    }
1278
 
 
1279
 
    return 0;
1280
 
 
1281
 
  failure:
1282
 
    esxVI_ManagedObjectReference_Free(dest);
1283
 
 
1284
 
    return -1;
1285
 
}
 
1372
    ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_VALUE(String, type)
 
1373
    ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_VALUE(String, value)
 
1374
})
1286
1375
 
1287
1376
/* esxVI_ManagedObjectReference_AppendToList */
1288
 
ESX_VI__TEMPLATE__LIST__APPEND(ManagedObjectReference);
1289
 
 
1290
 
int
1291
 
esxVI_ManagedObjectReference_CastFromAnyType
1292
 
  (esxVI_AnyType *anyType,
1293
 
   esxVI_ManagedObjectReference **managedObjectReference,
1294
 
   const char *expectedType)
1295
 
{
1296
 
    if (anyType == NULL || managedObjectReference == NULL ||
1297
 
        *managedObjectReference != NULL) {
1298
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
1299
 
        return -1;
1300
 
    }
1301
 
 
1302
 
    if (STRNEQ(anyType->other, "ManagedObjectReference")) {
1303
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
1304
 
                     "Expecting type 'ManagedObjectReference' but found '%s'",
1305
 
                     anyType->other);
1306
 
        return -1;
1307
 
    }
1308
 
 
1309
 
    return esxVI_ManagedObjectReference_Deserialize(anyType->_node,
1310
 
                                                    managedObjectReference,
1311
 
                                                    expectedType);
1312
 
}
1313
 
 
1314
 
int
1315
 
esxVI_ManagedObjectReference_CastListFromAnyType
1316
 
  (esxVI_AnyType *anyType,
1317
 
   esxVI_ManagedObjectReference **managedObjectReferenceList,
1318
 
   const char *expectedType)
1319
 
{
1320
 
    int result = 0;
1321
 
    xmlNodePtr childNode = NULL;
1322
 
    esxVI_AnyType *childAnyType = NULL;
1323
 
    esxVI_ManagedObjectReference *managedObjectReference = NULL;
1324
 
 
1325
 
    if (managedObjectReferenceList == NULL ||
1326
 
        *managedObjectReferenceList != NULL) {
1327
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
1328
 
        goto failure;
1329
 
    }
1330
 
 
1331
 
    if (anyType == NULL) {
1332
 
        return 0;
1333
 
    }
1334
 
 
1335
 
    if (STRNEQ(anyType->other, "ArrayOfManagedObjectReference")) {
1336
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
1337
 
                     "Expecting type to be 'ArrayOfManagedObjectReference' "
1338
 
                     "but found '%s'", anyType->other);
1339
 
        goto failure;
1340
 
    }
1341
 
 
1342
 
    for (childNode = anyType->_node->children; childNode != NULL;
1343
 
         childNode = childNode->next) {
1344
 
        if (childNode->type != XML_ELEMENT_NODE) {
1345
 
            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
1346
 
                         "Wrong XML element type %d", childNode->type);
1347
 
            goto failure;
1348
 
        }
1349
 
 
1350
 
        esxVI_AnyType_Free(&childAnyType);
1351
 
 
1352
 
        if (esxVI_AnyType_Deserialize(childNode, &childAnyType) < 0) {
1353
 
            goto failure;
1354
 
        }
1355
 
 
1356
 
        managedObjectReference = NULL;
1357
 
 
1358
 
        if (esxVI_ManagedObjectReference_CastFromAnyType
1359
 
              (childAnyType, &managedObjectReference, expectedType) < 0) {
1360
 
            goto failure;
1361
 
        }
1362
 
 
1363
 
        if (esxVI_ManagedObjectReference_AppendToList
1364
 
              (managedObjectReferenceList, managedObjectReference) < 0) {
1365
 
            goto failure;
1366
 
        }
1367
 
    }
1368
 
 
1369
 
 
1370
 
  cleanup:
1371
 
    esxVI_AnyType_Free(&childAnyType);
1372
 
 
1373
 
    return result;
1374
 
 
1375
 
  failure:
1376
 
    esxVI_ManagedObjectReference_Free(managedObjectReferenceList);
1377
 
 
1378
 
    result = -1;
1379
 
 
1380
 
    goto cleanup;
1381
 
}
 
1377
ESX_VI__TEMPLATE__LIST__APPEND(ManagedObjectReference)
 
1378
 
 
1379
/* esxVI_ManagedObjectReference_CastFromAnyType */
 
1380
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(ManagedObjectReference)
 
1381
 
 
1382
/* esxVI_ManagedObjectReference_CastListFromAnyType */
 
1383
ESX_VI__TEMPLATE__LIST__CAST_FROM_ANY_TYPE(ManagedObjectReference)
1382
1384
 
1383
1385
int
1384
1386
esxVI_ManagedObjectReference_Serialize
1385
1387
  (esxVI_ManagedObjectReference *managedObjectReference,
1386
 
   const char *element, virBufferPtr output, esxVI_Boolean required)
 
1388
   const char *element, virBufferPtr output)
1387
1389
{
1388
1390
    if (element == NULL || output == NULL) {
1389
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
 
1391
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
1390
1392
        return -1;
1391
1393
    }
1392
1394
 
1393
1395
    if (managedObjectReference == NULL) {
1394
 
        return esxVI_CheckSerializationNecessity(element, required);
 
1396
        return 0;
1395
1397
    }
1396
1398
 
1397
1399
    virBufferAddLit(output, "<");
1409
1411
}
1410
1412
 
1411
1413
/* esxVI_ManagedObjectReference_SerializeList */
1412
 
ESX_VI__TEMPLATE__LIST__SERIALIZE(ManagedObjectReference);
 
1414
ESX_VI__TEMPLATE__LIST__SERIALIZE(ManagedObjectReference)
1413
1415
 
1414
1416
int
1415
1417
esxVI_ManagedObjectReference_Deserialize
1416
 
  (xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference,
1417
 
   const char *expectedType)
 
1418
  (xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference)
1418
1419
{
1419
1420
    if (managedObjectReference == NULL || *managedObjectReference != NULL) {
1420
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
 
1421
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
1421
1422
        return -1;
1422
1423
    }
1423
1424
 
1429
1430
      (char *)xmlGetNoNsProp(node, BAD_CAST "type");
1430
1431
 
1431
1432
    if ((*managedObjectReference)->type == NULL) {
1432
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
1433
 
                     "ManagedObjectReference is missing 'type' property");
1434
 
        goto failure;
1435
 
    }
1436
 
 
1437
 
    if (expectedType != NULL &&
1438
 
        STRNEQ(expectedType, (*managedObjectReference)->type)) {
1439
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
1440
 
                     "Expected type '%s' but found '%s'", expectedType,
1441
 
                     (*managedObjectReference)->type);
 
1433
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
 
1434
                     _("ManagedObjectReference is missing 'type' property"));
1442
1435
        goto failure;
1443
1436
    }
1444
1437
 
1457
1450
 
1458
1451
 
1459
1452
 
1460
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1461
 
 * VI Type: DynamicProperty
1462
 
 */
1463
 
 
1464
 
/* esxVI_DynamicProperty_Alloc */
1465
 
ESX_VI__TEMPLATE__ALLOC(DynamicProperty);
1466
 
 
1467
 
/* esxVI_DynamicProperty_Free */
1468
 
ESX_VI__TEMPLATE__FREE(DynamicProperty,
1469
 
{
1470
 
    esxVI_DynamicProperty_Free(&item->_next);
1471
 
 
1472
 
    VIR_FREE(item->name);
1473
 
    esxVI_AnyType_Free(&item->val);
1474
 
});
1475
 
 
1476
 
int
1477
 
esxVI_DynamicProperty_DeepCopy(esxVI_DynamicProperty **dest,
1478
 
                               esxVI_DynamicProperty *src)
1479
 
{
1480
 
    if (dest == NULL || *dest != NULL) {
1481
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
1482
 
        return -1;
1483
 
    }
1484
 
 
1485
 
    if (src == NULL) {
1486
 
        return 0;
1487
 
    }
1488
 
 
1489
 
    if (esxVI_DynamicProperty_Alloc(dest) < 0 ||
1490
 
        esxVI_String_DeepCopyValue(&(*dest)->name, src->name) < 0 ||
1491
 
        esxVI_AnyType_DeepCopy(&(*dest)->val, src->val) < 0) {
1492
 
        goto failure;
1493
 
    }
1494
 
 
1495
 
    return 0;
1496
 
 
1497
 
  failure:
1498
 
    esxVI_DynamicProperty_Free(dest);
1499
 
 
1500
 
    return -1;
1501
 
}
1502
 
 
1503
 
/* esxVI_DynamicProperty_DeepCopyList */
1504
 
ESX_VI__TEMPLATE__LIST__DEEP_COPY(DynamicProperty);
1505
 
 
1506
 
/* esxVI_DynamicProperty_AppendToList */
1507
 
ESX_VI__TEMPLATE__LIST__APPEND(DynamicProperty);
1508
 
 
1509
 
/* esxVI_DynamicProperty_Deserialize */
1510
 
ESX_VI__TEMPLATE__DESERIALIZE(DynamicProperty,
1511
 
{
1512
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, name);
1513
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(AnyType, val);
1514
 
},
1515
 
{
1516
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(name);
1517
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(val);
1518
 
});
1519
 
 
1520
 
/* esxVI_DynamicProperty_DeserializeList */
1521
 
ESX_VI__TEMPLATE__LIST__DESERIALIZE(DynamicProperty);
1522
 
 
1523
 
 
1524
 
 
1525
 
 
1526
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1527
 
 * VI Type: HostCpuIdInfo
1528
 
 */
1529
 
 
1530
 
/* esxVI_HostCpuIdInfo_Alloc */
1531
 
ESX_VI__TEMPLATE__ALLOC(HostCpuIdInfo);
1532
 
 
1533
 
/* esxVI_HostCpuIdInfo_Free */
1534
 
ESX_VI__TEMPLATE__FREE(HostCpuIdInfo,
1535
 
{
1536
 
    esxVI_HostCpuIdInfo_Free(&item->_next);
1537
 
 
1538
 
    esxVI_Int_Free(&item->level);
1539
 
    VIR_FREE(item->vendor);
1540
 
    VIR_FREE(item->eax);
1541
 
    VIR_FREE(item->ebx);
1542
 
    VIR_FREE(item->ecx);
1543
 
    VIR_FREE(item->edx);
1544
 
});
1545
 
 
1546
 
/* esxVI_HostCpuIdInfo_CastFromAnyType */
1547
 
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(HostCpuIdInfo);
1548
 
 
1549
 
/* esxVI_HostCpuIdInfo_CastListFromAnyType */
1550
 
ESX_VI__TEMPLATE__LIST__CAST_FROM_ANY_TYPE(HostCpuIdInfo);
1551
 
 
1552
 
/* esxVI_HostCpuIdInfo_Deserialize */
1553
 
ESX_VI__TEMPLATE__DESERIALIZE(HostCpuIdInfo,
1554
 
{
1555
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, level);
1556
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, vendor);
1557
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, eax);
1558
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, ebx);
1559
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, ecx);
1560
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, edx);
1561
 
},
1562
 
{
1563
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(level);
1564
 
});
1565
 
 
1566
 
/* esxVI_HostCpuIdInfo_DeserializeList */
1567
 
ESX_VI__TEMPLATE__LIST__DESERIALIZE(HostCpuIdInfo);
1568
 
 
1569
 
 
1570
 
 
1571
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1572
 
 * VI Type: SelectionSpec
1573
 
 */
1574
 
 
1575
 
/* esxVI_SelectionSpec_Alloc */
1576
 
ESX_VI__TEMPLATE__ALLOC(SelectionSpec);
1577
 
 
1578
 
void
1579
 
esxVI_SelectionSpec_Free(esxVI_SelectionSpec **selectionSpec)
1580
 
{
1581
 
    esxVI_SelectionSpec *local = NULL;
1582
 
 
1583
 
    if (selectionSpec == NULL || *selectionSpec == NULL) {
1584
 
        return;
1585
 
    }
1586
 
 
1587
 
    esxVI_SelectionSpec_Free(&(*selectionSpec)->_next);
1588
 
 
1589
 
    if ((*selectionSpec)->_super != NULL) {
1590
 
        /*
1591
 
         * Explicitly set this pointer to NULL here, otherwise this is will
1592
 
         * result in a dangling pointer. The actual memory of this object is
1593
 
         * freed by a call from the esxVI_TraversalSpec_Free function to the
1594
 
         * esxVI_SelectionSpec_Free function with the base pointer.
1595
 
         *
1596
 
         * Use a local copy of the pointer and set the reference to NULL,
1597
 
         * otherwise Valgrind complains about invalid writes.
1598
 
         */
1599
 
        local = *selectionSpec;
1600
 
        *selectionSpec = NULL;
1601
 
 
1602
 
        esxVI_TraversalSpec_Free(&local->_super);
1603
 
    } else {
1604
 
        VIR_FREE((*selectionSpec)->name);
1605
 
 
1606
 
        VIR_FREE(*selectionSpec);
1607
 
    }
1608
 
}
1609
 
 
1610
 
/* esxVI_SelectionSpec_AppendToList */
1611
 
ESX_VI__TEMPLATE__LIST__APPEND(SelectionSpec);
1612
 
 
1613
 
int
1614
 
esxVI_SelectionSpec_Serialize(esxVI_SelectionSpec *selectionSpec,
1615
 
                              const char *element, virBufferPtr output,
1616
 
                              esxVI_Boolean required)
1617
 
{
1618
 
    if (element == NULL || output == NULL) {
1619
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
1620
 
        return -1;
1621
 
    }
1622
 
 
1623
 
    if (selectionSpec == NULL) {
1624
 
        return esxVI_CheckSerializationNecessity(element, required);
1625
 
    }
1626
 
 
1627
 
    if (selectionSpec->_super != NULL) {
1628
 
        return esxVI_TraversalSpec_Serialize(selectionSpec->_super, element,
1629
 
                                             output, required);
1630
 
    }
1631
 
 
1632
 
    ESV_VI__XML_TAG__OPEN(output, element, "SelectionSpec");
1633
 
 
1634
 
    if (esxVI_String_SerializeValue(selectionSpec->name, "name", output,
1635
 
                                    esxVI_Boolean_False) < 0) {
1636
 
        return -1;
1637
 
    }
1638
 
 
1639
 
    ESV_VI__XML_TAG__CLOSE(output, element);
1640
 
 
1641
 
    return 0;
1642
 
}
1643
 
 
1644
 
/* esxVI_SelectionSpec_SerializeList */
1645
 
ESX_VI__TEMPLATE__LIST__SERIALIZE(SelectionSpec);
1646
 
 
1647
 
 
1648
 
 
1649
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1650
 
 * VI Type: TraversalSpec extends SelectionSpec
1651
 
 */
1652
 
 
1653
 
int
1654
 
esxVI_TraversalSpec_Alloc(esxVI_TraversalSpec **traversalSpec)
1655
 
{
1656
 
    if (esxVI_Alloc((void **)traversalSpec, sizeof(esxVI_TraversalSpec)) < 0) {
1657
 
        return -1;
1658
 
    }
1659
 
 
1660
 
    if (esxVI_SelectionSpec_Alloc(&(*traversalSpec)->_base) < 0) {
1661
 
        esxVI_TraversalSpec_Free(traversalSpec);
1662
 
        return -1;
1663
 
    }
1664
 
 
1665
 
    (*traversalSpec)->_base->_super = *traversalSpec;
1666
 
 
1667
 
    return 0;
1668
 
}
1669
 
 
1670
 
void
1671
 
esxVI_TraversalSpec_Free(esxVI_TraversalSpec **traversalSpec)
1672
 
{
1673
 
    esxVI_TraversalSpec *local = NULL;
1674
 
 
1675
 
    if (traversalSpec == NULL || *traversalSpec == NULL) {
1676
 
        return;
1677
 
    }
1678
 
 
1679
 
    /*
1680
 
     * Need to store the traversalSpec pointer in a local variable here,
1681
 
     * because it is possible that the traversalSpec pointer and the _super
1682
 
     * pointer represent the same location in memory, e.g. if
1683
 
     * esxVI_SelectionSpec_Free calls esxVI_TraversalSpec_Free with the _super
1684
 
     * pointer as argument. Setting the _super pointer to NULL sets the
1685
 
     * traversalSpec pointer also to NULL, because we're working on a reference
1686
 
     * to this pointer here.
1687
 
     *
1688
 
     * Also use a local copy of the pointer and set the reference to NULL,
1689
 
     * otherwise Valgrind complains about invalid writes.
1690
 
     */
1691
 
    local = *traversalSpec;
1692
 
    *traversalSpec = NULL;
1693
 
 
1694
 
    /*
1695
 
     * Setting the _super pointer to NULL here is important, otherwise
1696
 
     * esxVI_SelectionSpec_Free would call esxVI_TraversalSpec_Free again,
1697
 
     * resulting in both functions calling each other trying to free the
1698
 
     * _base/_super object until a stackoverflow occurs.
1699
 
     */
1700
 
    local->_base->_super = NULL;
1701
 
 
1702
 
    esxVI_SelectionSpec_Free(&local->_base);
1703
 
    VIR_FREE(local->type);
1704
 
    VIR_FREE(local->path);
1705
 
    esxVI_SelectionSpec_Free(&local->selectSet);
1706
 
 
1707
 
    VIR_FREE(local);
1708
 
}
1709
 
 
1710
 
/* esxVI_TraversalSpec_Serialize */
1711
 
ESX_VI__TEMPLATE__SERIALIZE(TraversalSpec,
1712
 
{
1713
 
    if (esxVI_String_SerializeValue(item->_base->name, "name", output,
1714
 
                                    esxVI_Boolean_False) < 0) {
1715
 
        return -1;
1716
 
    }
1717
 
 
1718
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, type, True);
1719
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, path, True);
1720
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Boolean, skip, False);
1721
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(SelectionSpec, selectSet, False);
1722
 
});
1723
 
 
1724
 
 
1725
 
 
1726
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1727
 
 * VI Type: ObjectSpec
1728
 
 */
1729
 
 
1730
 
/* esxVI_ObjectSpec_Alloc */
1731
 
ESX_VI__TEMPLATE__ALLOC(ObjectSpec);
1732
 
 
1733
 
/* esxVI_ObjectSpec_Free */
1734
 
ESX_VI__TEMPLATE__FREE(ObjectSpec,
1735
 
{
1736
 
    esxVI_ObjectSpec_Free(&item->_next);
1737
 
 
1738
 
    esxVI_ManagedObjectReference_Free(&item->obj);
1739
 
    esxVI_SelectionSpec_Free(&item->selectSet);
1740
 
});
1741
 
 
1742
 
/* esxVI_ObjectSpec_AppendToList */
1743
 
ESX_VI__TEMPLATE__LIST__APPEND(ObjectSpec);
1744
 
 
1745
 
/* esxVI_ObjectSpec_Serialize */
1746
 
ESX_VI__TEMPLATE__SERIALIZE(ObjectSpec,
1747
 
{
1748
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(ManagedObjectReference, obj, True);
1749
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Boolean, skip, False);
1750
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(SelectionSpec, selectSet, False);
1751
 
});
1752
 
 
1753
 
/* esxVI_ObjectSpec_SerializeList */
1754
 
ESX_VI__TEMPLATE__LIST__SERIALIZE(ObjectSpec);
1755
 
 
1756
 
 
1757
 
 
1758
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1759
 
 * VI Type: PropertyChange
1760
 
 */
1761
 
 
1762
 
/* esxVI_PropertyChange_Alloc */
1763
 
ESX_VI__TEMPLATE__ALLOC(PropertyChange);
1764
 
 
1765
 
/* esxVI_PropertyChange_Free */
1766
 
ESX_VI__TEMPLATE__FREE(PropertyChange,
1767
 
{
1768
 
    esxVI_PropertyChange_Free(&item->_next);
1769
 
 
1770
 
    VIR_FREE(item->name);
1771
 
    esxVI_AnyType_Free(&item->val);
1772
 
});
1773
 
 
1774
 
/* esxVI_PropertyChange_AppendToList */
1775
 
ESX_VI__TEMPLATE__LIST__APPEND(PropertyChange);
1776
 
 
1777
 
/* esxVI_PropertyChange_Deserialize */
1778
 
ESX_VI__TEMPLATE__DESERIALIZE(PropertyChange,
1779
 
{
1780
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, name);
1781
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(PropertyChangeOp, op);
1782
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(AnyType, val);
1783
 
},
1784
 
{
1785
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(name);
1786
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(op);
1787
 
});
1788
 
 
1789
 
/* esxVI_PropertyChange_DeserializeList */
1790
 
ESX_VI__TEMPLATE__LIST__DESERIALIZE(PropertyChange);
1791
 
 
1792
 
 
1793
 
 
1794
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1795
 
 * VI Type: PropertySpec
1796
 
 */
1797
 
 
1798
 
/* esxVI_PropertySpec_Alloc */
1799
 
ESX_VI__TEMPLATE__ALLOC(PropertySpec);
1800
 
 
1801
 
/* esxVI_PropertySpec_Free */
1802
 
ESX_VI__TEMPLATE__FREE(PropertySpec,
1803
 
{
1804
 
    esxVI_PropertySpec_Free(&item->_next);
1805
 
 
1806
 
    VIR_FREE(item->type);
1807
 
    esxVI_String_Free(&item->pathSet);
1808
 
});
1809
 
 
1810
 
/* esxVI_PropertySpec_AppendToList */
1811
 
ESX_VI__TEMPLATE__LIST__APPEND(PropertySpec);
1812
 
 
1813
 
/* esxVI_PropertySpec_Serialize */
1814
 
ESX_VI__TEMPLATE__SERIALIZE(PropertySpec,
1815
 
{
1816
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, type, True);
1817
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Boolean, all, False);
1818
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(String, pathSet, False);
1819
 
});
1820
 
 
1821
 
/* esxVI_PropertySpec_SerializeList */
1822
 
ESX_VI__TEMPLATE__LIST__SERIALIZE(PropertySpec);
1823
 
 
1824
 
 
1825
 
 
1826
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1827
 
 * VI Type: PropertyFilterSpec
1828
 
 */
1829
 
 
1830
 
/* esxVI_PropertyFilterSpec_Alloc */
1831
 
ESX_VI__TEMPLATE__ALLOC(PropertyFilterSpec);
1832
 
 
1833
 
/* esxVI_PropertyFilterSpec_Free */
1834
 
ESX_VI__TEMPLATE__FREE(PropertyFilterSpec,
1835
 
{
1836
 
    esxVI_PropertyFilterSpec_Free(&item->_next);
1837
 
 
1838
 
    esxVI_PropertySpec_Free(&item->propSet);
1839
 
    esxVI_ObjectSpec_Free(&item->objectSet);
1840
 
});
1841
 
 
1842
 
/* esxVI_PropertyFilterSpec_AppendToList */
1843
 
ESX_VI__TEMPLATE__LIST__APPEND(PropertyFilterSpec);
1844
 
 
1845
 
/* esxVI_PropertyFilterSpec_Serialize */
1846
 
ESX_VI__TEMPLATE__SERIALIZE(PropertyFilterSpec,
1847
 
{
1848
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(PropertySpec, propSet, True);
1849
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(ObjectSpec, objectSet, True);
1850
 
});
1851
 
 
1852
 
/* esxVI_PropertyFilterSpec_SerializeList */
1853
 
ESX_VI__TEMPLATE__LIST__SERIALIZE(PropertyFilterSpec);
1854
 
 
1855
 
 
1856
 
 
1857
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1858
 
 * VI Type: ObjectContent
1859
 
 */
1860
 
 
1861
 
/* esxVI_ObjectContent_Alloc */
1862
 
ESX_VI__TEMPLATE__ALLOC(ObjectContent);
1863
 
 
1864
 
/* esxVI_ObjectContent_Free */
1865
 
ESX_VI__TEMPLATE__FREE(ObjectContent,
1866
 
{
1867
 
    esxVI_ObjectContent_Free(&item->_next);
1868
 
 
1869
 
    esxVI_ManagedObjectReference_Free(&item->obj);
1870
 
    esxVI_DynamicProperty_Free(&item->propSet);
1871
 
    /*esxVI_MissingProperty_Free(&item->missingSet);*//* FIXME */
1872
 
});
1873
 
 
1874
 
/* esxVI_ObjectContent_AppendToList */
1875
 
ESX_VI__TEMPLATE__LIST__APPEND(ObjectContent);
1876
 
 
1877
 
int
1878
 
esxVI_ObjectContent_DeepCopy(esxVI_ObjectContent **dest,
1879
 
                             esxVI_ObjectContent *src)
1880
 
{
1881
 
    if (dest == NULL || *dest != NULL) {
1882
 
        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
1883
 
        return -1;
1884
 
    }
1885
 
 
1886
 
    if (src == NULL) {
1887
 
        return 0;
1888
 
    }
1889
 
 
1890
 
    if (esxVI_ObjectContent_Alloc(dest) < 0 ||
1891
 
        esxVI_ManagedObjectReference_DeepCopy(&(*dest)->obj, src->obj) < 0 ||
1892
 
        esxVI_DynamicProperty_DeepCopyList(&(*dest)->propSet,
1893
 
                                           src->propSet) < 0) {
1894
 
        goto failure;
1895
 
    }
1896
 
 
1897
 
#if 0 /* FIXME */
1898
 
    if (esxVI_MissingProperty_DeepCopyList(&(*dest)->missingSet,
1899
 
                                           src->missingSet) < 0) {
1900
 
        goto failure;
1901
 
    }
1902
 
#endif
1903
 
 
1904
 
    return 0;
1905
 
 
1906
 
  failure:
1907
 
    esxVI_ObjectContent_Free(dest);
1908
 
 
1909
 
    return -1;
1910
 
}
1911
 
 
1912
 
/* esxVI_ObjectContent_Deserialize */
1913
 
ESX_VI__TEMPLATE__DESERIALIZE(ObjectContent,
1914
 
{
1915
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
1916
 
                                                     NULL, obj);
1917
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(DynamicProperty, propSet);
1918
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(missingSet); /* FIXME */
1919
 
},
1920
 
{
1921
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(obj);
1922
 
});
1923
 
 
1924
 
/* esxVI_ObjectContent_DeserializeList */
1925
 
ESX_VI__TEMPLATE__LIST__DESERIALIZE(ObjectContent);
1926
 
 
1927
 
 
1928
 
 
1929
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1930
 
 * VI Type: ObjectUpdate
1931
 
 */
1932
 
 
1933
 
/* esxVI_ObjectUpdate_Alloc */
1934
 
ESX_VI__TEMPLATE__ALLOC(ObjectUpdate);
1935
 
 
1936
 
/* esxVI_ObjectUpdate_Free */
1937
 
ESX_VI__TEMPLATE__FREE(ObjectUpdate,
1938
 
{
1939
 
    esxVI_ObjectUpdate_Free(&item->_next);
1940
 
 
1941
 
    esxVI_ManagedObjectReference_Free(&item->obj);
1942
 
    esxVI_PropertyChange_Free(&item->changeSet);
1943
 
    /*esxVI_MissingProperty_Free(&item->missingSet);*//* FIXME */
1944
 
});
1945
 
 
1946
 
/* esxVI_ObjectUpdate_AppendToList */
1947
 
ESX_VI__TEMPLATE__LIST__APPEND(ObjectUpdate);
1948
 
 
1949
 
/* esxVI_ObjectUpdate_Deserialize */
1950
 
ESX_VI__TEMPLATE__DESERIALIZE(ObjectUpdate,
1951
 
{
1952
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(ObjectUpdateKind, kind);
1953
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
1954
 
                                                     NULL, obj);
1955
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(PropertyChange, changeSet);
1956
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(missingSet); /* FIXME */
1957
 
},
1958
 
{
1959
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(kind);
1960
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(obj);
1961
 
});
1962
 
 
1963
 
/* esxVI_ObjectUpdate_DeserializeList */
1964
 
ESX_VI__TEMPLATE__LIST__DESERIALIZE(ObjectUpdate);
1965
 
 
1966
 
 
1967
 
 
1968
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
1969
 
 * VI Type: PropertyFilterUpdate
1970
 
 */
1971
 
 
1972
 
/* esxVI_PropertyFilterUpdate_Alloc */
1973
 
ESX_VI__TEMPLATE__ALLOC(PropertyFilterUpdate);
1974
 
 
1975
 
/* esxVI_PropertyFilterUpdate_Free */
1976
 
ESX_VI__TEMPLATE__FREE(PropertyFilterUpdate,
1977
 
{
1978
 
    esxVI_PropertyFilterUpdate_Free(&item->_next);
1979
 
 
1980
 
    esxVI_ManagedObjectReference_Free(&item->filter);
1981
 
    esxVI_ObjectUpdate_Free(&item->objectSet);
1982
 
    /*esxVI_MissingProperty_Free(&item->missingSet);*//* FIXME */
1983
 
});
1984
 
 
1985
 
/* esxVI_PropertyFilterUpdate_AppendToList */
1986
 
ESX_VI__TEMPLATE__LIST__APPEND(PropertyFilterUpdate);
1987
 
 
1988
 
/* esxVI_PropertyFilterUpdate_Deserialize */
1989
 
ESX_VI__TEMPLATE__DESERIALIZE(PropertyFilterUpdate,
1990
 
{
1991
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
1992
 
                                                     NULL, filter);
1993
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(ObjectUpdate, objectSet);
1994
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(missingSet); /* FIXME */
1995
 
},
1996
 
{
1997
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(filter);
1998
 
});
1999
 
 
2000
 
/* esxVI_PropertyFilterUpdate_DeserializeList */
2001
 
ESX_VI__TEMPLATE__LIST__DESERIALIZE(PropertyFilterUpdate);
2002
 
 
2003
 
 
2004
 
 
2005
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2006
 
 * VI Type: AboutInfo
2007
 
 */
2008
 
 
2009
 
/* esxVI_AboutInfo_Alloc */
2010
 
ESX_VI__TEMPLATE__ALLOC(AboutInfo);
2011
 
 
2012
 
/* esxVI_AboutInfo_Free */
2013
 
ESX_VI__TEMPLATE__FREE(AboutInfo,
2014
 
{
2015
 
    VIR_FREE(item->name);
2016
 
    VIR_FREE(item->fullName);
2017
 
    VIR_FREE(item->vendor);
2018
 
    VIR_FREE(item->version);
2019
 
    VIR_FREE(item->build);
2020
 
    VIR_FREE(item->localeVersion);
2021
 
    VIR_FREE(item->localeBuild);
2022
 
    VIR_FREE(item->osType);
2023
 
    VIR_FREE(item->productLineId);
2024
 
    VIR_FREE(item->apiType);
2025
 
    VIR_FREE(item->apiVersion);
2026
 
});
2027
 
 
2028
 
/* esxVI_AboutInfo_Deserialize */
2029
 
ESX_VI__TEMPLATE__DESERIALIZE(AboutInfo,
2030
 
{
2031
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, name);
2032
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, fullName);
2033
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, vendor);
2034
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, version);
2035
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, build);
2036
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, localeVersion);
2037
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, localeBuild);
2038
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, osType);
2039
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, productLineId);
2040
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, apiType);
2041
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, apiVersion);
2042
 
},
2043
 
{
2044
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(name);
2045
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(fullName);
2046
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(vendor);
2047
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(version);
2048
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(build);
2049
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(localeVersion);
2050
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(localeBuild);
2051
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(osType);
2052
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(productLineId);
2053
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(apiType);
2054
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(apiVersion);
2055
 
});
2056
 
 
2057
 
 
2058
 
 
2059
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2060
 
 * VI Type: ServiceContent
2061
 
 */
2062
 
 
2063
 
/* esxVI_ServiceContent_Alloc */
2064
 
ESX_VI__TEMPLATE__ALLOC(ServiceContent);
2065
 
 
2066
 
/* esxVI_ServiceContent_Free */
2067
 
ESX_VI__TEMPLATE__FREE(ServiceContent,
2068
 
{
2069
 
    esxVI_ManagedObjectReference_Free(&item->rootFolder);
2070
 
    esxVI_ManagedObjectReference_Free(&item->propertyCollector);
2071
 
    esxVI_ManagedObjectReference_Free(&item->viewManager);
2072
 
    esxVI_AboutInfo_Free(&item->about);
2073
 
    esxVI_ManagedObjectReference_Free(&item->setting);
2074
 
    esxVI_ManagedObjectReference_Free(&item->userDirectory);
2075
 
    esxVI_ManagedObjectReference_Free(&item->sessionManager);
2076
 
    esxVI_ManagedObjectReference_Free(&item->authorizationManager);
2077
 
    esxVI_ManagedObjectReference_Free(&item->perfManager);
2078
 
    esxVI_ManagedObjectReference_Free(&item->scheduledTaskManager);
2079
 
    esxVI_ManagedObjectReference_Free(&item->alarmManager);
2080
 
    esxVI_ManagedObjectReference_Free(&item->eventManager);
2081
 
    esxVI_ManagedObjectReference_Free(&item->taskManager);
2082
 
    esxVI_ManagedObjectReference_Free(&item->extensionManager);
2083
 
    esxVI_ManagedObjectReference_Free(&item->customizationSpecManager);
2084
 
    esxVI_ManagedObjectReference_Free(&item->customFieldsManager);
2085
 
    esxVI_ManagedObjectReference_Free(&item->accountManager);
2086
 
    esxVI_ManagedObjectReference_Free(&item->diagnosticManager);
2087
 
    esxVI_ManagedObjectReference_Free(&item->licenseManager);
2088
 
    esxVI_ManagedObjectReference_Free(&item->searchIndex);
2089
 
    esxVI_ManagedObjectReference_Free(&item->fileManager);
2090
 
    esxVI_ManagedObjectReference_Free(&item->virtualDiskManager);
2091
 
    esxVI_ManagedObjectReference_Free(&item->virtualizationManager);
2092
 
});
2093
 
 
2094
 
/* esxVI_ServiceContent_Deserialize */
2095
 
ESX_VI__TEMPLATE__DESERIALIZE(ServiceContent,
2096
 
{
2097
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2098
 
                                                     "Folder", rootFolder);
2099
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2100
 
                                                    "PropertyCollector",
2101
 
                                                     propertyCollector);
2102
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2103
 
                                                     "ViewManager",
2104
 
                                                     viewManager);
2105
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(AboutInfo, about);
2106
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2107
 
                                                     "OptionManager", setting);
2108
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2109
 
                                                     "UserDirectory",
2110
 
                                                     userDirectory);
2111
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2112
 
                                                     "SessionManager",
2113
 
                                                     sessionManager);
2114
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2115
 
                                                     "AuthorizationManager",
2116
 
                                                     authorizationManager);
2117
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2118
 
                                                     "PerformanceManager",
2119
 
                                                     perfManager);
2120
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2121
 
                                                     "ScheduledTaskManager",
2122
 
                                                     scheduledTaskManager);
2123
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2124
 
                                                     "AlarmManager",
2125
 
                                                     alarmManager);
2126
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2127
 
                                                     "EventManager",
2128
 
                                                     eventManager);
2129
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2130
 
                                                     "TaskManager",
2131
 
                                                     taskManager);
2132
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2133
 
                                                     "ExtensionManager",
2134
 
                                                     extensionManager);
2135
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2136
 
                                                     "CustomizationSpecManager",
2137
 
                                                     customizationSpecManager);
2138
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2139
 
                                                     "CustomFieldsManager",
2140
 
                                                     customFieldsManager);
2141
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2142
 
                                                     "HostLocalAccountManager",
2143
 
                                                     accountManager);
2144
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2145
 
                                                     "DiagnosticManager",
2146
 
                                                     diagnosticManager);
2147
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2148
 
                                                     "LicenseManager",
2149
 
                                                     licenseManager);
2150
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2151
 
                                                     "SearchIndex",
2152
 
                                                     searchIndex);
2153
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2154
 
                                                     "FileManager",
2155
 
                                                     fileManager);
2156
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2157
 
                                                     "VirtualDiskManager",
2158
 
                                                     virtualDiskManager);
2159
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2160
 
                                                     "VirtualizationManager",
2161
 
                                                     virtualizationManager);
2162
 
},
2163
 
{
2164
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(rootFolder);
2165
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(propertyCollector);
2166
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(about);
2167
 
});
2168
 
 
2169
 
 
2170
 
 
2171
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2172
 
 * VI Type: UpdateSet
2173
 
 */
2174
 
 
2175
 
/* esxVI_UpdateSet_Alloc */
2176
 
ESX_VI__TEMPLATE__ALLOC(UpdateSet);
2177
 
 
2178
 
/* esxVI_UpdateSet_Free */
2179
 
ESX_VI__TEMPLATE__FREE(UpdateSet,
2180
 
{
2181
 
    VIR_FREE(item->version);
2182
 
    esxVI_PropertyFilterUpdate_Free(&item->filterSet);
2183
 
});
2184
 
 
2185
 
/* esxVI_UpdateSet_Deserialize */
2186
 
ESX_VI__TEMPLATE__DESERIALIZE(UpdateSet,
2187
 
{
2188
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, version);
2189
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(PropertyFilterUpdate,
2190
 
                                                 filterSet);
2191
 
},
2192
 
{
2193
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(version);
2194
 
});
2195
 
 
2196
 
 
2197
 
 
2198
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2199
 
 * VI Type: SharesInfo
2200
 
 */
2201
 
 
2202
 
/* esxVI_SharesInfo_Alloc */
2203
 
ESX_VI__TEMPLATE__ALLOC(SharesInfo);
2204
 
 
2205
 
/* esxVI_SharesInfo_Free */
2206
 
ESX_VI__TEMPLATE__FREE(SharesInfo,
2207
 
{
2208
 
    esxVI_Int_Free(&item->shares);
2209
 
});
2210
 
 
2211
 
/* esxVI_SharesInfo_CastFromAnyType */
2212
 
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(SharesInfo);
2213
 
 
2214
 
/* esxVI_SharesInfo_Deserialize */
2215
 
ESX_VI__TEMPLATE__DESERIALIZE(SharesInfo,
2216
 
{
2217
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, shares);
2218
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(SharesLevel, level);
2219
 
},
2220
 
{
2221
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(shares);
2222
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(level);
2223
 
});
2224
 
 
2225
 
/* esxVI_SharesInfo_Serialize */
2226
 
ESX_VI__TEMPLATE__SERIALIZE(SharesInfo,
2227
 
{
2228
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Int, shares, True);
2229
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(SharesLevel, level, True);
2230
 
});
2231
 
 
2232
 
 
2233
 
 
2234
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2235
 
 * VI Type: ResourceAllocationInfo
2236
 
 */
2237
 
 
2238
 
/* esxVI_ResourceAllocationInfo_Alloc */
2239
 
ESX_VI__TEMPLATE__ALLOC(ResourceAllocationInfo);
2240
 
 
2241
 
/* esxVI_ResourceAllocationInfo_Free */
2242
 
ESX_VI__TEMPLATE__FREE(ResourceAllocationInfo,
2243
 
{
2244
 
    esxVI_Long_Free(&item->reservation);
2245
 
    esxVI_Long_Free(&item->limit);
2246
 
    esxVI_SharesInfo_Free(&item->shares);
2247
 
    esxVI_Long_Free(&item->overheadLimit);
2248
 
});
2249
 
 
2250
 
/* esxVI_ResourceAllocationInfo_Serialize */
2251
 
ESX_VI__TEMPLATE__SERIALIZE(ResourceAllocationInfo,
2252
 
{
2253
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Long, reservation, False);
2254
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Boolean, expandableReservation,
2255
 
                                          False);
2256
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Long, limit, False);
2257
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(SharesInfo, shares, False);
2258
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Long, overheadLimit, False);
2259
 
});
2260
 
 
2261
 
 
2262
 
 
2263
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2264
 
 * VI Type: ResourcePoolResourceUsage
2265
 
 */
2266
 
 
2267
 
/* esxVI_ResourcePoolResourceUsage_Alloc */
2268
 
ESX_VI__TEMPLATE__ALLOC(ResourcePoolResourceUsage);
2269
 
 
2270
 
/* esxVI_ResourcePoolResourceUsage_Free */
2271
 
ESX_VI__TEMPLATE__FREE(ResourcePoolResourceUsage,
2272
 
{
2273
 
    esxVI_Long_Free(&item->reservationUsed);
2274
 
    esxVI_Long_Free(&item->reservationUsedForVm);
2275
 
    esxVI_Long_Free(&item->unreservedForPool);
2276
 
    esxVI_Long_Free(&item->unreservedForVm);
2277
 
    esxVI_Long_Free(&item->overallUsage);
2278
 
    esxVI_Long_Free(&item->maxUsage);
2279
 
});
2280
 
 
2281
 
/* esxVI_ResourcePoolResourceUsage_CastFromAnyType */
2282
 
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(ResourcePoolResourceUsage);
2283
 
 
2284
 
/* esxVI_ResourcePoolResourceUsage_Deserialize */
2285
 
ESX_VI__TEMPLATE__DESERIALIZE(ResourcePoolResourceUsage,
2286
 
{
2287
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Long, reservationUsed);
2288
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Long, reservationUsedForVm);
2289
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Long, unreservedForPool);
2290
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Long, unreservedForVm);
2291
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Long, overallUsage);
2292
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Long, maxUsage);
2293
 
},
2294
 
{
2295
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(reservationUsed);
2296
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(reservationUsedForVm);
2297
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(unreservedForPool);
2298
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(unreservedForVm);
2299
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(overallUsage);
2300
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(maxUsage);
2301
 
});
2302
 
 
2303
 
 
2304
 
 
2305
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2306
 
 * VI Type: VirtualMachineConfigSpec
2307
 
 */
2308
 
 
2309
 
/* esxVI_VirtualMachineConfigSpec_Alloc */
2310
 
ESX_VI__TEMPLATE__ALLOC(VirtualMachineConfigSpec);
2311
 
 
2312
 
/* esxVI_VirtualMachineConfigSpec_Free */
2313
 
ESX_VI__TEMPLATE__FREE(VirtualMachineConfigSpec,
2314
 
{
2315
 
    VIR_FREE(item->changeVersion);
2316
 
    VIR_FREE(item->name);
2317
 
    VIR_FREE(item->version);
2318
 
    VIR_FREE(item->uuid);
2319
 
    esxVI_Long_Free(&item->npivNodeWorldWideName);
2320
 
    esxVI_Long_Free(&item->npivPortWorldWideName);
2321
 
    VIR_FREE(item->npivWorldWideNameType);
2322
 
    VIR_FREE(item->npivWorldWideNameOp);
2323
 
    VIR_FREE(item->locationId);
2324
 
    VIR_FREE(item->guestId);
2325
 
    VIR_FREE(item->alternateGuestName);
2326
 
    VIR_FREE(item->annotation);
2327
 
    /* FIXME: implement missing */
2328
 
    esxVI_Int_Free(&item->numCPUs);
2329
 
    esxVI_Long_Free(&item->memoryMB);
2330
 
    /* FIXME: implement missing */
2331
 
    esxVI_ResourceAllocationInfo_Free(&item->cpuAllocation);
2332
 
    esxVI_ResourceAllocationInfo_Free(&item->memoryAllocation);
2333
 
    /* FIXME: implement missing */
2334
 
    VIR_FREE(item->swapPlacement);
2335
 
    /* FIXME: implement missing */
2336
 
});
2337
 
 
2338
 
/* esxVI_VirtualMachineConfigSpec_Serialize */
2339
 
ESX_VI__TEMPLATE__SERIALIZE(VirtualMachineConfigSpec,
2340
 
{
2341
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, changeVersion, False);
2342
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, name, False);
2343
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, version, False);
2344
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, uuid, False);
2345
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(Long, npivNodeWorldWideName,
2346
 
                                               False);
2347
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(Long, npivPortWorldWideName,
2348
 
                                               False);
2349
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, npivWorldWideNameType,
2350
 
                                                False);
2351
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, npivWorldWideNameOp,
2352
 
                                                False);
2353
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, locationId, False);
2354
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, guestId, False);
2355
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, alternateGuestName,
2356
 
                                                False);
2357
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, annotation, False);
2358
 
    /* FIXME: implement missing */
2359
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Int, numCPUs, False);
2360
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Long, memoryMB, False);
2361
 
    /* FIXME: implement missing */
2362
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(ResourceAllocationInfo,
2363
 
                                          cpuAllocation, False);
2364
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(ResourceAllocationInfo,
2365
 
                                          memoryAllocation, False);
2366
 
    /* FIXME: implement missing */
2367
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, swapPlacement, False);
2368
 
    /* FIXME: implement missing */
2369
 
});
2370
 
 
2371
 
 
2372
 
 
2373
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2374
 
 * VI Type: Event
2375
 
 */
2376
 
 
2377
 
/* esxVI_Event_Alloc */
2378
 
ESX_VI__TEMPLATE__ALLOC(Event);
2379
 
 
2380
 
/* esxVI_Event_Free */
2381
 
ESX_VI__TEMPLATE__FREE(Event,
2382
 
{
2383
 
    esxVI_Event_Free(&item->_next);
2384
 
 
2385
 
    /* FIXME: implement the rest */
2386
 
    esxVI_Int_Free(&item->key);
2387
 
    esxVI_Int_Free(&item->chainId);
2388
 
    esxVI_DateTime_Free(&item->createdTime);
2389
 
    VIR_FREE(item->userName);
2390
 
    VIR_FREE(item->fullFormattedMessage);
2391
 
});
2392
 
 
2393
 
/* esxVI_Event_Deserialize */
2394
 
ESX_VI__TEMPLATE__DESERIALIZE(Event,
2395
 
{
2396
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, key);
2397
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, chainId);
2398
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(DateTime, createdTime);
2399
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, userName);
2400
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(datacenter); /* FIXME */
2401
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(computeResource); /* FIXME */
2402
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(host); /* FIXME */
2403
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(vm); /* FIXME */
2404
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, fullFormattedMessage);
2405
 
},
2406
 
{
2407
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(key);
2408
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(chainId);
2409
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(createdTime);
2410
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(userName);
2411
 
});
2412
 
 
2413
 
/* esxVI_Event_DeserializeList */
2414
 
ESX_VI__TEMPLATE__LIST__DESERIALIZE(Event);
2415
 
 
2416
 
 
2417
 
 
2418
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2419
 
 * VI Type: UserSession
2420
 
 */
2421
 
 
2422
 
/* esxVI_UserSession_Alloc */
2423
 
ESX_VI__TEMPLATE__ALLOC(UserSession);
2424
 
 
2425
 
/* esxVI_UserSession_Free */
2426
 
ESX_VI__TEMPLATE__FREE(UserSession,
2427
 
{
2428
 
    VIR_FREE(item->key);
2429
 
    VIR_FREE(item->userName);
2430
 
    VIR_FREE(item->fullName);
2431
 
    esxVI_DateTime_Free(&item->loginTime);
2432
 
    esxVI_DateTime_Free(&item->lastActiveTime);
2433
 
    VIR_FREE(item->locale);
2434
 
    VIR_FREE(item->messageLocale);
2435
 
});
2436
 
 
2437
 
/* esxVI_UserSession_CastFromAnyType */
2438
 
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(UserSession);
2439
 
 
2440
 
/* esxVI_UserSession_Deserialize */
2441
 
ESX_VI__TEMPLATE__DESERIALIZE(UserSession,
2442
 
{
2443
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, key);
2444
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, userName);
2445
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, fullName);
2446
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(DateTime, loginTime);
2447
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(DateTime, lastActiveTime);
2448
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, locale);
2449
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, messageLocale);
2450
 
},
2451
 
{
2452
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(key);
2453
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(userName);
2454
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(fullName);
2455
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(loginTime);
2456
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(lastActiveTime);
2457
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(locale);
2458
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(messageLocale);
2459
 
});
2460
 
 
2461
 
 
2462
 
 
2463
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2464
 
 * VI Type: VirtualMachineQuestionInfo
2465
 
 */
2466
 
 
2467
 
/* esxVI_VirtualMachineQuestionInfo_Alloc */
2468
 
ESX_VI__TEMPLATE__ALLOC(VirtualMachineQuestionInfo);
2469
 
 
2470
 
/* esxVI_VirtualMachineQuestionInfo_Free */
2471
 
ESX_VI__TEMPLATE__FREE(VirtualMachineQuestionInfo,
2472
 
{
2473
 
    VIR_FREE(item->id);
2474
 
    VIR_FREE(item->text);
2475
 
    esxVI_ChoiceOption_Free(&item->choice);
2476
 
    /*esxVI_VirtualMachineMessage_Free(&item->message);*//* FIXME */
2477
 
});
2478
 
 
2479
 
/* esxVI_VirtualMachineQuestionInfo_CastFromAnyType */
2480
 
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(VirtualMachineQuestionInfo);
2481
 
 
2482
 
/* esxVI_VirtualMachineQuestionInfo_Deserialize */
2483
 
ESX_VI__TEMPLATE__DESERIALIZE(VirtualMachineQuestionInfo,
2484
 
{
2485
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, id);
2486
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, text);
2487
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(ChoiceOption, choice);
2488
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(message); /* FIXME */
2489
 
},
2490
 
{
2491
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(id);
2492
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(text);
2493
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(choice);
2494
 
});
2495
 
 
2496
 
 
2497
 
 
2498
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2499
 
 * VI Type: ElementDescription extends Description
2500
 
 *
2501
 
 *          In contrast to SelectionSpec and TraversalSpec just merge
2502
 
 *          Description into ElementDescription for simplicity, because
2503
 
 *          only ElementDescription is used.
2504
 
 */
2505
 
 
2506
 
/* esxVI_ElementDescription_Alloc */
2507
 
ESX_VI__TEMPLATE__ALLOC(ElementDescription);
2508
 
 
2509
 
/* esxVI_ElementDescription_Free */
2510
 
ESX_VI__TEMPLATE__FREE(ElementDescription,
2511
 
{
2512
 
    esxVI_ElementDescription_Free(&item->_next);
2513
 
 
2514
 
    VIR_FREE(item->label);
2515
 
    VIR_FREE(item->summary);
2516
 
    VIR_FREE(item->key);
2517
 
});
2518
 
 
2519
 
/* esxVI_ElementDescription_AppendToList */
2520
 
ESX_VI__TEMPLATE__LIST__APPEND(ElementDescription);
2521
 
 
2522
 
/* esxVI_ElementDescription_Deserialize */
2523
 
ESX_VI__TEMPLATE__DESERIALIZE(ElementDescription,
2524
 
{
2525
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, label);
2526
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, summary);
2527
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, key);
2528
 
},
2529
 
{
2530
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(label);
2531
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(summary);
2532
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(key);
2533
 
});
2534
 
 
2535
 
 
2536
 
 
2537
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2538
 
 * VI Type: ChoiceOption extends OptionType
2539
 
 *
2540
 
 *          In contrast to SelectionSpec and TraversalSpec just merge
2541
 
 *          OptionType into ChoiceOption for simplicity, because
2542
 
 *          only ChoiceOption is used.
2543
 
 */
2544
 
 
2545
 
/* esxVI_ChoiceOption_Alloc */
2546
 
ESX_VI__TEMPLATE__ALLOC(ChoiceOption);
2547
 
 
2548
 
/* esxVI_ChoiceOption_Free */
2549
 
ESX_VI__TEMPLATE__FREE(ChoiceOption,
2550
 
{
2551
 
    esxVI_ElementDescription_Free(&item->choiceInfo);
2552
 
    esxVI_Int_Free(&item->defaultIndex);
2553
 
});
2554
 
 
2555
 
/* esxVI_ChoiceOption_Deserialize */
2556
 
ESX_VI__TEMPLATE__DESERIALIZE(ChoiceOption,
2557
 
{
2558
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Boolean, valueIsReadonly);
2559
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(ElementDescription, choiceInfo);
2560
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, defaultIndex);
2561
 
},
2562
 
{
2563
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(choiceInfo);
2564
 
});
2565
 
 
2566
 
 
2567
 
 
2568
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2569
 
 * VI Type: PerfMetricId
2570
 
 */
2571
 
 
2572
 
/* esxVI_PerfMetricId_Alloc */
2573
 
ESX_VI__TEMPLATE__ALLOC(PerfMetricId);
2574
 
 
2575
 
/* esxVI_PerfMetricId_Free */
2576
 
ESX_VI__TEMPLATE__FREE(PerfMetricId,
2577
 
{
2578
 
    esxVI_PerfMetricId_Free(&item->_next);
2579
 
 
2580
 
    esxVI_Int_Free(&item->counterId);
2581
 
    VIR_FREE(item->instance);
2582
 
});
2583
 
 
2584
 
/* esxVI_PerfMetricId_Serialize */
2585
 
ESX_VI__TEMPLATE__SERIALIZE(PerfMetricId,
2586
 
{
2587
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Int, counterId, True);
2588
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, instance, True);
2589
 
});
2590
 
 
2591
 
/* esxVI_PerfMetricId_SerializeList */
2592
 
ESX_VI__TEMPLATE__LIST__SERIALIZE(PerfMetricId);
2593
 
 
2594
 
/* esxVI_PerfMetricId_Deserialize */
2595
 
ESX_VI__TEMPLATE__DESERIALIZE(PerfMetricId,
2596
 
{
2597
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, counterId);
2598
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, instance);
2599
 
},
2600
 
{
2601
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(counterId);
2602
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(instance);
2603
 
});
2604
 
 
2605
 
/* esxVI_PerfMetricId_DeserializeList */
2606
 
ESX_VI__TEMPLATE__LIST__DESERIALIZE(PerfMetricId);
2607
 
 
2608
 
 
2609
 
 
2610
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2611
 
 * VI Type: PerfCounterInfo
2612
 
 */
2613
 
 
2614
 
/* esxVI_PerfCounterInfo_Alloc */
2615
 
ESX_VI__TEMPLATE__ALLOC(PerfCounterInfo);
2616
 
 
2617
 
/* esxVI_PerfCounterInfo_Free */
2618
 
ESX_VI__TEMPLATE__FREE(PerfCounterInfo,
2619
 
{
2620
 
    esxVI_PerfCounterInfo_Free(&item->_next);
2621
 
 
2622
 
    esxVI_Int_Free(&item->key);
2623
 
    esxVI_ElementDescription_Free(&item->nameInfo);
2624
 
    esxVI_ElementDescription_Free(&item->groupInfo);
2625
 
    esxVI_ElementDescription_Free(&item->unitInfo);
2626
 
    esxVI_Int_Free(&item->level);
2627
 
    esxVI_Int_Free(&item->associatedCounterId);
2628
 
});
2629
 
 
2630
 
/* esxVI_PerfCounterInfo_Deserialize */
2631
 
ESX_VI__TEMPLATE__DESERIALIZE(PerfCounterInfo,
2632
 
{
2633
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, key);
2634
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(ElementDescription, nameInfo);
2635
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(ElementDescription, groupInfo);
2636
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(ElementDescription, unitInfo);
2637
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(PerfSummaryType, rollupType);
2638
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(PerfStatsType, statsType);
2639
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, level);
2640
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(Int, associatedCounterId);
2641
 
},
2642
 
{
2643
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(key);
2644
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(nameInfo);
2645
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(groupInfo);
2646
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(unitInfo);
2647
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(rollupType);
2648
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(statsType);
2649
 
});
2650
 
 
2651
 
/* esxVI_PerfCounterInfo_DeserializeList */
2652
 
ESX_VI__TEMPLATE__LIST__DESERIALIZE(PerfCounterInfo);
2653
 
 
2654
 
 
2655
 
 
2656
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2657
 
 * VI Type: PerfQuerySpec
2658
 
 */
2659
 
 
2660
 
/* esxVI_PerfQuerySpec_Alloc */
2661
 
ESX_VI__TEMPLATE__ALLOC(PerfQuerySpec);
2662
 
 
2663
 
/* esxVI_PerfQuerySpec_Free */
2664
 
ESX_VI__TEMPLATE__FREE(PerfQuerySpec,
2665
 
{
2666
 
    esxVI_PerfQuerySpec_Free(&item->_next);
2667
 
 
2668
 
    esxVI_ManagedObjectReference_Free(&item->entity);
2669
 
    esxVI_DateTime_Free(&item->startTime);
2670
 
    esxVI_DateTime_Free(&item->endTime);
2671
 
    esxVI_Int_Free(&item->maxSample);
2672
 
    esxVI_PerfMetricId_Free(&item->metricId);
2673
 
    esxVI_Int_Free(&item->intervalId);
2674
 
    VIR_FREE(item->format);
2675
 
});
2676
 
 
2677
 
/* esxVI_PerfQuerySpec_Serialize */
2678
 
ESX_VI__TEMPLATE__SERIALIZE(PerfQuerySpec,
2679
 
{
2680
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(ManagedObjectReference, entity, True);
2681
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(DateTime, startTime, False);
2682
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(DateTime, endTime, False);
2683
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Int, maxSample, False);
2684
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(PerfMetricId, metricId, False);
2685
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Int, intervalId, False);
2686
 
    ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, format, False);
2687
 
});
2688
 
 
2689
 
/* esxVI_PerfQuerySpec_SerializeList */
2690
 
ESX_VI__TEMPLATE__LIST__SERIALIZE(PerfQuerySpec);
2691
 
 
2692
 
 
2693
 
 
2694
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2695
 
 * VI Type: PerfSampleInfo
2696
 
 */
2697
 
 
2698
 
/* esxVI_PerfSampleInfo_Alloc */
2699
 
ESX_VI__TEMPLATE__ALLOC(PerfSampleInfo);
2700
 
 
2701
 
/* esxVI_PerfSampleInfo_Free */
2702
 
ESX_VI__TEMPLATE__FREE(PerfSampleInfo,
2703
 
{
2704
 
    esxVI_PerfSampleInfo_Free(&item->_next);
2705
 
 
2706
 
    esxVI_DateTime_Free(&item->timestamp);
2707
 
    esxVI_Int_Free(&item->interval);
2708
 
});
2709
 
 
2710
 
/* esxVI_PerfSampleInfo_AppendToList */
2711
 
ESX_VI__TEMPLATE__LIST__APPEND(PerfSampleInfo);
2712
 
 
2713
 
/* esxVI_PerfSampleInfo_Deserialize */
2714
 
ESX_VI__TEMPLATE__DESERIALIZE(PerfSampleInfo,
2715
 
{
2716
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(DateTime, timestamp);
2717
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, interval);
2718
 
},
2719
 
{
2720
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(timestamp);
2721
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(interval);
2722
 
});
2723
 
 
2724
 
/* esxVI_PerfSampleInfo_DeserializeList */
2725
 
ESX_VI__TEMPLATE__LIST__DESERIALIZE(PerfSampleInfo);
2726
 
 
2727
 
 
2728
 
 
2729
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2730
 
 * VI Type: PerfMetricIntSeries extends PerfMetricSeries
2731
 
 *
2732
 
 *          In contrast to SelectionSpec and TraversalSpec just merge
2733
 
 *          PerfMetricSeries into PerfMetricIntSeries for simplicity, because
2734
 
 *          only PerfMetricIntSeries is used and the other type inheriting
2735
 
 *          PerfMetricSeries (PerfMetricSeriesCSV) is not used.
2736
 
 */
2737
 
 
2738
 
/* esxVI_PerfMetricIntSeries_Alloc */
2739
 
ESX_VI__TEMPLATE__ALLOC(PerfMetricIntSeries);
2740
 
 
2741
 
/* esxVI_PerfMetricIntSeries_Free */
2742
 
ESX_VI__TEMPLATE__FREE(PerfMetricIntSeries,
2743
 
{
2744
 
    esxVI_PerfMetricIntSeries_Free(&item->_next);
2745
 
 
2746
 
    esxVI_PerfMetricId_Free(&item->id);
2747
 
    esxVI_Long_Free(&item->value);
2748
 
});
2749
 
 
2750
 
/* esxVI_PerfMetricIntSeries_AppendToList */
2751
 
ESX_VI__TEMPLATE__LIST__APPEND(PerfMetricIntSeries);
2752
 
 
2753
 
/* esxVI_PerfMetricIntSeries_Deserialize */
2754
 
ESX_VI__TEMPLATE__DESERIALIZE(PerfMetricIntSeries,
2755
 
{
2756
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(PerfMetricId, id);
2757
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(Long, value);
2758
 
},
2759
 
{
2760
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(id);
2761
 
});
2762
 
 
2763
 
 
2764
 
 
2765
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2766
 
 * VI Type: PerfEntityMetric extends PerfEntityMetricBase
2767
 
 *
2768
 
 *          In contrast to SelectionSpec and TraversalSpec just merge
2769
 
 *          PerfEntityMetricBase into PerfEntityMetric for simplicity, because
2770
 
 *          only PerfEntityMetric is used and the other type inheriting
2771
 
 *          PerfEntityMetric (PerfEntityMetricCSV) is not used.
2772
 
 *
2773
 
 *          Also use PerfMetricIntSeries instead of the correct base type
2774
 
 *          PerfMetricSeries for the value property, because only
2775
 
 *          PerfMetricIntSeries is used.
2776
 
 */
2777
 
 
2778
 
/* esxVI_PerfEntityMetric_Alloc */
2779
 
ESX_VI__TEMPLATE__ALLOC(PerfEntityMetric);
2780
 
 
2781
 
/* esxVI_PerfEntityMetric_Free */
2782
 
ESX_VI__TEMPLATE__FREE(PerfEntityMetric,
2783
 
{
2784
 
    esxVI_PerfEntityMetric_Free(&item->_next);
2785
 
 
2786
 
    esxVI_ManagedObjectReference_Free(&item->entity);
2787
 
    esxVI_PerfSampleInfo_Free(&item->sampleInfo);
2788
 
    esxVI_PerfMetricIntSeries_Free(&item->value);
2789
 
});
2790
 
 
2791
 
/* esxVI_PerfEntityMetric_Deserialize */
2792
 
ESX_VI__TEMPLATE__DESERIALIZE(PerfEntityMetric,
2793
 
{
2794
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2795
 
                                                     NULL, entity);
2796
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(PerfSampleInfo, sampleInfo);
2797
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(PerfMetricIntSeries, value);
2798
 
},
2799
 
{
2800
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(entity);
2801
 
});
2802
 
 
2803
 
/* esxVI_PerfEntityMetric_DeserializeList */
2804
 
ESX_VI__TEMPLATE__LIST__DESERIALIZE(PerfEntityMetric);
2805
 
 
2806
 
 
2807
 
 
2808
 
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2809
 
 * VI Type: TaskInfo
2810
 
 */
2811
 
 
2812
 
/* esxVI_TaskInfo_Alloc */
2813
 
ESX_VI__TEMPLATE__ALLOC(TaskInfo);
2814
 
 
2815
 
/* esxVI_TaskInfo_Free */
2816
 
ESX_VI__TEMPLATE__FREE(TaskInfo,
2817
 
{
2818
 
    esxVI_TaskInfo_Free(&item->_next);
2819
 
 
2820
 
    VIR_FREE(item->key);
2821
 
    esxVI_ManagedObjectReference_Free(&item->task);
2822
 
    VIR_FREE(item->name);
2823
 
    VIR_FREE(item->descriptionId);
2824
 
    esxVI_ManagedObjectReference_Free(&item->entity);
2825
 
    VIR_FREE(item->entityName);
2826
 
    /*esxVI_ManagedObjectReference_Free(&item->locked);*//* FIXME */
2827
 
    /*esxVI_MethodFault_Free(&item->error);*//* FIXME */
2828
 
    esxVI_AnyType_Free(&item->result);
2829
 
    esxVI_Int_Free(&item->progress);
2830
 
    /*esxVI_TaskReason_Free(&item->reason);*//* FIXME */
2831
 
    esxVI_DateTime_Free(&item->queueTime);
2832
 
    esxVI_DateTime_Free(&item->startTime);
2833
 
    esxVI_DateTime_Free(&item->completeTime);
2834
 
    esxVI_Int_Free(&item->eventChainId);
2835
 
});
2836
 
 
2837
 
/* esxVI_TaskInfo_CastFromAnyType */
2838
 
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(TaskInfo);
2839
 
 
2840
 
/* esxVI_TaskInfo_AppendToList */
2841
 
ESX_VI__TEMPLATE__LIST__APPEND(TaskInfo);
2842
 
 
2843
 
/* esxVI_TaskInfo_Deserialize */
2844
 
ESX_VI__TEMPLATE__DESERIALIZE(TaskInfo,
2845
 
{
2846
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, key);
2847
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2848
 
                                                     "Task", task);
2849
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, name);
2850
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, descriptionId);
2851
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
2852
 
                                                     NULL, entity);
2853
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, entityName);
2854
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(locked); /* FIXME */
2855
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(TaskInfoState, state);
2856
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Boolean, cancelled);
2857
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Boolean, cancelable);
2858
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(error); /* FIXME */
2859
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(AnyType, result);
2860
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, progress);
2861
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(reason); /* FIXME */
2862
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(DateTime, queueTime);
2863
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(DateTime, startTime);
2864
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(DateTime, completeTime);
2865
 
    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, eventChainId);
2866
 
},
2867
 
{
2868
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(key);
2869
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(task);
2870
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(descriptionId);
2871
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(state);
2872
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(cancelled);
2873
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(cancelable);
2874
 
    /*ESX_VI__TEMPLATE__PROPERTY__REQUIRED(reason);*//* FIXME */
2875
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(queueTime);
2876
 
    ESX_VI__TEMPLATE__PROPERTY__REQUIRED(eventChainId);
2877
 
});
 
1453
#include "esx_vi_types.generated.c"
 
1454
 
 
1455
 
 
1456
 
 
1457
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
1458
 * VI Enum: VirtualMachinePowerState (Additions)
 
1459
 */
 
1460
 
 
1461
int
 
1462
esxVI_VirtualMachinePowerState_ConvertToLibvirt
 
1463
  (esxVI_VirtualMachinePowerState powerState)
 
1464
{
 
1465
    switch (powerState) {
 
1466
      case esxVI_VirtualMachinePowerState_PoweredOff:
 
1467
        return VIR_DOMAIN_SHUTOFF;
 
1468
 
 
1469
      case esxVI_VirtualMachinePowerState_PoweredOn:
 
1470
        return VIR_DOMAIN_RUNNING;
 
1471
 
 
1472
      case esxVI_VirtualMachinePowerState_Suspended:
 
1473
        return VIR_DOMAIN_PAUSED;
 
1474
 
 
1475
      default:
 
1476
        return VIR_DOMAIN_NOSTATE;
 
1477
    }
 
1478
}