Devel
Threads by month
- ----- 2026 -----
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- 24 participants
- 40181 discussions
I need to get libvirt version. Using function
virConnecGetLibVersion(), I've return message like
errore: unknown error
My system settings are:
Kernel: 2.6.33
Hypervisor: QEMU 0.12.3
Libvirt: 0.7.6 (cloned from git)
The code that fails is in src/libvirt.c:1656
=========================================================
if (conn->driver->libvirtVersion) {
ret = conn->driver->libvirtVersion(conn, libVer);
if (ret < 0)
goto error;
return ret;
}
*libVer = LIBVIR_VERSION_NUMBER;
ret = 0;
error:
virDispatchError(conn);
return ret;
}
=========================================================
I noticed that conn->driver->libvirtVersion is NULL for all the
hypervisors except the remote one (src/remote/remote_driver.c), hence
it always dispatch an unknown error. I checked the current libvirt
code (always cloned from git), and the bug is also present.
Is this a bug, or this is a well known behavior?
If this is a bug, a possible solution could be to add the code line
return ret;
before "error:" label. This is my debugged code
=========================================================
if (conn->driver->libvirtVersion) {
ret = conn->driver->libvirtVersion(conn, libVer);
if (ret < 0)
goto error;
return ret;
}
*libVer = LIBVIR_VERSION_NUMBER;
ret = 0;
return ret; /* POSSIBLE BUG SOLUTION */
error:
virDispatchError(conn);
return ret;
}
=========================================================
Have a good day!
--
PAOLO SMIRAGLIA
Via Avigliana 13/5
10138 Torino (TO)
Tel: 0039 333 52 73 593
E-Mail: paolo.smiraglia(a)gmail.com
- - - - -
MSN: mastronano(a)hotmail.com
Jabber: mastronano(a)jabber.linux.it
Skype: paolo.smiraglia
3
3
Call me lazy: some shells use exit (e.g. sh), others use quit (e.g. ftp),
but I never remember which. So it's faster to write a patch to make
virsh take both than it is to take a 50-50 guess, and get it wrong
in half of my attempts.
* tools/virsh.c (commands): Add 'exit'.
* tools/virsh.pod: Document it.
---
So, how many 'exit's in virsh will it take for me to have saved
more time than I spent writing up this commit message and email? :)
tools/virsh.c | 1 +
tools/virsh.pod | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index ddcc052..5c56fa6 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -8254,6 +8254,7 @@ static const vshCmdDef commands[] = {
{"pwd", cmdPwd, NULL, info_pwd},
#endif
{"quit", cmdQuit, NULL, info_quit},
+ {"exit", cmdQuit, NULL, info_quit},
{"reboot", cmdReboot, opts_reboot, info_reboot},
{"restore", cmdRestore, opts_restore, info_restore},
{"resume", cmdResume, opts_resume, info_resume},
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 9434f31..fc4a70c 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -65,7 +65,7 @@ The following commands are generic i.e. not specific to a domain.
This prints a small synopsis about all commands available for B<virsh>
B<help> I<command> will print out a detailed help message on that command.
-=item B<quit>
+=item B<quit>, B<exit>
quit this interactive terminal
--
1.6.6.1
2
2
31 Mar '10
FYI,
>From 3cda0eb487d9cafa89cd7595ed0d43ee2a93b8fc Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Wed, 31 Mar 2010 16:32:38 +0200
Subject: [PATCH] maint: fix cpp indentation syntax-check failure
* src/esx/esx_vi_types.h: Filter through cppi.
---
src/esx/esx_vi_types.h | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/esx/esx_vi_types.h b/src/esx/esx_vi_types.h
index a61cdc1..d3c7115 100644
--- a/src/esx/esx_vi_types.h
+++ b/src/esx/esx_vi_types.h
@@ -1,4 +1,3 @@
-
/*
* esx_vi_types.h: client for the VMware VI API 2.5 to manage ESX hosts
*
@@ -50,7 +49,7 @@ typedef struct _esxVI_DateTime esxVI_DateTime;
typedef struct _esxVI_Fault esxVI_Fault;
typedef struct _esxVI_ManagedObjectReference esxVI_ManagedObjectReference;
-#include "esx_vi_types.generated.typedef"
+# include "esx_vi_types.generated.typedef"
@@ -70,7 +69,7 @@ enum _esxVI_Type {
esxVI_Type_Fault,
esxVI_Type_ManagedObjectReference,
-#include "esx_vi_types.generated.typeenum"
+# include "esx_vi_types.generated.typeenum"
esxVI_Type_Other,
};
@@ -294,6 +293,6 @@ int esxVI_ManagedObjectReference_Deserialize
-#include "esx_vi_types.generated.h"
+# include "esx_vi_types.generated.h"
#endif /* __ESX_VI_TYPES_H__ */
--
1.7.0.3.513.gc8ed0
1
0
[libvirt] [PATCH] esx: Generate most SOAP mapping and improve inheritance handling
by Matthias Bolte 31 Mar '10
by Matthias Bolte 31 Mar '10
31 Mar '10
The Python script generates the mappings based on the type descriptions
in the esx_vi_generator.input file.
This also improves the inheritance handling and allows to get rid of the
ugly, inflexible, and error prone _base/_super approach. Now every struct
that represents a SOAP type contains a _type member, that allows to
recreate C++-like dynamic dispatch for "method" calls in C.
---
src/Makefile.am | 23 +-
src/esx/.gitignore | 1 +
src/esx/esx_driver.c | 10 +-
src/esx/esx_vi.c | 51 +-
src/esx/esx_vi.h | 7 +-
src/esx/esx_vi_generator.input | 426 ++++++++
src/esx/esx_vi_generator.py | 1025 ++++++++++++++++++
src/esx/esx_vi_methods.c | 44 +-
src/esx/esx_vi_types.c | 2258 +++++-----------------------------------
src/esx/esx_vi_types.h | 1090 +-------------------
10 files changed, 1868 insertions(+), 3067 deletions(-)
create mode 100644 src/esx/.gitignore
create mode 100644 src/esx/esx_vi_generator.input
create mode 100755 src/esx/esx_vi_generator.py
diff --git a/src/Makefile.am b/src/Makefile.am
index c661a5c..54792b4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,6 +26,8 @@ INCLUDES = \
EXTRA_DIST = $(conf_DATA)
+BUILT_SOURCES =
+
if WITH_NETWORK
UUID=$(shell uuidgen 2>/dev/null)
endif
@@ -250,6 +252,20 @@ ESX_DRIVER_SOURCES = \
esx/esx_vi_types.c esx/esx_vi_types.h \
esx/esx_vmx.c esx/esx_vmx.h
+ESX_DRIVER_GENERATED = \
+ esx/esx_vi_types.generated.c \
+ esx/esx_vi_types.generated.h \
+ esx/esx_vi_types.generated.typedef \
+ esx/esx_vi_types.generated.typeenum \
+ esx/esx_vi_types.generated.typetostring \
+ esx/esx_vi_types.generated.typefromstring
+
+ESX_DRIVER_EXTRA_DIST = \
+ esx/README \
+ esx/esx_vi_generator.input \
+ esx/esx_vi_generator.py \
+ $(ESX_DRIVER_GENERATED)
+
NETWORK_DRIVER_SOURCES = \
network/bridge_driver.h network/bridge_driver.c
@@ -594,7 +610,10 @@ libvirt_driver_one_la_SOURCES = $(ONE_DRIVER_SOURCES)
endif
+BUILT_SOURCES += $(ESX_DRIVER_GENERATED)
+$(ESX_DRIVER_GENERATED): $(srcdir)/esx/esx_vi_generator.input $(srcdir)/esx/esx_vi_generator.py
+ -srcdir=$(srcdir) $(srcdir)/esx/esx_vi_generator.py
if WITH_ESX
if WITH_DRIVER_MODULES
@@ -610,6 +629,7 @@ if WITH_DRIVER_MODULES
libvirt_driver_esx_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_esx_la_SOURCES = $(ESX_DRIVER_SOURCES)
+libvirt_driver_esx_la_DEPENDENCIES = $(ESX_DRIVER_GENERATED)
endif
if WITH_NETWORK
@@ -784,6 +804,7 @@ EXTRA_DIST += \
$(VBOX_DRIVER_SOURCES) \
$(XENAPI_DRIVER_SOURCES) \
$(ESX_DRIVER_SOURCES) \
+ $(ESX_DRIVER_EXTRA_DIST) \
$(NETWORK_DRIVER_SOURCES) \
$(INTERFACE_DRIVER_SOURCES) \
$(STORAGE_DRIVER_SOURCES) \
@@ -867,7 +888,7 @@ EXTRA_DIST += \
libvirt_macvtap.syms \
libvirt_daemon.syms
-BUILT_SOURCES = libvirt.syms
+BUILT_SOURCES += libvirt.syms
libvirt.syms: libvirt_public.syms $(USED_SYM_FILES)
rm -f $@-tmp $@
diff --git a/src/esx/.gitignore b/src/esx/.gitignore
new file mode 100644
index 0000000..29e1d48
--- /dev/null
+++ b/src/esx/.gitignore
@@ -0,0 +1 @@
+*.generated.*
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index bbe8a51..663c560 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1924,8 +1924,14 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
perfEntityMetric = perfEntityMetric->_next) {
VIR_DEBUG0("perfEntityMetric ...");
- for (perfMetricIntSeries = perfEntityMetric->value;
- perfMetricIntSeries != NULL;
+ perfMetricIntSeries =
+ esxVI_PerfMetricIntSeries_DynamicCast(perfEntityMetric->value);
+
+ if (perfMetricIntSeries == NULL) {
+ VIR_ERROR0("QueryPerf returned object with unexpected type");
+ }
+
+ for (; perfMetricIntSeries != NULL;
perfMetricIntSeries = perfMetricIntSeries->_next) {
VIR_DEBUG0("perfMetricIntSeries ...");
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 326add7..c1fd4b4 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -3,7 +3,7 @@
* esx_vi.c: client for the VMware VI API 2.5 to manage ESX hosts
*
* Copyright (C) 2010 Red Hat, Inc.
- * Copyright (C) 2009 Matthias Bolte <matthias.bolte(a)googlemail.com>
+ * Copyright (C) 2009-2010 Matthias Bolte <matthias.bolte(a)googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -480,12 +480,12 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "vmFolder")) {
if (esxVI_ManagedObjectReference_CastFromAnyType
- (dynamicProperty->val, &ctx->vmFolder, "Folder")) {
+ (dynamicProperty->val, &ctx->vmFolder)) {
goto failure;
}
} else if (STREQ(dynamicProperty->name, "hostFolder")) {
if (esxVI_ManagedObjectReference_CastFromAnyType
- (dynamicProperty->val, &ctx->hostFolder, "Folder")) {
+ (dynamicProperty->val, &ctx->hostFolder)) {
goto failure;
}
} else {
@@ -725,6 +725,21 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
"Call to '%s' returned an empty result, "
"expecting a non-empty result", methodName);
goto failure;
+ } else if ((*response)->node->next != NULL) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
+ "Call to '%s' returned a list, expecting "
+ "exactly one item", methodName);
+ goto failure;
+ }
+
+ break;
+
+ case esxVI_Occurrence_RequiredList:
+ if ((*response)->node == NULL) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
+ "Call to '%s' returned an empty result, "
+ "expecting a non-empty result", methodName);
+ goto failure;
}
break;
@@ -740,7 +755,7 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
break;
- case esxVI_Occurrence_List:
+ case esxVI_Occurrence_OptionalList:
/* Any amount of items is valid */
break;
@@ -821,10 +836,11 @@ esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,
*value = 0; /* undefined */
- if (STRNEQ(anyType->other, enumeration->type)) {
+ if (anyType->type != enumeration->type) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting type '%s' but found '%s'", enumeration->type,
- anyType->other);
+ "Expecting type '%s' but found '%s'",
+ esxVI_Type_ToString(enumeration->type),
+ esxVI_Type_ToString(anyType->type));
return -1;
}
@@ -837,7 +853,7 @@ esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Unknown value '%s' for %s", anyType->value,
- enumeration->type);
+ esxVI_Type_ToString(enumeration->type));
return -1;
}
@@ -870,7 +886,8 @@ esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration,
return -1;
}
- ESV_VI__XML_TAG__OPEN(output, element, enumeration->type);
+ ESV_VI__XML_TAG__OPEN(output, element,
+ esxVI_Type_ToString(enumeration->type));
virBufferAdd(output, name, -1);
@@ -906,7 +923,7 @@ esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration,
}
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Unknown value '%s' for %s",
- name, enumeration->type);
+ name, esxVI_Type_ToString(enumeration->type));
cleanup:
VIR_FREE(name);
@@ -1009,7 +1026,7 @@ esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List **list,
return -1;
}
- for (childNode = anyType->_node->children; childNode != NULL;
+ for (childNode = anyType->node->children; childNode != NULL;
childNode = childNode->next) {
if (childNode->type != XML_ELEMENT_NODE) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
@@ -1151,7 +1168,7 @@ esxVI_BuildFullTraversalSpecItem(esxVI_SelectionSpec **fullTraversalSpecList,
}
if (esxVI_TraversalSpec_Alloc(&traversalSpec) < 0 ||
- esxVI_String_DeepCopyValue(&traversalSpec->_base->name, name) < 0 ||
+ esxVI_String_DeepCopyValue(&traversalSpec->name, name) < 0 ||
esxVI_String_DeepCopyValue(&traversalSpec->type, type) < 0 ||
esxVI_String_DeepCopyValue(&traversalSpec->path, path) < 0) {
goto failure;
@@ -1177,7 +1194,8 @@ esxVI_BuildFullTraversalSpecItem(esxVI_SelectionSpec **fullTraversalSpecList,
}
if (esxVI_SelectionSpec_AppendToList(fullTraversalSpecList,
- traversalSpec->_base) < 0) {
+ esxVI_SelectionSpec_DynamicCast
+ (traversalSpec)) < 0) {
goto failure;
}
@@ -1721,8 +1739,7 @@ esxVI_LookupResourcePoolByHostSystem
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "parent")) {
if (esxVI_ManagedObjectReference_CastFromAnyType
- (dynamicProperty->val, &managedObjectReference,
- "ComputeResource") < 0) {
+ (dynamicProperty->val, &managedObjectReference) < 0) {
goto failure;
}
@@ -1756,7 +1773,7 @@ esxVI_LookupResourcePoolByHostSystem
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "resourcePool")) {
if (esxVI_ManagedObjectReference_CastFromAnyType
- (dynamicProperty->val, resourcePool, "ResourcePool") < 0) {
+ (dynamicProperty->val, resourcePool) < 0) {
goto failure;
}
@@ -2231,7 +2248,7 @@ esxVI_LookupPendingTaskInfoListByVirtualMachine
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "recentTask")) {
if (esxVI_ManagedObjectReference_CastListFromAnyType
- (dynamicProperty->val, &recentTaskList, "Task") < 0) {
+ (dynamicProperty->val, &recentTaskList) < 0) {
goto failure;
}
diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h
index 1349a1b..555dad5 100644
--- a/src/esx/esx_vi.h
+++ b/src/esx/esx_vi.h
@@ -2,7 +2,7 @@
/*
* esx_vi.h: client for the VMware VI API 2.5 to manage ESX hosts
*
- * Copyright (C) 2009 Matthias Bolte <matthias.bolte(a)googlemail.com>
+ * Copyright (C) 2009-2010 Matthias Bolte <matthias.bolte(a)googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -61,8 +61,9 @@ enum _esxVI_ProductVersion {
enum _esxVI_Occurrence {
esxVI_Occurrence_Undefined = 0,
esxVI_Occurrence_RequiredItem,
+ esxVI_Occurrence_RequiredList,
esxVI_Occurrence_OptionalItem,
- esxVI_Occurrence_List,
+ esxVI_Occurrence_OptionalList,
esxVI_Occurrence_None
};
@@ -132,7 +133,7 @@ struct _esxVI_EnumerationValue {
};
struct _esxVI_Enumeration {
- const char *type;
+ esxVI_Type type;
esxVI_EnumerationValue values[10];
};
diff --git a/src/esx/esx_vi_generator.input b/src/esx/esx_vi_generator.input
new file mode 100644
index 0000000..06dddbf
--- /dev/null
+++ b/src/esx/esx_vi_generator.input
@@ -0,0 +1,426 @@
+#
+# Definitions of vSphere API 2.5 enumeration and objects types used as input
+# for the esx_vi_generator.py script.
+#
+# This format is line-based, so end-of-line is important.
+#
+#
+# Enumeration definition:
+#
+# enum <name>
+# <value>
+# ...
+# end
+#
+#
+# Object definition:
+#
+# object <name> [extends <name>]
+# <type> <name> <occurrence>
+# ...
+# end
+#
+# Possible values for the <occurrence> field are:
+#
+# - r for a required item
+# - rl for a required list
+# - o for an optional item
+# - ol for an optional list
+# - i for an ignored item or list
+#
+# Object member sequence has to match the WSDL sequence
+#
+
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# Enumerations
+#
+
+enum ManagedEntityStatus
+ gray
+ green
+ yellow
+ red
+end
+
+
+enum ObjectUpdateKind
+ modify
+ enter
+ leave
+end
+
+
+enum PerfStatsType
+ absolute
+ delta
+ rate
+end
+
+
+enum PerfSummaryType
+ average
+ maximum
+ minimum
+ latest
+ summation
+ none
+end
+
+
+enum PropertyChangeOp
+ add
+ remove
+ assign
+ indirectRemove
+end
+
+
+enum SharesLevel
+ low
+ normal
+ high
+ custom
+end
+
+
+enum TaskInfoState
+ queued
+ running
+ success
+ error
+end
+
+
+enum VirtualMachineMovePriority
+ lowPriority
+ highPriority
+ defaultPriority
+end
+
+
+enum VirtualMachinePowerState
+ poweredOff
+ poweredOn
+ suspended
+end
+
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# Objects
+#
+
+object AboutInfo
+ String name r
+ String fullName r
+ String vendor r
+ String version r
+ String build r
+ String localeVersion o
+ String localeBuild o
+ String osType r
+ String productLineId r
+ String apiType r
+ String apiVersion r
+end
+
+
+object ChoiceOption extends OptionType
+ ElementDescription choiceInfo rl
+ Int defaultIndex o
+end
+
+
+object Description
+ String label r
+ String summary r
+end
+
+
+object DynamicProperty
+ String name r
+ AnyType val r
+end
+
+
+object ElementDescription extends Description
+ String key r
+end
+
+
+object Event
+ Int key r
+ Int chainId r
+ DateTime createdTime r
+ String userName r
+ DatacenterEventArgument datacenter i
+ ComputeResourceEventArgument computeResource i
+ HostEventArgument host i
+ VmEventArgument vm i
+ String fullFormattedMessage o
+end
+
+
+object HostCpuIdInfo
+ Int level r
+ String vendor o
+ String eax o
+ String ebx o
+ String ecx o
+ String edx o
+end
+
+
+object ObjectContent
+ ManagedObjectReference obj r
+ DynamicProperty propSet ol
+ MissingProperty missingSet i
+end
+
+
+object ObjectSpec
+ ManagedObjectReference obj r
+ Boolean skip o
+ SelectionSpec selectSet ol
+end
+
+
+object ObjectUpdate
+ ObjectUpdateKind kind r
+ ManagedObjectReference obj r
+ PropertyChange changeSet ol
+ MissingProperty missingSet i
+end
+
+
+object OptionType
+ Boolean valueIsReadonly o
+end
+
+
+object PerfCounterInfo
+ Int key r
+ ElementDescription nameInfo r
+ ElementDescription groupInfo r
+ ElementDescription unitInfo r
+ PerfSummaryType rollupType r
+ PerfStatsType statsType r
+ Int level o
+ Int associatedCounterId ol
+end
+
+
+object PerfEntityMetric extends PerfEntityMetricBase
+ PerfSampleInfo sampleInfo ol
+ PerfMetricSeries value ol
+end
+
+
+object PerfEntityMetricBase
+ ManagedObjectReference entity r
+end
+
+
+object PerfMetricId
+ Int counterId r
+ String instance r
+end
+
+
+object PerfMetricIntSeries extends PerfMetricSeries
+ Long value ol
+end
+
+
+object PerfMetricSeries
+ PerfMetricId id r
+end
+
+
+object PerfQuerySpec
+ ManagedObjectReference entity r
+ DateTime startTime o
+ DateTime endTime o
+ Int maxSample o
+ PerfMetricId metricId ol
+ Int intervalId o
+ String format o
+end
+
+
+object PerfSampleInfo
+ DateTime timestamp r
+ Int interval r
+end
+
+
+object PropertyChange
+ String name r
+ PropertyChangeOp op r
+ AnyType val o
+end
+
+
+object PropertyFilterSpec
+ PropertySpec propSet rl
+ ObjectSpec objectSet rl
+end
+
+
+object PropertyFilterUpdate
+ ManagedObjectReference filter r
+ ObjectUpdate objectSet ol
+ MissingObject missingSet i
+end
+
+
+object PropertySpec
+ String type r
+ Boolean all o
+ String pathSet ol
+end
+
+
+object ResourceAllocationInfo
+ Long reservation o
+ Boolean expandableReservation o
+ Long limit o
+ SharesInfo shares o
+ Long overheadLimit o
+end
+
+
+object ResourcePoolResourceUsage
+ Long reservationUsed r
+ Long reservationUsedForVm r
+ Long unreservedForPool r
+ Long unreservedForVm r
+ Long overallUsage r
+ Long maxUsage r
+end
+
+
+object SelectionSpec
+ String name o
+end
+
+
+object ServiceContent
+ ManagedObjectReference rootFolder r
+ ManagedObjectReference propertyCollector r
+ ManagedObjectReference viewManager o
+ AboutInfo about r
+ ManagedObjectReference setting o
+ ManagedObjectReference userDirectory o
+ ManagedObjectReference sessionManager o
+ ManagedObjectReference authorizationManager o
+ ManagedObjectReference perfManager o
+ ManagedObjectReference scheduledTaskManager o
+ ManagedObjectReference alarmManager o
+ ManagedObjectReference eventManager o
+ ManagedObjectReference taskManager o
+ ManagedObjectReference extensionManager o
+ ManagedObjectReference customizationSpecManager o
+ ManagedObjectReference customFieldsManager o
+ ManagedObjectReference accountManager o
+ ManagedObjectReference diagnosticManager o
+ ManagedObjectReference licenseManager o
+ ManagedObjectReference searchIndex o
+ ManagedObjectReference fileManager o
+ ManagedObjectReference virtualDiskManager o
+ ManagedObjectReference virtualizationManager o
+end
+
+
+object SharesInfo
+ Int shares r
+ SharesLevel level r
+end
+
+
+object TaskInfo
+ String key r
+ ManagedObjectReference task r
+ String name o
+ String descriptionId r
+ ManagedObjectReference entity o
+ String entityName o
+ ManagedObjectReference locked ol
+ TaskInfoState state r
+ Boolean cancelled r
+ Boolean cancelable r
+ LocalizedMethodFault error i
+ AnyType result o
+ Int progress o
+ TaskReason reason i
+ DateTime queueTime r
+ DateTime startTime o
+ DateTime completeTime o
+ Int eventChainId r
+end
+
+
+object TraversalSpec extends SelectionSpec
+ String type r
+ String path r
+ Boolean skip o
+ SelectionSpec selectSet ol
+end
+
+
+object UpdateSet
+ String version r
+ PropertyFilterUpdate filterSet ol
+end
+
+
+object UserSession
+ String key r
+ String userName r
+ String fullName r
+ DateTime loginTime r
+ DateTime lastActiveTime r
+ String locale r
+ String messageLocale r
+end
+
+
+object VirtualMachineConfigSpec
+ String changeVersion o
+ String name o
+ String version o
+ String uuid o
+ Long npivNodeWorldWideName ol
+ Long npivPortWorldWideName ol
+ String npivWorldWideNameType o
+ String npivWorldWideNameOp o
+ String locationId o
+ String guestId o
+ String alternateGuestName o
+ String annotation o
+ VirtualMachineFileInfo files i
+ ToolsConfigInfo tools i
+ VirtualMachineFlagInfo flags i
+ VirtualMachineConsolePreferences consolePreferences i
+ VirtualMachineDefaultPowerOpInfo powerOpInfo i
+ Int numCPUs o
+ Long memoryMB o
+ VirtualDeviceConfigSpec deviceChange i
+ ResourceAllocationInfo cpuAllocation o
+ ResourceAllocationInfo memoryAllocation o
+ VirtualMachineAffinityInfo cpuAffinity i
+ VirtualMachineAffinityInfo memoryAffinity i
+ VirtualMachineNetworkShaperInfo networkShaper i
+ VirtualMachineCpuIdInfoSpec cpuFeatureMask i
+ OptionValue extraConfig i
+ String swapPlacement o
+ VirtualMachineBootOptions bootOptions i
+end
+
+
+object VirtualMachineQuestionInfo
+ String id r
+ String text r
+ ChoiceOption choice r
+ VirtualMachineMessage message i
+end
diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
new file mode 100755
index 0000000..5ca6138
--- /dev/null
+++ b/src/esx/esx_vi_generator.py
@@ -0,0 +1,1025 @@
+#!/usr/bin/python
+
+#
+# esx_vi_generator.py: generates most of the SOAP type mapping code
+#
+# Copyright (C) 2010 Matthias Bolte <matthias.bolte(a)googlemail.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+import sys
+import os
+import os.path
+
+
+
+
+
+
+class Property:
+ OCCURRENCE__REQUIRED_ITEM = "r"
+ OCCURRENCE__REQUIRED_LIST = "rl"
+ OCCURRENCE__OPTIONAL_ITEM = "o"
+ OCCURRENCE__OPTIONAL_LIST = "ol"
+ OCCURRENCE__IGNORED = "i"
+
+ valid_occurrences = [OCCURRENCE__REQUIRED_ITEM,
+ OCCURRENCE__REQUIRED_LIST,
+ OCCURRENCE__OPTIONAL_ITEM,
+ OCCURRENCE__OPTIONAL_LIST,
+ OCCURRENCE__IGNORED]
+
+ def __init__(self, type, name, occurrence):
+ self.type = type
+ self.name = name
+ self.occurrence = occurrence
+
+ def is_enum(self):
+ global predefined_enums
+ global enums_by_name
+
+ return self.type in predefined_enums or self.type in enums_by_name
+
+ def generate_struct_member(self):
+ if self.occurrence == Property.OCCURRENCE__IGNORED:
+ return " /* FIXME: %s is currently ignored */\n" % self.name
+ else:
+ string = " %s%s; " % (self.get_type_string(), self.name)
+
+ while len(string) < 59:
+ string += " "
+
+ return string + "/* %s */\n" % self.get_occurrence_string()
+
+ def generate_free_code(self):
+ if self.type == "String" and \
+ self.occurrence not in [Property.OCCURRENCE__REQUIRED_LIST,
+ Property.OCCURRENCE__OPTIONAL_LIST,
+ Property.OCCURRENCE__IGNORED]:
+ return " VIR_FREE(item->%s);\n" % self.name
+ elif self.is_enum():
+ return ""
+ else:
+ if self.occurrence == Property.OCCURRENCE__IGNORED:
+ return " /* FIXME: %s is currently ignored */\n" % self.name
+ else:
+ return " esxVI_%s_Free(&item->%s);\n" % (self.type, self.name)
+
+ def generate_validate_code(self):
+ if self.occurrence in [Property.OCCURRENCE__REQUIRED_ITEM,
+ Property.OCCURRENCE__REQUIRED_LIST]:
+ return " ESX_VI__TEMPLATE__PROPERTY__REQUIRE(%s)\n" % self.name
+ elif self.occurrence == Property.OCCURRENCE__IGNORED:
+ return " /* FIXME: %s is currently ignored */\n" % self.name
+ else:
+ return ""
+
+ def generate_deep_copy_code(self):
+ if self.occurrence == Property.OCCURRENCE__IGNORED:
+ return " /* FIXME: %s is currently ignored */\n" % self.name
+ elif self.occurrence in [Property.OCCURRENCE__REQUIRED_LIST,
+ Property.OCCURRENCE__OPTIONAL_LIST]:
+ return " ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_LIST(%s, %s)\n" % (self.type, self.name)
+ elif self.type == "String":
+ return " ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_VALUE(String, %s)\n" % self.name
+ else:
+ return " ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY(%s, %s)\n" % (self.type, self.name)
+
+ def generate_serialize_code(self):
+ if self.occurrence == Property.OCCURRENCE__IGNORED:
+ return " /* FIXME: %s is currently ignored */\n" % self.name
+ elif self.occurrence in [Property.OCCURRENCE__REQUIRED_LIST,
+ Property.OCCURRENCE__OPTIONAL_LIST]:
+ return " ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(%s, %s)\n" % (self.type, self.name)
+ elif self.type == "String":
+ return " ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, %s)\n" % self.name
+ else:
+ return " ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(%s, %s)\n" % (self.type, self.name)
+
+ def generate_deserialize_code(self):
+ if self.occurrence == Property.OCCURRENCE__IGNORED:
+ return " ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_IGNORE(%s) /* FIXME */\n" % self.name
+ elif self.occurrence in [Property.OCCURRENCE__REQUIRED_LIST,
+ Property.OCCURRENCE__OPTIONAL_LIST]:
+ return " ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(%s, %s)\n" % (self.type, self.name)
+ elif self.type == "String":
+ return " ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, %s)\n" % self.name
+ else:
+ return " ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(%s, %s)\n" % (self.type, self.name)
+
+ def get_type_string(self):
+ if self.type == "String" and \
+ self.occurrence not in [Property.OCCURRENCE__REQUIRED_LIST,
+ Property.OCCURRENCE__OPTIONAL_LIST]:
+ return "char *"
+ elif self.is_enum():
+ return "esxVI_%s " % self.type
+ else:
+ return "esxVI_%s *" % self.type
+
+ def get_occurrence_string(self):
+ if self.occurrence == Property.OCCURRENCE__REQUIRED_ITEM:
+ return "required"
+ elif self.occurrence == Property.OCCURRENCE__REQUIRED_LIST:
+ return "required, list"
+ elif self.occurrence == Property.OCCURRENCE__OPTIONAL_ITEM:
+ return "optional"
+ elif self.occurrence == Property.OCCURRENCE__OPTIONAL_LIST:
+ return "optional, list"
+
+ raise ValueError("unknown cardinality value '%s'" % self.cardinality)
+
+
+
+
+
+
+
+
+class Object:
+ FEATURE__DYNAMIC_CAST = (1 << 1)
+ FEATURE__LIST = (1 << 2)
+ FEATURE__DEEP_COPY = (1 << 3)
+ FEATURE__ANY_TYPE = (1 << 4)
+ FEATURE__SERIALIZE = (1 << 5)
+ FEATURE__DESERIALIZE = (1 << 6)
+
+ def __init__(self, name, extends, properties, features = 0, extended_by = None):
+ self.name = name
+ self.extends = extends
+ self.features = features | Object.FEATURE__SERIALIZE | Object.FEATURE__DESERIALIZE
+ self.properties = properties
+ self.extended_by = extended_by
+
+ self.properties_by_name = {}
+
+ for property in self.properties:
+ self.properties_by_name[property.name] = property
+
+ def generate_struct_members(self, add_banner = False, struct_gap = False):
+ global objects_by_name
+ members = ""
+
+ if self.extends is None:
+ struct_gap = True
+ string = " esxVI_Type _type; "
+
+ while len(string) < 59:
+ string += " "
+
+ members += string + "/* required */\n"
+
+ if struct_gap and self.extends is None:
+ members += "\n"
+
+ if self.extends is not None:
+ members += objects_by_name[self.extends].generate_struct_members(add_banner = True, struct_gap = False) + "\n"
+
+ if self.extends is not None or add_banner:
+ members += " /* %s */\n" % self.name
+
+ for property in self.properties:
+ members += property.generate_struct_member()
+
+ if len(self.properties) < 1:
+ members += " /* no properties */\n"
+
+ return members
+
+ def generate_free_code(self, add_banner = False):
+ global objects_by_name
+ source = ""
+
+ if self.extends is not None:
+ source += objects_by_name[self.extends].generate_free_code(add_banner = True) + "\n"
+
+ if self.extends is not None or add_banner:
+ source += " /* %s */\n" % self.name
+
+ if len(self.properties) < 1:
+ source += " /* no properties */\n"
+ else:
+ string = ""
+
+ for property in self.properties:
+ string += property.generate_free_code()
+
+ if len(string) < 1:
+ source += " /* no properties to be freed */\n"
+ else:
+ source += string
+
+ return source
+
+ def generate_validate_code(self, add_banner = False):
+ global objects_by_name
+ source = ""
+
+ if self.extends is not None:
+ source += objects_by_name[self.extends].generate_validate_code(add_banner = True) + "\n"
+
+ if self.extends is not None or add_banner:
+ source += " /* %s */\n" % self.name
+
+ if len(self.properties) < 1:
+ source += " /* no properties */\n"
+ else:
+ string = ""
+
+ for property in self.properties:
+ string += property.generate_validate_code()
+
+ if len(string) < 1:
+ source += " /* no required properties */\n"
+ else:
+ source += string
+
+ return source
+
+ def generate_dynamic_cast_code(self):
+ global objects_by_name
+ source = ""
+
+ if self.extended_by is not None:
+ source += " /* %s */\n" % self.name
+
+ for extended_by in self.extended_by:
+ source += " ESX_VI__TEMPLATE__DYNAMIC_CAST__ACCEPT(%s)\n" % extended_by
+
+ for extended_by in self.extended_by:
+ source += objects_by_name[extended_by].generate_dynamic_cast_code()
+
+ return source
+
+ def generate_deep_copy_code(self, add_banner = False):
+ global objects_by_name
+ source = ""
+
+ if self.extends is not None:
+ source += objects_by_name[self.extends].generate_deep_copy_code(add_banner = True) + "\n"
+
+ if self.extends is not None or add_banner:
+ source += " /* %s */\n" % self.name
+
+ if len(self.properties) < 1:
+ source += " /* no properties */\n"
+ else:
+ string = ""
+
+ for property in self.properties:
+ string += property.generate_deep_copy_code()
+
+ if len(string) < 1:
+ source += " /* no properties to be deep copied */\n"
+ else:
+ source += string
+
+ return source
+
+ def generate_serialize_code(self, add_banner = False):
+ global objects_by_name
+ source = ""
+
+ if self.extends is not None:
+ source += objects_by_name[self.extends].generate_serialize_code(add_banner = True) + "\n"
+
+ if self.extends is not None or add_banner:
+ source += " /* %s */\n" % self.name
+
+ if len(self.properties) < 1:
+ source += " /* no properties */\n"
+ else:
+ for property in self.properties:
+ source += property.generate_serialize_code()
+
+ return source
+
+ def generate_deserialize_code(self, add_banner = False):
+ global objects_by_name
+ source = ""
+
+ if self.extends is not None:
+ source += objects_by_name[self.extends].generate_deserialize_code(add_banner = True) + "\n"
+
+ if self.extends is not None or add_banner:
+ source += " /* %s */\n" % self.name
+
+ if len(self.properties) < 1:
+ source += " /* no properties */\n"
+ else:
+ for property in self.properties:
+ source += property.generate_deserialize_code()
+
+ return source
+
+ def generate_typedef(self):
+ return "typedef struct _esxVI_%s esxVI_%s;\n" % (self.name, self.name)
+
+ def generate_typeenum(self):
+ return " esxVI_Type_%s,\n" % self.name
+
+ def generate_typetostring(self):
+ string = " case esxVI_Type_%s:\n" % self.name
+ string += " return \"%s\";\n\n" % self.name
+
+ return string
+
+ def generate_typefromstring(self):
+ string = " else if (STREQ(type, \"%s\")) {\n" % self.name
+ string += " return esxVI_Type_%s;\n" % self.name
+ string += " }\n"
+
+ return string
+
+ def generate_header(self):
+ header = "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"
+ header += " * VI Type: %s\n" % self.name
+
+ if self.extends is not None:
+ header += " * extends %s\n" % self.extends
+
+ first = True
+
+ if self.extended_by is not None:
+ for extended_by in self.extended_by:
+ if first:
+ header += " * extended by %s\n" % extended_by
+ first = False
+ else:
+ header += " * %s\n" % extended_by
+
+ header += " */\n\n"
+
+ # struct
+ header += "struct _esxVI_%s {\n" % self.name
+
+ if self.features & Object.FEATURE__LIST:
+ string = " esxVI_%s *_next; " % self.name
+ else:
+ string = " esxVI_%s *_unused; " % self.name
+
+ while len(string) < 59:
+ string += " "
+
+ header += string + "/* optional */\n"
+
+ header += self.generate_struct_members(struct_gap = True)
+
+ header += "};\n\n"
+
+ # functions
+ header += "int esxVI_%s_Alloc(esxVI_%s **item);\n" % (self.name, self.name)
+ header += "void esxVI_%s_Free(esxVI_%s **item);\n" % (self.name, self.name)
+ header += "int esxVI_%s_Validate(esxVI_%s *item);\n" % (self.name, self.name)
+
+ if self.features & Object.FEATURE__DYNAMIC_CAST:
+ if self.extended_by is not None or self.extends is not None:
+ header += "esxVI_%s *esxVI_%s_DynamicCast(void *item);\n" % (self.name, self.name)
+ else:
+ report_error("cannot add dynamic cast support for an untyped object")
+
+ if self.features & Object.FEATURE__LIST:
+ header += "int esxVI_%s_AppendToList(esxVI_%s **list, esxVI_%s *item);\n" % (self.name, self.name, self.name)
+
+ if self.features & Object.FEATURE__DEEP_COPY:
+ header += "int esxVI_%s_DeepCopy(esxVI_%s **dst, esxVI_%s *src);\n" % (self.name, self.name, self.name)
+
+ if self.features & Object.FEATURE__LIST:
+ header += "int esxVI_%s_DeepCopyList(esxVI_%s **dstList, esxVI_%s *srcList);\n" % (self.name, self.name, self.name)
+
+ if self.features & Object.FEATURE__ANY_TYPE:
+ header += "int esxVI_%s_CastFromAnyType(esxVI_AnyType *anyType, esxVI_%s **item);\n" % (self.name, self.name)
+
+ if self.features & Object.FEATURE__LIST:
+ header += "int esxVI_%s_CastListFromAnyType(esxVI_AnyType *anyType, esxVI_%s **list);\n" % (self.name, self.name)
+
+ if self.features & Object.FEATURE__SERIALIZE:
+ header += "int esxVI_%s_Serialize(esxVI_%s *item, const char *element, virBufferPtr output);\n" % (self.name, self.name)
+
+ if self.features & Object.FEATURE__LIST:
+ header += "int esxVI_%s_SerializeList(esxVI_%s *list, const char *element, virBufferPtr output);\n" % (self.name, self.name)
+
+ if self.features & Object.FEATURE__DESERIALIZE:
+ header += "int esxVI_%s_Deserialize(xmlNodePtr node, esxVI_%s **item);\n" % (self.name, self.name)
+
+ if self.features & Object.FEATURE__LIST:
+ header += "int esxVI_%s_DeserializeList(xmlNodePtr node, esxVI_%s **list);\n" % (self.name, self.name)
+
+ header += "\n\n\n"
+
+ return header
+
+ def generate_source(self):
+ source = "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"
+ source += " * VI Type: %s\n" % self.name
+
+ if self.extends is not None:
+ source += " * extends %s\n" % self.extends
+
+ first = True
+
+ if self.extended_by is not None:
+ for extended_by in self.extended_by:
+ if first:
+ source += " * extended by %s\n" % extended_by
+ first = False
+ else:
+ source += " * %s\n" % extended_by
+
+ source += " */\n\n"
+
+ # functions
+ source += "/* esxVI_%s_Alloc */\n" % self.name
+ source += "ESX_VI__TEMPLATE__ALLOC(%s)\n\n" % self.name
+
+ # free
+ if self.extended_by is None:
+ source += "/* esxVI_%s_Free */\n" % self.name
+ source += "ESX_VI__TEMPLATE__FREE(%s,\n" % self.name
+ source += "{\n"
+
+ if self.features & Object.FEATURE__LIST:
+ source += " esxVI_%s_Free(&item->_next);\n\n" % self.name
+
+ source += self.generate_free_code()
+
+ source += "})\n\n"
+ else:
+ source += "/* esxVI_%s_Free */\n" % self.name
+ source += "ESX_VI__TEMPLATE__DYNAMIC_FREE(%s,\n" % self.name
+ source += "{\n"
+
+ for extended_by in self.extended_by:
+ source += " ESX_VI__TEMPLATE__DISPATCH__FREE(%s)\n" % extended_by
+
+ source += "},\n"
+ source += "{\n"
+
+ if self.features & Object.FEATURE__LIST:
+ source += " esxVI_%s_Free(&item->_next);\n\n" % self.name
+
+ source += self.generate_free_code()
+
+ source += "})\n\n"
+
+ # validate
+ source += "/* esxVI_%s_Validate */\n" % self.name
+ source += "ESX_VI__TEMPLATE__VALIDATE(%s,\n" % self.name
+ source += "{\n"
+
+ source += self.generate_validate_code()
+
+ source += "})\n\n"
+
+ # dynamic cast
+ if self.features & Object.FEATURE__DYNAMIC_CAST:
+ if self.extended_by is not None or self.extends is not None:
+ source += "/* esxVI_%s_DynamicCast */\n" % self.name
+ source += "ESX_VI__TEMPLATE__DYNAMIC_CAST(%s,\n" % self.name
+ source += "{\n"
+
+ source += self.generate_dynamic_cast_code()
+
+ source += "})\n\n"
+ else:
+ report_error("cannot add dynamic cast support for an untyped object")
+
+ # append to list
+ if self.features & Object.FEATURE__LIST:
+ source += "/* esxVI_%s_AppendToList */\n" % self.name
+ source += "ESX_VI__TEMPLATE__LIST__APPEND(%s)\n\n" % self.name
+
+ # deep copy
+ if self.extended_by is None:
+ if self.features & Object.FEATURE__DEEP_COPY:
+ source += "/* esxVI_%s_DeepCopy */\n" % self.name
+ source += "ESX_VI__TEMPLATE__DEEP_COPY(%s,\n" % self.name
+ source += "{\n"
+
+ source += self.generate_deep_copy_code()
+
+ source += "})\n\n"
+
+ if self.features & Object.FEATURE__LIST:
+ source += "/* esxVI_%s_DeepCopyList */\n" % self.name
+ source += "ESX_VI__TEMPLATE__LIST__DEEP_COPY(%s)\n\n" % self.name
+ else:
+ if self.features & Object.FEATURE__DEEP_COPY:
+ source += "/* esxVI_%s_DeepCopy */\n" % self.name
+ source += "ESX_VI__TEMPLATE__DYNAMIC_DEEP_COPY(%s)\n" % self.name
+ source += "{\n"
+
+ for extended_by in self.extended_by:
+ source += " ESX_VI__TEMPLATE__DISPATCH__DEEP_COPY(%s)\n" % extended_by
+
+ source += "},\n"
+ source += "{\n"
+
+ source += self.generate_deep_copy_code()
+
+ source += "})\n\n"
+
+ if self.features & Object.FEATURE__LIST:
+ source += "/* esxVI_%s_DeepCopyList */\n" % self.name
+ source += "ESX_VI__TEMPLATE__LIST__DEEP_COPY(%s)\n\n" % self.name
+
+ # cast from any type
+ if self.features & Object.FEATURE__ANY_TYPE:
+ source += "/* esxVI_%s_CastFromAnyType */\n" % self.name
+ source += "ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(%s)\n" % self.name
+
+ if self.features & Object.FEATURE__LIST:
+ source += "/* esxVI_%s_CastListFromAnyType */\n" % self.name
+ source += "ESX_VI__TEMPLATE__LIST__CAST_FROM_ANY_TYPE(%s)\n\n" % self.name
+
+ # serialize
+ if self.extended_by is None:
+ if self.features & Object.FEATURE__SERIALIZE:
+ source += "/* esxVI_%s_Serialize */\n" % self.name
+ source += "ESX_VI__TEMPLATE__SERIALIZE(%s,\n" % self.name
+ source += "{\n"
+
+ source += self.generate_serialize_code()
+
+ source += "})\n\n"
+
+ if self.features & Object.FEATURE__LIST:
+ source += "/* esxVI_%s_SerializeList */\n" % self.name
+ source += "ESX_VI__TEMPLATE__LIST__SERIALIZE(%s)\n\n" % self.name
+ else:
+ if self.features & Object.FEATURE__SERIALIZE:
+ source += "/* esxVI_%s_Serialize */\n" % self.name
+ source += "ESX_VI__TEMPLATE__DYNAMIC_SERIALIZE(%s,\n" % self.name
+ source += "{\n"
+
+ for extended_by in self.extended_by:
+ source += " ESX_VI__TEMPLATE__DISPATCH__SERIALIZE(%s)\n" % extended_by
+
+ source += "},\n"
+ source += "{\n"
+
+ source += self.generate_serialize_code()
+
+ source += "})\n\n"
+
+ if self.features & Object.FEATURE__LIST:
+ source += "/* esxVI_%s_SerializeList */\n" % self.name
+ source += "ESX_VI__TEMPLATE__LIST__SERIALIZE(%s)\n\n" % self.name
+
+ # deserilaize
+ if self.features & Object.FEATURE__DESERIALIZE:
+ source += "/* esxVI_%s_Deserialize */\n" % self.name
+ source += "ESX_VI__TEMPLATE__DESERIALIZE(%s,\n" % self.name
+ source += "{\n"
+
+ source += self.generate_deserialize_code()
+
+ source += "})\n\n"
+
+ if self.features & Object.FEATURE__LIST:
+ source += "/* esxVI_%s_DeserializeList */\n" % self.name
+ source += "ESX_VI__TEMPLATE__LIST__DESERIALIZE(%s)\n\n" % self.name
+
+ source += "\n\n"
+
+ return source
+
+
+
+
+
+
+
+
+class Enum:
+ FEATURE__ANY_TYPE = (1 << 1)
+ FEATURE__SERIALIZE = (1 << 2)
+ FEATURE__DESERIALIZE = (1 << 3)
+
+
+ def __init__(self, name, values, features = 0):
+ self.name = name
+ self.values = values
+ self.features = features | Enum.FEATURE__SERIALIZE | Enum.FEATURE__DESERIALIZE
+
+ def generate_typedef(self):
+ return "typedef enum _esxVI_%s esxVI_%s;\n" % (self.name, self.name)
+
+ def generate_typeenum(self):
+ return " esxVI_Type_%s,\n" % self.name
+
+ def generate_typetostring(self):
+ string = " case esxVI_Type_%s:\n" % self.name
+ string += " return \"%s\";\n\n" % self.name
+
+ return string
+
+ def generate_typefromstring(self):
+ string = " else if (STREQ(type, \"%s\")) {\n" % self.name
+ string += " return esxVI_Type_%s;\n" % self.name
+ string += " }\n"
+
+ return string
+
+ def generate_header(self):
+ header = "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"
+ header += " * VI Enum: %s\n" % self.name
+ header += " */\n\n"
+
+ # enum
+ header += "enum _esxVI_%s {\n" % self.name
+ header += " esxVI_%s_Undefined = 0,\n" % self.name
+
+ for value in self.values:
+ header += " esxVI_%s_%s,\n" % (self.name, capitalize_first(value))
+
+ header += "};\n\n"
+
+ # functions
+ if self.features & Enum.FEATURE__ANY_TYPE:
+ header += "int esxVI_%s_CastFromAnyType(esxVI_AnyType *anyType, esxVI_%s *item);\n" % (self.name, self.name)
+
+ if self.features & Enum.FEATURE__SERIALIZE:
+ header += "int esxVI_%s_Serialize(esxVI_%s item, const char *element, virBufferPtr output);\n" % (self.name, self.name)
+
+ if self.features & Enum.FEATURE__DESERIALIZE:
+ header += "int esxVI_%s_Deserialize(xmlNodePtr node, esxVI_%s *item);\n" % (self.name, self.name)
+
+ header += "\n\n\n"
+
+ return header
+
+ def generate_source(self):
+ source = "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n"
+ source += " * VI Enum: %s\n" % self.name
+ source += " */\n\n"
+
+ source += "static const esxVI_Enumeration _esxVI_%s_Enumeration = {\n" % self.name
+ source += " esxVI_Type_%s, {\n" % self.name
+
+ for value in self.values:
+ source += " { \"%s\", esxVI_%s_%s },\n" % (value, self.name, capitalize_first(value))
+
+ source += " { NULL, -1 },\n"
+ source += " },\n"
+ source += "};\n\n"
+
+ # functions
+ if self.features & Enum.FEATURE__ANY_TYPE:
+ source += "/* esxVI_%s_CastFromAnyType */\n" % self.name
+ source += "ESX_VI__TEMPLATE__ENUMERATION__CAST_FROM_ANY_TYPE(%s)\n\n" % self.name
+
+ if self.features & Enum.FEATURE__SERIALIZE:
+ source += "/* esxVI_%s_Serialize */\n" % self.name
+ source += "ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(%s)\n\n" % self.name
+
+ if self.features & Enum.FEATURE__DESERIALIZE:
+ source += "/* esxVI_%s_Deserialize */\n" % self.name
+ source += "ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(%s)\n\n" % self.name
+
+ source += "\n\n"
+
+ return source
+
+
+
+
+
+def report_error(message):
+ print "error: " + message
+ sys.exit(1)
+
+
+
+def usage():
+ print "%s <input-filename> <output-directory>" % sys.argv[0]
+ sys.exit(0)
+
+
+
+def capitalize_first(string):
+ return string[:1].upper() + string[1:]
+
+
+
+def parse_object(block):
+ # expected format: object <name> [extends <name>]
+ header_items = block[0][1].split()
+
+ if len(header_items) < 2:
+ report_error("line %d: invalid block header" % (number))
+
+ assert header_items[0] == "object"
+
+ name = header_items[1]
+ extends = None
+
+ if len(header_items) > 2:
+ if header_items[2] != "extends":
+ report_error("line %d: invalid block header" % (number))
+ else:
+ extends = header_items[3]
+
+ properties = []
+
+ for line in block[1:]:
+ # expected format: <type> <name> <occurrence>
+ items = line[1].split()
+
+ if len(items) != 3:
+ report_error("line %d: invalid property" % line[0])
+
+ if items[2] not in Property.valid_occurrences:
+ report_error("line %d: invalid occurrence" % line[0])
+
+ properties.append(Property(type = items[0], name = items[1],
+ occurrence = items[2]))
+
+ return Object(name = name, extends = extends, properties = properties)
+
+
+
+def parse_enum(block):
+ # expected format: enum <name>
+ header_items = block[0][1].split()
+
+ if len(header_items) < 2:
+ report_error("line %d: invalid block header" % (number))
+
+ assert header_items[0] == "enum"
+
+ name = header_items[1]
+
+ values = []
+
+ for line in block[1:]:
+ # expected format: <value>
+ values.append(line[1])
+
+ return Enum(name = name, values = values)
+
+
+
+def inherit_features(obj):
+ if obj.extended_by is not None:
+ for extended_by in obj.extended_by:
+ objects_by_name[extended_by].features |= obj.features
+
+ if obj.extends is not None:
+ objects_by_name[obj.extends].features |= obj.features
+
+ if obj.extended_by is not None:
+ for extended_by in obj.extended_by:
+ inherit_features(objects_by_name[extended_by])
+
+
+
+def is_known_type(type):
+ return type in predefined_objects or \
+ type in predefined_enums or \
+ type in objects_by_name or \
+ type in enums_by_name
+
+
+
+def open_and_print(filename):
+ if filename.startswith("./"):
+ print " GEN " + filename[2:]
+ else:
+ print " GEN " + filename
+
+ return open(filename, "wb")
+
+
+
+
+
+
+
+
+
+
+predefined_enums = ["Boolean"]
+
+predefined_objects = ["AnyType",
+ "Int",
+ "Long",
+ "String",
+ "DateTime",
+ "ManagedObjectReference"]
+
+
+additional_enum_features = { "ManagedEntityStatus" : Enum.FEATURE__ANY_TYPE,
+ "TaskInfoState" : Enum.FEATURE__ANY_TYPE,
+ "VirtualMachinePowerState" : Enum.FEATURE__ANY_TYPE }
+
+
+additional_object_features = { "Event" : Object.FEATURE__LIST,
+ "HostCpuIdInfo" : Object.FEATURE__ANY_TYPE | Object.FEATURE__LIST,
+ "ManagedObjectReference" : Object.FEATURE__ANY_TYPE,
+ "ObjectContent" : Object.FEATURE__DEEP_COPY | Object.FEATURE__LIST,
+ "PerfCounterInfo" : Object.FEATURE__LIST,
+ "PerfEntityMetric" : Object.FEATURE__LIST,
+ "PerfQuerySpec" : Object.FEATURE__LIST,
+ "PerfMetricIntSeries" : Object.FEATURE__DYNAMIC_CAST,
+ "PropertyFilterSpec" : Object.FEATURE__LIST,
+ "ResourcePoolResourceUsage" : Object.FEATURE__ANY_TYPE,
+ "SelectionSpec" : Object.FEATURE__DYNAMIC_CAST,
+ "SharesInfo" : Object.FEATURE__ANY_TYPE,
+ "TaskInfo" : Object.FEATURE__ANY_TYPE | Object.FEATURE__LIST,
+ "UserSession" : Object.FEATURE__ANY_TYPE,
+ "VirtualMachineQuestionInfo" : Object.FEATURE__ANY_TYPE }
+
+
+removed_object_features = { "DynamicProperty" : Object.FEATURE__SERIALIZE,
+ "ObjectContent" : Object.FEATURE__SERIALIZE,
+ "ObjectUpdate" : Object.FEATURE__SERIALIZE,
+ "PropertyChange" : Object.FEATURE__SERIALIZE,
+ "PropertyFilterUpdate" : Object.FEATURE__SERIALIZE,
+ "TaskInfo" : Object.FEATURE__SERIALIZE,
+ "UpdateSet" : Object.FEATURE__SERIALIZE,
+ "VirtualMachineConfigInfo" : Object.FEATURE__SERIALIZE }
+
+
+
+
+if "srcdir" in os.environ:
+ input_filename = os.path.join(os.environ["srcdir"], "esx/esx_vi_generator.input")
+ output_dirname = os.path.join(os.environ["srcdir"], "esx")
+else:
+ input_filename = os.path.join(os.getcwd(), "esx_vi_generator.input")
+ output_dirname = os.getcwd()
+
+
+
+typedef = open_and_print(os.path.join(output_dirname, "esx_vi_types.generated.typedef"))
+typeenum = open_and_print(os.path.join(output_dirname, "esx_vi_types.generated.typeenum"))
+typetostring = open_and_print(os.path.join(output_dirname, "esx_vi_types.generated.typetostring"))
+typefromstring = open_and_print(os.path.join(output_dirname, "esx_vi_types.generated.typefromstring"))
+header = open_and_print(os.path.join(output_dirname, "esx_vi_types.generated.h"))
+source = open_and_print(os.path.join(output_dirname, "esx_vi_types.generated.c"))
+
+
+
+number = 0
+objects_by_name = {}
+enums_by_name = {}
+block = None
+
+
+
+for line in file(input_filename, "rb").readlines():
+ number += 1
+
+ if "#" in line:
+ line = line[:line.index("#")]
+
+ line = line.lstrip().rstrip()
+
+ if len(line) < 1:
+ continue
+
+ if line.startswith("object") or line.startswith("enum"):
+ if block is not None:
+ report_error("line %d: nested block found" % (number))
+ else:
+ block = []
+
+ if block is not None:
+ if line == "end":
+ if block[0][1].startswith("object"):
+ obj = parse_object(block)
+ objects_by_name[obj.name] = obj
+ else:
+ enum = parse_enum(block)
+ enums_by_name[enum.name] = enum
+
+ block = None
+ else:
+ block.append((number, line))
+
+
+
+for enum in enums_by_name.values():
+ # apply additional features
+ if enum.name in additional_enum_features:
+ enum.features |= additional_enum_features[enum.name]
+
+
+
+for obj in objects_by_name.values():
+ for property in obj.properties:
+ if property.occurrence != Property.OCCURRENCE__IGNORED and \
+ not is_known_type(property.type):
+ report_error("object '%s' contains unknown property type '%s'" % (obj.name, property.type))
+
+ if obj.extends is not None:
+ if not is_known_type(obj.extends):
+ report_error("object '%s' extends unknown object '%s'" % (obj.name, obj.extends))
+
+ # detect list usage
+ for property in obj.properties:
+ if (property.occurrence == Property.OCCURRENCE__REQUIRED_LIST or \
+ property.occurrence == Property.OCCURRENCE__OPTIONAL_LIST) and \
+ property.type not in predefined_objects:
+ objects_by_name[property.type].features |= Object.FEATURE__LIST
+
+ # apply/remove additional features
+ if obj.name in additional_object_features:
+ obj.features |= additional_object_features[obj.name]
+
+ if obj.name in removed_object_features:
+ obj.features &= ~removed_object_features[obj.name]
+
+ # spread deep copy onto properties
+ if obj.features & Object.FEATURE__DEEP_COPY:
+ for property in obj.properties:
+ if property.occurrence != Property.OCCURRENCE__IGNORED and \
+ property.type not in predefined_objects:
+ objects_by_name[property.type].features |= Object.FEATURE__DEEP_COPY
+
+ # detect extended_by relation
+ if obj.extends is not None:
+ extended_obj = objects_by_name[obj.extends]
+
+ if extended_obj.extended_by is None:
+ extended_obj.extended_by = [obj.name]
+ else:
+ extended_obj.extended_by.append(obj.name)
+
+
+
+
+
+for obj in objects_by_name.values():
+ inherit_features(obj)
+
+
+
+
+
+typedef.write("/* Generated by esx_vi_generator.py */\n\n\n\n")
+typeenum.write("/* Generated by esx_vi_generator.py */\n\n")
+typetostring.write("/* Generated by esx_vi_generator.py */\n\n")
+typefromstring.write("/* Generated by esx_vi_generator.py */\n\n")
+header.write("/* Generated by esx_vi_generator.py */\n\n\n\n")
+source.write("/* Generated by esx_vi_generator.py */\n\n\n\n")
+
+
+typedef.write("/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n" +
+ " * VI Enums\n" +
+ " */\n\n")
+
+
+
+names = enums_by_name.keys()
+names.sort()
+
+
+for name in names:
+ typedef.write(enums_by_name[name].generate_typedef())
+ typeenum.write(enums_by_name[name].generate_typeenum())
+ typetostring.write(enums_by_name[name].generate_typetostring())
+ typefromstring.write(enums_by_name[name].generate_typefromstring())
+ header.write(enums_by_name[name].generate_header())
+ source.write(enums_by_name[name].generate_source())
+
+
+
+typedef.write("\n\n\n" +
+ "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n" +
+ " * VI Types\n" +
+ " */\n\n")
+
+typeenum.write("\n")
+
+typetostring.write("\n")
+
+typefromstring.write("\n")
+
+
+
+names = objects_by_name.keys()
+names.sort()
+
+
+for name in names:
+ typedef.write(objects_by_name[name].generate_typedef())
+ typeenum.write(objects_by_name[name].generate_typeenum())
+ typetostring.write(objects_by_name[name].generate_typetostring())
+ typefromstring.write(objects_by_name[name].generate_typefromstring())
+ header.write(objects_by_name[name].generate_header())
+ source.write(objects_by_name[name].generate_source())
diff --git a/src/esx/esx_vi_methods.c b/src/esx/esx_vi_methods.c
index 07cd82a..f1234ae 100644
--- a/src/esx/esx_vi_methods.c
+++ b/src/esx/esx_vi_methods.c
@@ -304,7 +304,7 @@ ESX_VI__METHOD(RetrieveProperties,
(esxVI_Context *ctx,
esxVI_PropertyFilterSpec *specSet, /* list */
esxVI_ObjectContent **objectContentList),
- List,
+ OptionalList,
{
ESX_VI__METHOD__CHECK_SERVICE()
ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(objectContentList)
@@ -344,8 +344,7 @@ ESX_VI__METHOD(PowerOnVM_Task,
virtualMachine)
},
{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task,
- "Task") < 0) {
+ if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
goto failure;
}
})
@@ -369,8 +368,7 @@ ESX_VI__METHOD(PowerOffVM_Task,
virtualMachine)
},
{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task,
- "Task") < 0) {
+ if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
goto failure;
}
})
@@ -394,8 +392,7 @@ ESX_VI__METHOD(SuspendVM_Task,
virtualMachine)
},
{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task,
- "Task") < 0) {
+ if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
goto failure;
}
})
@@ -428,8 +425,7 @@ ESX_VI__METHOD(MigrateVM_Task,
ESX_VI__METHOD__PARAMETER__SERIALIZE(VirtualMachinePowerState, state)
},
{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task,
- "Task") < 0) {
+ if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
goto failure;
}
})
@@ -456,8 +452,7 @@ ESX_VI__METHOD(ReconfigVM_Task,
ESX_VI__METHOD__PARAMETER__SERIALIZE(VirtualMachineConfigSpec, spec)
},
{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task,
- "Task") < 0) {
+ if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
goto failure;
}
})
@@ -490,8 +485,7 @@ ESX_VI__METHOD(RegisterVM_Task,
ESX_VI__METHOD__PARAMETER__SERIALIZE(ManagedObjectReference, host)
},
{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task,
- "Task") < 0) {
+ if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
goto failure;
}
})
@@ -583,8 +577,8 @@ ESX_VI__METHOD(CreateFilter,
ESX_VI__METHOD__PARAMETER__SERIALIZE(Boolean, partialUpdates)
},
{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, propertyFilter,
- "PropertyFilter") < 0) {
+ if (esxVI_ManagedObjectReference_Deserialize(response->node,
+ propertyFilter) < 0) {
goto failure;
}
})
@@ -684,7 +678,7 @@ ESX_VI__METHOD(ValidateMigration,
esxVI_ManagedObjectReference *pool,
esxVI_ManagedObjectReference *host,
esxVI_Event **eventList),
- List,
+ OptionalList,
{
ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(eventList)
},
@@ -736,10 +730,8 @@ ESX_VI__METHOD(FindByIp,
ESX_VI__METHOD__PARAMETER__SERIALIZE(Boolean, vmSearch)
},
{
- if (esxVI_ManagedObjectReference_Deserialize
- (response->node, managedObjectReference,
- vmSearch == esxVI_Boolean_True ? "VirtualMachine"
- : "HostSystem") < 0) {
+ if (esxVI_ManagedObjectReference_Deserialize(response->node,
+ managedObjectReference) < 0) {
goto failure;
}
})
@@ -771,10 +763,8 @@ ESX_VI__METHOD(FindByUuid,
ESX_VI__METHOD__PARAMETER__SERIALIZE(Boolean, vmSearch)
},
{
- if (esxVI_ManagedObjectReference_Deserialize
- (response->node, managedObjectReference,
- vmSearch == esxVI_Boolean_True ? "VirtualMachine"
- : "HostSystem") < 0) {
+ if (esxVI_ManagedObjectReference_Deserialize(response->node,
+ managedObjectReference) < 0) {
goto failure;
}
})
@@ -789,7 +779,7 @@ ESX_VI__METHOD(QueryAvailablePerfMetric,
esxVI_DateTime *endTime,
esxVI_Int *intervalId,
esxVI_PerfMetricId **perfMetricIdList),
- List,
+ OptionalList,
{
ESX_VI__METHOD__CHECK_SERVICE()
ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(perfMetricIdList)
@@ -820,7 +810,7 @@ ESX_VI__METHOD(QueryPerfCounter,
(esxVI_Context *ctx,
esxVI_Int *counterId, /* list */
esxVI_PerfCounterInfo **perfCounterInfoList),
- List,
+ OptionalList,
{
ESX_VI__METHOD__CHECK_SERVICE()
ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(perfCounterInfoList)
@@ -848,7 +838,7 @@ ESX_VI__METHOD(QueryPerf,
(esxVI_Context *ctx,
esxVI_PerfQuerySpec *querySpec, /* list */
esxVI_PerfEntityMetric **perfEntityMetricList),
- List,
+ OptionalList,
{
ESX_VI__METHOD__CHECK_SERVICE()
ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(perfEntityMetricList)
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index 87a13cb..6f257b2 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -64,11 +64,17 @@
-#define ESX_VI__TEMPLATE__ALLOC(_type) \
+#define ESX_VI__TEMPLATE__ALLOC(__type) \
int \
- esxVI_##_type##_Alloc(esxVI_##_type **ptrptr) \
+ esxVI_##__type##_Alloc(esxVI_##__type **ptrptr) \
{ \
- return esxVI_Alloc((void **)ptrptr, sizeof(esxVI_##_type)); \
+ if (esxVI_Alloc((void **)ptrptr, sizeof (esxVI_##__type)) < 0) { \
+ return -1; \
+ } \
+ \
+ (*ptrptr)->_type = esxVI_Type_##__type; \
+ \
+ return 0; \
}
@@ -92,11 +98,18 @@
-#define ESX_VI__TEMPLATE__VALIDATE(_type, _require) \
+#define ESX_VI__TEMPLATE__VALIDATE(__type, _require) \
int \
- esxVI_##_type##_Validate(esxVI_##_type *item) \
+ esxVI_##__type##_Validate(esxVI_##__type *item) \
{ \
- const char *type_name = #_type; \
+ const char *type_name = esxVI_Type_ToString(esxVI_Type_##__type); \
+ \
+ if (item->_type <= esxVI_Type_Undefined || \
+ item->_type >= esxVI_Type_Other) { \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
+ "%s object has invalid dynamic type", type_name); \
+ return -1; \
+ } \
\
_require \
\
@@ -105,11 +118,31 @@
-#define ESX_VI__TEMPLATE__VALIDATE_NOOP(_type) \
+#define ESX_VI__TEMPLATE__DEEP_COPY(_type, _deep_copy) \
int \
- esxVI_##_type##_Validate(esxVI_##_type *item ATTRIBUTE_UNUSED) \
+ esxVI_##_type##_DeepCopy(esxVI_##_type **dest, esxVI_##_type *src) \
{ \
+ if (dest == NULL || *dest != NULL) { \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ return -1; \
+ } \
+ \
+ if (src == NULL) { \
+ return 0; \
+ } \
+ \
+ if (esxVI_##_type##_Alloc(dest) < 0) { \
+ goto failure; \
+ } \
+ \
+ _deep_copy \
+ \
return 0; \
+ \
+ failure: \
+ esxVI_##_type##_Free(dest); \
+ \
+ return -1; \
}
@@ -184,19 +217,20 @@
return -1; \
} \
\
- if (STRNEQ(anyType->other, #_type)) { \
+ if (anyType->type != esxVI_Type_##_type) { \
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
"Expecting type '%s' but found '%s'", \
- #_type, anyType->other); \
+ esxVI_Type_ToString(esxVI_Type_##_type), \
+ anyType->other); \
return -1; \
} \
\
- return esxVI_##_type##_Deserialize(anyType->_node, ptrptr); \
+ return esxVI_##_type##_Deserialize(anyType->node, ptrptr); \
}
-#define ESX_VI__TEMPLATE__SERIALIZE_EXTRA(_type, _type_string, _serialize) \
+#define ESX_VI__TEMPLATE__SERIALIZE_EXTRA(_type, _extra, _serialize) \
int \
esxVI_##_type##_Serialize(esxVI_##_type *item, \
const char *element, virBufferPtr output) \
@@ -210,11 +244,14 @@
return 0; \
} \
\
+ _extra \
+ \
if (esxVI_##_type##_Validate(item) < 0) { \
return -1; \
} \
\
- ESV_VI__XML_TAG__OPEN(output, element, _type_string); \
+ ESV_VI__XML_TAG__OPEN(output, element, \
+ esxVI_Type_ToString(esxVI_Type_##_type)); \
\
_serialize \
\
@@ -226,7 +263,7 @@
#define ESX_VI__TEMPLATE__SERIALIZE(_type, _serialize) \
- ESX_VI__TEMPLATE__SERIALIZE_EXTRA(_type, #_type, _serialize)
+ ESX_VI__TEMPLATE__SERIALIZE_EXTRA(_type, /* nothing */, _serialize)
@@ -328,6 +365,31 @@
+/*
+ * Macros for property handling to be used as part of other macros
+ */
+
+#define ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY(_type, _name) \
+ if (esxVI_##_type##_DeepCopy(&(*dest)->_name, src->_name) < 0) { \
+ goto failure; \
+ }
+
+
+
+#define ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_LIST(_type, _name) \
+ if (esxVI_##_type##_DeepCopyList(&(*dest)->_name, src->_name) < 0) { \
+ goto failure; \
+ }
+
+
+
+#define ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_VALUE(_type, _name) \
+ if (esxVI_##_type##_DeepCopyValue(&(*dest)->_name, src->_name) < 0) { \
+ goto failure; \
+ }
+
+
+
#define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(_type, _name) \
if (esxVI_##_type##_Serialize(item->_name, #_name, output) < 0) { \
return -1; \
@@ -360,23 +422,17 @@
-#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(_type, _name) \
+#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_IGNORE(_name) \
if (xmlStrEqual(childNode->name, BAD_CAST #_name)) { \
- if (esxVI_##_type##_DeserializeValue(childNode, \
- &(*ptrptr)->_name) < 0) { \
- goto failure; \
- } \
- \
continue; \
}
-#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(_type, _expected, \
- _name) \
+#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(_type, _name) \
if (xmlStrEqual(childNode->name, BAD_CAST #_name)) { \
- if (esxVI_##_type##_Deserialize(childNode, &(*ptrptr)->_name, \
- _expected) < 0) { \
+ if (esxVI_##_type##_DeserializeValue(childNode, \
+ &(*ptrptr)->_name) < 0) { \
goto failure; \
} \
\
@@ -385,13 +441,6 @@
-#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(_name) \
- if (xmlStrEqual(childNode->name, BAD_CAST #_name)) { \
- continue; \
- }
-
-
-
#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(_type, _name) \
if (xmlStrEqual(childNode->name, BAD_CAST #_name)) { \
esxVI_##_type *_name##Item = NULL; \
@@ -427,6 +476,10 @@
+/*
+ * Macros to implement enumerations
+ */
+
#define ESX_VI__TEMPLATE__ENUMERATION__CAST_FROM_ANY_TYPE(_type) \
int \
esxVI_##_type##_CastFromAnyType(esxVI_AnyType *anyType, \
@@ -459,20 +512,102 @@
+/*
+ * Macros to implement dynamic dispatched functions
+ */
+
+#define ESX_VI__TEMPLATE__DISPATCH(__type, _dispatch, _error_return) \
+ switch (item->_type) { \
+ _dispatch \
+ \
+ case esxVI_Type_##__type: \
+ break; \
+ \
+ default: \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
+ "Call to %s for unexpected type '%s'", __FUNCTION__, \
+ esxVI_Type_ToString(item->_type)); \
+ return _error_return; \
+ }
+
+
+
+#define ESX_VI__TEMPLATE__DISPATCH__FREE(_type) \
+ case esxVI_Type_##_type: \
+ esxVI_##_type##_Free((esxVI_##_type **)ptrptr); \
+ return;
+
+
+
+#define ESX_VI__TEMPLATE__DISPATCH__DEEP_COPY(_type) \
+ case esxVI_Type_##_type: \
+ return esxVI_##_type##_DeepCopy((esxVI_##_type **)dst, \
+ (esxVI_##_type *)src);
+
+
+
+#define ESX_VI__TEMPLATE__DISPATCH__SERIALIZE(_type) \
+ case esxVI_Type_##_type: \
+ return esxVI_##_type##_Serialize((esxVI_##_type *)item, element, \
+ output);
+
+
+
+#define ESX_VI__TEMPLATE__DYNAMIC_FREE(__type, _dispatch, _body) \
+ ESX_VI__TEMPLATE__FREE(__type, \
+ ESX_VI__TEMPLATE__DISPATCH(__type, _dispatch, /* nothing */) \
+ _body)
+
+
+
+#define ESX_VI__TEMPLATE__DYNAMIC_CAST(__type, _accept) \
+ esxVI_##__type * \
+ esxVI_##__type##_DynamicCast(void *item) \
+ { \
+ if (item == NULL) { \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument"); \
+ return NULL; \
+ } \
+ \
+ _accept \
+ \
+ return NULL; \
+ }
+
+
+
+#define ESX_VI__TEMPLATE__DYNAMIC_CAST__ACCEPT(__type) \
+ if (((esxVI_Object *)item)->_type == esxVI_Type_##__type) { \
+ return item; \
+ }
+
+
+
+#define ESX_VI__TEMPLATE__DYNAMIC_SERIALIZE(__type, _dispatch, _serialize) \
+ ESX_VI__TEMPLATE__SERIALIZE_EXTRA(__type, \
+ ESX_VI__TEMPLATE__DISPATCH(__type, _dispatch, -1), \
+ _serialize)
+
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* XSI: Type
*/
const char *
-esxVI_Type_Name(esxVI_Type type)
+esxVI_Type_ToString(esxVI_Type type)
{
switch (type) {
+ default:
case esxVI_Type_Undefined:
- return "undefined";
+ return "<undefined>";
case esxVI_Type_Boolean:
return "xsd:boolean";
+ case esxVI_Type_AnyType:
+ return "xsd:anyType";
+
case esxVI_Type_String:
return "xsd:string";
@@ -485,14 +620,53 @@ esxVI_Type_Name(esxVI_Type type)
case esxVI_Type_Long:
return "xsd:long";
- case esxVI_Type_Other:
- return "other";
+ case esxVI_Type_DateTime:
+ return "xsd:dateTime";
- default:
- return "unknown";
+ case esxVI_Type_Fault:
+ return "Fault";
+
+ case esxVI_Type_ManagedObjectReference:
+ return "ManagedObjectReference";
+
+#include "esx_vi_types.generated.typetostring"
+
+ case esxVI_Type_Other:
+ return "<other>";
}
}
+esxVI_Type
+esxVI_Type_FromString(const char *type)
+{
+ if (type == NULL || STREQ(type, "<undefined>")) {
+ return esxVI_Type_Undefined;
+ } else if (STREQ(type, "xsd:boolean")) {
+ return esxVI_Type_Boolean;
+ } else if (STREQ(type, "xsd:anyType")) {
+ return esxVI_Type_AnyType;
+ } else if (STREQ(type, "xsd:string")) {
+ return esxVI_Type_String;
+ } else if (STREQ(type, "xsd:short")) {
+ return esxVI_Type_Short;
+ } else if (STREQ(type, "xsd:int")) {
+ return esxVI_Type_Int;
+ } else if (STREQ(type, "xsd:long")) {
+ return esxVI_Type_Long;
+ } else if (STREQ(type, "xsd:dateTime")) {
+ return esxVI_Type_DateTime;
+ } else if (STREQ(type, "Fault")) {
+ return esxVI_Type_Fault;
+ } else if (STREQ(type, "ManagedObjectReference")) {
+ return esxVI_Type_ManagedObjectReference;
+ }
+
+#include "esx_vi_types.generated.typefromstring"
+
+ else {
+ return esxVI_Type_Other;
+ }
+}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
@@ -500,7 +674,7 @@ esxVI_Type_Name(esxVI_Type type)
*/
static const esxVI_Enumeration _esxVI_Boolean_Enumeration = {
- "xsd:boolean", {
+ esxVI_Type_Boolean, {
{ "true", esxVI_Boolean_True },
{ "false", esxVI_Boolean_False },
{ NULL, -1 },
@@ -525,7 +699,7 @@ ESX_VI__TEMPLATE__ALLOC(AnyType);
/* esxVI_AnyType_Free */
ESX_VI__TEMPLATE__FREE(AnyType,
{
- xmlFreeNode(item->_node);
+ xmlFreeNode(item->node);
VIR_FREE(item->other);
VIR_FREE(item->value);
});
@@ -536,9 +710,9 @@ esxVI_AnyType_ExpectType(esxVI_AnyType *anyType, esxVI_Type type)
if (anyType->type != type) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"Expecting type '%s' but found '%s'",
- esxVI_Type_Name(type),
+ esxVI_Type_ToString(type),
anyType->type != esxVI_Type_Other
- ? esxVI_Type_Name(anyType->type)
+ ? esxVI_Type_ToString(anyType->type)
: anyType->other);
return -1;
}
@@ -562,9 +736,10 @@ esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
goto failure;
}
- (*dest)->_node = xmlCopyNode(src->_node, 1);
+ (*dest)->_type = src->_type;
+ (*dest)->node = xmlCopyNode(src->node, 1);
- if ((*dest)->_node == NULL) {
+ if ((*dest)->node == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not copy an XML node");
goto failure;
}
@@ -612,7 +787,7 @@ esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
int
esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
{
- long long number;
+ long long int number;
if (anyType == NULL || *anyType != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
@@ -623,9 +798,9 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
return -1;
}
- (*anyType)->_node = xmlCopyNode(node, 1);
+ (*anyType)->node = xmlCopyNode(node, 1);
- if ((*anyType)->_node == NULL) {
+ if ((*anyType)->node == NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not copy an XML node");
goto failure;
}
@@ -641,6 +816,15 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
goto failure;
}
+ (*anyType)->type = esxVI_Type_FromString((*anyType)->other);
+
+ if ((*anyType)->type == esxVI_Type_Undefined) {
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
+ "Unknown value '%s' for AnyType 'type' property",
+ (*anyType)->other);
+ goto failure;
+ }
+
(*anyType)->value =
(char *)xmlNodeListGetString(node->doc, node->children, 1);
@@ -669,13 +853,11 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
goto failure; \
} \
\
- (*anyType)->type = esxVI_Type_##_type; \
(*anyType)->_name = number; \
} while (0)
- if (STREQ((*anyType)->other, "xsd:boolean")) {
- (*anyType)->type = esxVI_Type_Boolean;
-
+ switch ((*anyType)->type) {
+ case esxVI_Type_Boolean:
if (STREQ((*anyType)->value, "true")) {
(*anyType)->boolean = esxVI_Boolean_True;
} else if (STREQ((*anyType)->value, "false")) {
@@ -686,15 +868,27 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
(*anyType)->value);
goto failure;
}
- } else if (STREQ((*anyType)->other, "xsd:string")) {
- (*anyType)->type = esxVI_Type_String;
+
+ break;
+
+ case esxVI_Type_String:
(*anyType)->string = (*anyType)->value;
- } else if (STREQ((*anyType)->other, "xsd:short")) {
+ break;
+
+ case esxVI_Type_Short:
_DESERIALIZE_NUMBER(Short, "xsd:short", int16, INT16_MIN, INT16_MAX);
- } else if (STREQ((*anyType)->other, "xsd:int")) {
+ break;
+
+ case esxVI_Type_Int:
_DESERIALIZE_NUMBER(Int, "xsd:int", int32, INT32_MIN, INT32_MAX);
- } else if (STREQ((*anyType)->other, "xsd:long")) {
+ break;
+
+ case esxVI_Type_Long:
_DESERIALIZE_NUMBER(Long, "xsd:long", int64, INT64_MIN, INT64_MAX);
+ break;
+
+ default:
+ break;
}
#undef _DESERIALIZE_NUMBER
@@ -724,6 +918,12 @@ ESX_VI__TEMPLATE__FREE(String,
VIR_FREE(item->value);
});
+/* esxVI_String_Validate */
+ESX_VI__TEMPLATE__VALIDATE(String,
+{
+ ESX_VI__TEMPLATE__PROPERTY__REQUIRE(value)
+})
+
/* esxVI_String_AppendToList */
ESX_VI__TEMPLATE__LIST__APPEND(String);
@@ -782,30 +982,11 @@ esxVI_String_AppendValueListToList(esxVI_String **stringList,
return -1;
}
-int
-esxVI_String_DeepCopy(esxVI_String **dest, esxVI_String *src)
+/* esxVI_String_DeepCopy */
+ESX_VI__TEMPLATE__DEEP_COPY(String,
{
- if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
- return -1;
- }
-
- if (src == NULL) {
- return 0;
- }
-
- if (esxVI_String_Alloc(dest) < 0 ||
- esxVI_String_DeepCopyValue(&(*dest)->value, src->value)) {
- goto failure;
- }
-
- return 0;
-
- failure:
- esxVI_String_Free(dest);
-
- return -1;
-}
+ ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_VALUE(String, value)
+})
/* esxVI_String_DeepCopyList */
ESX_VI__TEMPLATE__LIST__DEEP_COPY(String);
@@ -865,37 +1046,11 @@ esxVI_String_SerializeValue(const char *value, const char *element,
return 0;
}
-int
-esxVI_String_Deserialize(xmlNodePtr node, esxVI_String **string)
+/* esxVI_String_Deserialize */
+ESX_VI__TEMPLATE__DESERIALIZE(String,
{
- if (string == NULL || *string != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
- return -1;
- }
-
- if (esxVI_String_Alloc(string) < 0) {
- return -1;
- }
-
- (*string)->value =
- (char *)xmlNodeListGetString(node->doc, node->children, 1);
-
- if ((*string)->value == NULL) {
- (*string)->value = strdup("");
-
- if ((*string)->value == NULL) {
- virReportOOMError();
- goto failure;
- }
- }
-
- return 0;
-
- failure:
- esxVI_String_Free(string);
-
- return -1;
-}
+ ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, value)
+})
/* esxVI_String_DeserializeList */
ESX_VI__TEMPLATE__LIST__DESERIALIZE(String);
@@ -938,39 +1093,21 @@ ESX_VI__TEMPLATE__FREE(Int,
});
/* esxVI_Int_Validate */
-ESX_VI__TEMPLATE__VALIDATE_NOOP(Int);
+ESX_VI__TEMPLATE__VALIDATE(Int,
+{
+})
/* esxVI_Int_AppendToList */
ESX_VI__TEMPLATE__LIST__APPEND(Int);
-int
-esxVI_Int_DeepCopy(esxVI_Int **dest, esxVI_Int *src)
+/* esxVI_Int_DeepCopy */
+ESX_VI__TEMPLATE__DEEP_COPY(Int,
{
- if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
- return -1;
- }
-
- if (src == NULL) {
- return 0;
- }
-
- if (esxVI_Int_Alloc(dest) < 0) {
- goto failure;
- }
-
(*dest)->value = src->value;
-
- return 0;
-
- failure:
- esxVI_Int_Free(dest);
-
- return -1;
-}
+})
/* esxVI_Int_Serialize */
-ESX_VI__TEMPLATE__SERIALIZE_EXTRA(Int, "xsd:int",
+ESX_VI__TEMPLATE__SERIALIZE(Int,
{
virBufferVSprintf(output, "%d", (int)item->value);
});
@@ -997,13 +1134,15 @@ ESX_VI__TEMPLATE__FREE(Long,
});
/* esxVI_Long_Validate */
-ESX_VI__TEMPLATE__VALIDATE_NOOP(Long);
+ESX_VI__TEMPLATE__VALIDATE(Long,
+{
+})
/* esxVI_Long_AppendToList */
ESX_VI__TEMPLATE__LIST__APPEND(Long);
/* esxVI_Long_Serialize */
-ESX_VI__TEMPLATE__SERIALIZE_EXTRA(Long, "xsd:long",
+ESX_VI__TEMPLATE__SERIALIZE(Long,
{
virBufferVSprintf(output, "%lld", (long long int)item->value);
});
@@ -1036,7 +1175,7 @@ ESX_VI__TEMPLATE__VALIDATE(DateTime,
});
/* esxVI_DateTime_Serialize */
-ESX_VI__TEMPLATE__SERIALIZE_EXTRA(DateTime, "xsd:dateTime",
+ESX_VI__TEMPLATE__SERIALIZE(DateTime,
{
virBufferAdd(output, item->value, -1);
});
@@ -1074,184 +1213,6 @@ esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: ManagedEntityStatus
- */
-
-static const esxVI_Enumeration _esxVI_ManagedEntityStatus_Enumeration = {
- "ManagedEntityStatus", {
- { "gray", esxVI_ManagedEntityStatus_Gray },
- { "green", esxVI_ManagedEntityStatus_Green },
- { "yellow", esxVI_ManagedEntityStatus_Yellow },
- { "red", esxVI_ManagedEntityStatus_Red },
- { NULL, -1 },
- },
-};
-
-/* esxVI_ManagedEntityStatus_CastFromAnyType */
-ESX_VI__TEMPLATE__ENUMERATION__CAST_FROM_ANY_TYPE(ManagedEntityStatus);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: ObjectUpdateKind
- */
-
-static const esxVI_Enumeration _esxVI_ObjectUpdateKind_Enumeration = {
- "ObjectUpdateKind", {
- { "enter", esxVI_ObjectUpdateKind_Enter },
- { "leave", esxVI_ObjectUpdateKind_Leave },
- { "modify", esxVI_ObjectUpdateKind_Modify },
- { NULL, -1 },
- },
-};
-
-/* esxVI_ObjectUpdateKind_Deserialize */
-ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(ObjectUpdateKind);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: PerfSummaryType
- */
-
-static const esxVI_Enumeration _esxVI_PerfSummaryType_Enumeration = {
- "PerfSummaryType", {
- { "average", esxVI_PerfSummaryType_Average },
- { "latest", esxVI_PerfSummaryType_Latest },
- { "maximum", esxVI_PerfSummaryType_Maximum },
- { "minimum", esxVI_PerfSummaryType_Minimum },
- { "none", esxVI_PerfSummaryType_None },
- { "summation", esxVI_PerfSummaryType_Summation },
- { NULL, -1 },
- },
-};
-
-/* esxVI_PerfSummaryType_Deserialize */
-ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(PerfSummaryType);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: PerfStatsType
- */
-
-static const esxVI_Enumeration _esxVI_PerfStatsType_Enumeration = {
- "PerfStatsType", {
- { "absolute", esxVI_PerfStatsType_Absolute },
- { "delta", esxVI_PerfStatsType_Delta },
- { "rate", esxVI_PerfStatsType_Rate },
- { NULL, -1 },
- },
-};
-
-/* esxVI_PerfStatsType_Deserialize */
-ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(PerfStatsType);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: PropertyChangeOp
- */
-
-static const esxVI_Enumeration _esxVI_PropertyChangeOp_Enumeration = {
- "PropertyChangeOp", {
- { "add", esxVI_PropertyChangeOp_Add },
- { "remove", esxVI_PropertyChangeOp_Remove },
- { "assign", esxVI_PropertyChangeOp_Assign },
- { "indirectRemove", esxVI_PropertyChangeOp_IndirectRemove },
- { NULL, -1 },
- },
-};
-
-/* esxVI_PropertyChangeOp_Deserialize */
-ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(PropertyChangeOp);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: SharesLevel
- */
-
-static const esxVI_Enumeration _esxVI_SharesLevel_Enumeration = {
- "SharesLevel", {
- { "custom", esxVI_SharesLevel_Custom },
- { "high", esxVI_SharesLevel_High },
- { "low", esxVI_SharesLevel_Low },
- { "normal", esxVI_SharesLevel_Normal },
- { NULL, -1 },
- },
-};
-
-/* esxVI_SharesLevel_Serialize */
-ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(SharesLevel);
-
-/* esxVI_SharesLevel_Deserialize */
-ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(SharesLevel);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: TaskInfoState
- */
-
-static const esxVI_Enumeration _esxVI_TaskInfoState_Enumeration = {
- "TaskInfoState", {
- { "error", esxVI_TaskInfoState_Error },
- { "queued", esxVI_TaskInfoState_Queued },
- { "running", esxVI_TaskInfoState_Running },
- { "success", esxVI_TaskInfoState_Success },
- { NULL, -1 },
- },
-};
-
-/* esxVI_TaskInfoState_CastFromAnyType */
-ESX_VI__TEMPLATE__ENUMERATION__CAST_FROM_ANY_TYPE(TaskInfoState);
-
-/* esxVI_TaskInfoState_Deserialize */
-ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(TaskInfoState);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: VirtualMachineMovePriority
- */
-
-static const esxVI_Enumeration _esxVI_VirtualMachineMovePriority_Enumeration = {
- "VirtualMachineMovePriority", {
- { "lowPriority", esxVI_VirtualMachineMovePriority_LowPriority },
- { "highPriority", esxVI_VirtualMachineMovePriority_HighPriority },
- { "defaultPriority", esxVI_VirtualMachineMovePriority_DefaultPriority },
- { NULL, -1 },
- },
-};
-
-/* esxVI_VirtualMachineMovePriority_Serialize */
-ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(VirtualMachineMovePriority);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: VirtualMachinePowerState
- */
-
-static const esxVI_Enumeration _esxVI_VirtualMachinePowerState_Enumeration = {
- "VirtualMachinePowerState", {
- { "poweredOff", esxVI_VirtualMachinePowerState_PoweredOff },
- { "poweredOn", esxVI_VirtualMachinePowerState_PoweredOn },
- { "suspended", esxVI_VirtualMachinePowerState_Suspended },
- { NULL, -1 },
- },
-};
-
-/* esxVI_VirtualMachinePowerState_CastFromAnyType */
-ESX_VI__TEMPLATE__ENUMERATION__CAST_FROM_ANY_TYPE(VirtualMachinePowerState);
-
-/* esxVI_VirtualMachinePowerState_Serialize */
-ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(VirtualMachinePowerState);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* VI Type: Fault
*/
@@ -1277,7 +1238,7 @@ ESX_VI__TEMPLATE__DESERIALIZE(Fault,
{
ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, faultcode);
ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, faultstring);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(detail); /* FIXME */
+ ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_IGNORE(detail); /* FIXME */
});
@@ -1298,128 +1259,21 @@ ESX_VI__TEMPLATE__FREE(ManagedObjectReference,
VIR_FREE(item->value);
});
-int
-esxVI_ManagedObjectReference_DeepCopy(esxVI_ManagedObjectReference **dest,
- esxVI_ManagedObjectReference *src)
+/* esxVI_ManagedObjectReference_DeepCopy */
+ESX_VI__TEMPLATE__DEEP_COPY(ManagedObjectReference,
{
- if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
- return -1;
- }
-
- if (src == NULL) {
- return 0;
- }
-
- if (esxVI_ManagedObjectReference_Alloc(dest) < 0 ||
- esxVI_String_DeepCopyValue(&(*dest)->type, src->type) < 0 ||
- esxVI_String_DeepCopyValue(&(*dest)->value, src->value) < 0) {
- goto failure;
- }
-
- return 0;
-
- failure:
- esxVI_ManagedObjectReference_Free(dest);
-
- return -1;
-}
+ ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_VALUE(String, type)
+ ESX_VI__TEMPLATE__PROPERTY__DEEP_COPY_VALUE(String, value)
+})
/* esxVI_ManagedObjectReference_AppendToList */
ESX_VI__TEMPLATE__LIST__APPEND(ManagedObjectReference);
-int
-esxVI_ManagedObjectReference_CastFromAnyType
- (esxVI_AnyType *anyType,
- esxVI_ManagedObjectReference **managedObjectReference,
- const char *expectedType)
-{
- if (anyType == NULL || managedObjectReference == NULL ||
- *managedObjectReference != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
- return -1;
- }
-
- if (STRNEQ(anyType->other, "ManagedObjectReference")) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting type 'ManagedObjectReference' but found '%s'",
- anyType->other);
- return -1;
- }
-
- return esxVI_ManagedObjectReference_Deserialize(anyType->_node,
- managedObjectReference,
- expectedType);
-}
-
-int
-esxVI_ManagedObjectReference_CastListFromAnyType
- (esxVI_AnyType *anyType,
- esxVI_ManagedObjectReference **managedObjectReferenceList,
- const char *expectedType)
-{
- int result = 0;
- xmlNodePtr childNode = NULL;
- esxVI_AnyType *childAnyType = NULL;
- esxVI_ManagedObjectReference *managedObjectReference = NULL;
-
- if (managedObjectReferenceList == NULL ||
- *managedObjectReferenceList != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
- goto failure;
- }
-
- if (anyType == NULL) {
- return 0;
- }
-
- if (STRNEQ(anyType->other, "ArrayOfManagedObjectReference")) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expecting type to be 'ArrayOfManagedObjectReference' "
- "but found '%s'", anyType->other);
- goto failure;
- }
-
- for (childNode = anyType->_node->children; childNode != NULL;
- childNode = childNode->next) {
- if (childNode->type != XML_ELEMENT_NODE) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Wrong XML element type %d", childNode->type);
- goto failure;
- }
-
- esxVI_AnyType_Free(&childAnyType);
-
- if (esxVI_AnyType_Deserialize(childNode, &childAnyType) < 0) {
- goto failure;
- }
-
- managedObjectReference = NULL;
-
- if (esxVI_ManagedObjectReference_CastFromAnyType
- (childAnyType, &managedObjectReference, expectedType) < 0) {
- goto failure;
- }
-
- if (esxVI_ManagedObjectReference_AppendToList
- (managedObjectReferenceList, managedObjectReference) < 0) {
- goto failure;
- }
- }
-
+/* esxVI_ManagedObjectReference_CastFromAnyType */
+ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(ManagedObjectReference)
- cleanup:
- esxVI_AnyType_Free(&childAnyType);
-
- return result;
-
- failure:
- esxVI_ManagedObjectReference_Free(managedObjectReferenceList);
-
- result = -1;
-
- goto cleanup;
-}
+/* esxVI_ManagedObjectReference_CastListFromAnyType */
+ESX_VI__TEMPLATE__LIST__CAST_FROM_ANY_TYPE(ManagedObjectReference)
int
esxVI_ManagedObjectReference_Serialize
@@ -1454,8 +1308,7 @@ ESX_VI__TEMPLATE__LIST__SERIALIZE(ManagedObjectReference);
int
esxVI_ManagedObjectReference_Deserialize
- (xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference,
- const char *expectedType)
+ (xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference)
{
if (managedObjectReference == NULL || *managedObjectReference != NULL) {
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
@@ -1475,14 +1328,6 @@ esxVI_ManagedObjectReference_Deserialize
goto failure;
}
- if (expectedType != NULL &&
- STRNEQ(expectedType, (*managedObjectReference)->type)) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
- "Expected type '%s' but found '%s'", expectedType,
- (*managedObjectReference)->type);
- goto failure;
- }
-
if (esxVI_String_DeserializeValue(node,
&(*managedObjectReference)->value) < 0) {
goto failure;
@@ -1496,1533 +1341,4 @@ esxVI_ManagedObjectReference_Deserialize
return -1;
}
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: DynamicProperty
- */
-
-/* esxVI_DynamicProperty_Alloc */
-ESX_VI__TEMPLATE__ALLOC(DynamicProperty);
-
-/* esxVI_DynamicProperty_Free */
-ESX_VI__TEMPLATE__FREE(DynamicProperty,
-{
- esxVI_DynamicProperty_Free(&item->_next);
-
- VIR_FREE(item->name);
- esxVI_AnyType_Free(&item->val);
-});
-
-/* esxVI_DynamicProperty_Validate */
-ESX_VI__TEMPLATE__VALIDATE(DynamicProperty,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(name);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(val);
-});
-
-int
-esxVI_DynamicProperty_DeepCopy(esxVI_DynamicProperty **dest,
- esxVI_DynamicProperty *src)
-{
- if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
- return -1;
- }
-
- if (src == NULL) {
- return 0;
- }
-
- if (esxVI_DynamicProperty_Alloc(dest) < 0 ||
- esxVI_String_DeepCopyValue(&(*dest)->name, src->name) < 0 ||
- esxVI_AnyType_DeepCopy(&(*dest)->val, src->val) < 0) {
- goto failure;
- }
-
- return 0;
-
- failure:
- esxVI_DynamicProperty_Free(dest);
-
- return -1;
-}
-
-/* esxVI_DynamicProperty_DeepCopyList */
-ESX_VI__TEMPLATE__LIST__DEEP_COPY(DynamicProperty);
-
-/* esxVI_DynamicProperty_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(DynamicProperty);
-
-/* esxVI_DynamicProperty_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(DynamicProperty,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, name);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(AnyType, val);
-});
-
-/* esxVI_DynamicProperty_DeserializeList */
-ESX_VI__TEMPLATE__LIST__DESERIALIZE(DynamicProperty);
-
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: HostCpuIdInfo
- */
-
-/* esxVI_HostCpuIdInfo_Alloc */
-ESX_VI__TEMPLATE__ALLOC(HostCpuIdInfo);
-
-/* esxVI_HostCpuIdInfo_Free */
-ESX_VI__TEMPLATE__FREE(HostCpuIdInfo,
-{
- esxVI_HostCpuIdInfo_Free(&item->_next);
-
- esxVI_Int_Free(&item->level);
- VIR_FREE(item->vendor);
- VIR_FREE(item->eax);
- VIR_FREE(item->ebx);
- VIR_FREE(item->ecx);
- VIR_FREE(item->edx);
-});
-
-/* esxVI_HostCpuIdInfo_Validate */
-ESX_VI__TEMPLATE__VALIDATE(HostCpuIdInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(level);
-});
-
-/* esxVI_HostCpuIdInfo_CastFromAnyType */
-ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(HostCpuIdInfo);
-
-/* esxVI_HostCpuIdInfo_CastListFromAnyType */
-ESX_VI__TEMPLATE__LIST__CAST_FROM_ANY_TYPE(HostCpuIdInfo);
-
-/* esxVI_HostCpuIdInfo_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(HostCpuIdInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, level);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, vendor);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, eax);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, ebx);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, ecx);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, edx);
-});
-
-/* esxVI_HostCpuIdInfo_DeserializeList */
-ESX_VI__TEMPLATE__LIST__DESERIALIZE(HostCpuIdInfo);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: SelectionSpec
- */
-
-/* esxVI_SelectionSpec_Alloc */
-ESX_VI__TEMPLATE__ALLOC(SelectionSpec);
-
-void
-esxVI_SelectionSpec_Free(esxVI_SelectionSpec **selectionSpec)
-{
- esxVI_SelectionSpec *local = NULL;
-
- if (selectionSpec == NULL || *selectionSpec == NULL) {
- return;
- }
-
- esxVI_SelectionSpec_Free(&(*selectionSpec)->_next);
-
- if ((*selectionSpec)->_super != NULL) {
- /*
- * Explicitly set this pointer to NULL here, otherwise this is will
- * result in a dangling pointer. The actual memory of this object is
- * freed by a call from the esxVI_TraversalSpec_Free function to the
- * esxVI_SelectionSpec_Free function with the base pointer.
- *
- * Use a local copy of the pointer and set the reference to NULL,
- * otherwise Valgrind complains about invalid writes.
- */
- local = *selectionSpec;
- *selectionSpec = NULL;
-
- esxVI_TraversalSpec_Free(&local->_super);
- } else {
- VIR_FREE((*selectionSpec)->name);
-
- VIR_FREE(*selectionSpec);
- }
-}
-
-/* esxVI_SelectionSpec_Validate */
-ESX_VI__TEMPLATE__VALIDATE(SelectionSpec,
-{
- if (item->_super != NULL) {
- return esxVI_TraversalSpec_Validate(item->_super);
- }
-
- /* All properties are optional */
- (void)type_name;
-});
-
-/* esxVI_SelectionSpec_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(SelectionSpec);
-
-int
-esxVI_SelectionSpec_Serialize(esxVI_SelectionSpec *selectionSpec,
- const char *element, virBufferPtr output)
-{
- if (element == NULL || output == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
- return -1;
- }
-
- if (selectionSpec == NULL) {
- return 0;
- }
-
- if (selectionSpec->_super != NULL) {
- return esxVI_TraversalSpec_Serialize(selectionSpec->_super, element,
- output);
- }
-
- if (esxVI_SelectionSpec_Validate(selectionSpec) < 0) {
- return -1;
- }
-
- ESV_VI__XML_TAG__OPEN(output, element, "SelectionSpec");
-
- if (esxVI_String_SerializeValue(selectionSpec->name, "name", output) < 0) {
- return -1;
- }
-
- ESV_VI__XML_TAG__CLOSE(output, element);
-
- return 0;
-}
-
-/* esxVI_SelectionSpec_SerializeList */
-ESX_VI__TEMPLATE__LIST__SERIALIZE(SelectionSpec);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: TraversalSpec extends SelectionSpec
- */
-
-int
-esxVI_TraversalSpec_Alloc(esxVI_TraversalSpec **traversalSpec)
-{
- if (esxVI_Alloc((void **)traversalSpec, sizeof(esxVI_TraversalSpec)) < 0) {
- return -1;
- }
-
- if (esxVI_SelectionSpec_Alloc(&(*traversalSpec)->_base) < 0) {
- esxVI_TraversalSpec_Free(traversalSpec);
- return -1;
- }
-
- (*traversalSpec)->_base->_super = *traversalSpec;
-
- return 0;
-}
-
-void
-esxVI_TraversalSpec_Free(esxVI_TraversalSpec **traversalSpec)
-{
- esxVI_TraversalSpec *local = NULL;
-
- if (traversalSpec == NULL || *traversalSpec == NULL) {
- return;
- }
-
- /*
- * Need to store the traversalSpec pointer in a local variable here,
- * because it is possible that the traversalSpec pointer and the _super
- * pointer represent the same location in memory, e.g. if
- * esxVI_SelectionSpec_Free calls esxVI_TraversalSpec_Free with the _super
- * pointer as argument. Setting the _super pointer to NULL sets the
- * traversalSpec pointer also to NULL, because we're working on a reference
- * to this pointer here.
- *
- * Also use a local copy of the pointer and set the reference to NULL,
- * otherwise Valgrind complains about invalid writes.
- */
- local = *traversalSpec;
- *traversalSpec = NULL;
-
- /*
- * Setting the _super pointer to NULL here is important, otherwise
- * esxVI_SelectionSpec_Free would call esxVI_TraversalSpec_Free again,
- * resulting in both functions calling each other trying to free the
- * _base/_super object until a stackoverflow occurs.
- */
- local->_base->_super = NULL;
-
- esxVI_SelectionSpec_Free(&local->_base);
- VIR_FREE(local->type);
- VIR_FREE(local->path);
- esxVI_SelectionSpec_Free(&local->selectSet);
-
- VIR_FREE(local);
-}
-
-/* esxVI_TraversalSpec_Validate */
-ESX_VI__TEMPLATE__VALIDATE(TraversalSpec,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(type);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(path);
-});
-
-/* esxVI_TraversalSpec_Serialize */
-ESX_VI__TEMPLATE__SERIALIZE(TraversalSpec,
-{
- if (esxVI_String_SerializeValue(item->_base->name, "name", output) < 0) {
- return -1;
- }
-
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, type);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, path);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Boolean, skip);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(SelectionSpec, selectSet);
-});
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ObjectSpec
- */
-
-/* esxVI_ObjectSpec_Alloc */
-ESX_VI__TEMPLATE__ALLOC(ObjectSpec);
-
-/* esxVI_ObjectSpec_Free */
-ESX_VI__TEMPLATE__FREE(ObjectSpec,
-{
- esxVI_ObjectSpec_Free(&item->_next);
-
- esxVI_ManagedObjectReference_Free(&item->obj);
- esxVI_SelectionSpec_Free(&item->selectSet);
-});
-
-/* esxVI_ObjectSpec_Validate */
-ESX_VI__TEMPLATE__VALIDATE(ObjectSpec,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(obj);
-});
-
-/* esxVI_ObjectSpec_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(ObjectSpec);
-
-/* esxVI_ObjectSpec_Serialize */
-ESX_VI__TEMPLATE__SERIALIZE(ObjectSpec,
-{
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(ManagedObjectReference, obj);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Boolean, skip);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(SelectionSpec, selectSet);
-});
-
-/* esxVI_ObjectSpec_SerializeList */
-ESX_VI__TEMPLATE__LIST__SERIALIZE(ObjectSpec);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PropertyChange
- */
-
-/* esxVI_PropertyChange_Alloc */
-ESX_VI__TEMPLATE__ALLOC(PropertyChange);
-
-/* esxVI_PropertyChange_Free */
-ESX_VI__TEMPLATE__FREE(PropertyChange,
-{
- esxVI_PropertyChange_Free(&item->_next);
-
- VIR_FREE(item->name);
- esxVI_AnyType_Free(&item->val);
-});
-
-/* esxVI_PropertyChange_Validate */
-ESX_VI__TEMPLATE__VALIDATE(PropertyChange,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(name);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(op);
-});
-
-/* esxVI_PropertyChange_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(PropertyChange);
-
-/* esxVI_PropertyChange_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(PropertyChange,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, name);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(PropertyChangeOp, op);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(AnyType, val);
-});
-
-/* esxVI_PropertyChange_DeserializeList */
-ESX_VI__TEMPLATE__LIST__DESERIALIZE(PropertyChange);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PropertySpec
- */
-
-/* esxVI_PropertySpec_Alloc */
-ESX_VI__TEMPLATE__ALLOC(PropertySpec);
-
-/* esxVI_PropertySpec_Free */
-ESX_VI__TEMPLATE__FREE(PropertySpec,
-{
- esxVI_PropertySpec_Free(&item->_next);
-
- VIR_FREE(item->type);
- esxVI_String_Free(&item->pathSet);
-});
-
-/* esxVI_PropertySpec_Validate */
-ESX_VI__TEMPLATE__VALIDATE(PropertySpec,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(type);
-});
-
-/* esxVI_PropertySpec_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(PropertySpec);
-
-/* esxVI_PropertySpec_Serialize */
-ESX_VI__TEMPLATE__SERIALIZE(PropertySpec,
-{
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, type);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Boolean, all);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(String, pathSet);
-});
-
-/* esxVI_PropertySpec_SerializeList */
-ESX_VI__TEMPLATE__LIST__SERIALIZE(PropertySpec);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PropertyFilterSpec
- */
-
-/* esxVI_PropertyFilterSpec_Alloc */
-ESX_VI__TEMPLATE__ALLOC(PropertyFilterSpec);
-
-/* esxVI_PropertyFilterSpec_Free */
-ESX_VI__TEMPLATE__FREE(PropertyFilterSpec,
-{
- esxVI_PropertyFilterSpec_Free(&item->_next);
-
- esxVI_PropertySpec_Free(&item->propSet);
- esxVI_ObjectSpec_Free(&item->objectSet);
-});
-
-/* esxVI_PropertyFilterSpec_Validate */
-ESX_VI__TEMPLATE__VALIDATE(PropertyFilterSpec,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(propSet);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(objectSet);
-});
-
-/* esxVI_PropertyFilterSpec_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(PropertyFilterSpec);
-
-/* esxVI_PropertyFilterSpec_Serialize */
-ESX_VI__TEMPLATE__SERIALIZE(PropertyFilterSpec,
-{
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(PropertySpec, propSet);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(ObjectSpec, objectSet);
-});
-
-/* esxVI_PropertyFilterSpec_SerializeList */
-ESX_VI__TEMPLATE__LIST__SERIALIZE(PropertyFilterSpec);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ObjectContent
- */
-
-/* esxVI_ObjectContent_Alloc */
-ESX_VI__TEMPLATE__ALLOC(ObjectContent);
-
-/* esxVI_ObjectContent_Free */
-ESX_VI__TEMPLATE__FREE(ObjectContent,
-{
- esxVI_ObjectContent_Free(&item->_next);
-
- esxVI_ManagedObjectReference_Free(&item->obj);
- esxVI_DynamicProperty_Free(&item->propSet);
- /*esxVI_MissingProperty_Free(&item->missingSet);*//* FIXME */
-});
-
-/* esxVI_ObjectContent_Validate */
-ESX_VI__TEMPLATE__VALIDATE(ObjectContent,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(obj);
-});
-
-/* esxVI_ObjectContent_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(ObjectContent);
-
-int
-esxVI_ObjectContent_DeepCopy(esxVI_ObjectContent **dest,
- esxVI_ObjectContent *src)
-{
- if (dest == NULL || *dest != NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
- return -1;
- }
-
- if (src == NULL) {
- return 0;
- }
-
- if (esxVI_ObjectContent_Alloc(dest) < 0 ||
- esxVI_ManagedObjectReference_DeepCopy(&(*dest)->obj, src->obj) < 0 ||
- esxVI_DynamicProperty_DeepCopyList(&(*dest)->propSet,
- src->propSet) < 0) {
- goto failure;
- }
-
-#if 0 /* FIXME */
- if (esxVI_MissingProperty_DeepCopyList(&(*dest)->missingSet,
- src->missingSet) < 0) {
- goto failure;
- }
-#endif
-
- return 0;
-
- failure:
- esxVI_ObjectContent_Free(dest);
-
- return -1;
-}
-
-/* esxVI_ObjectContent_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(ObjectContent,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- NULL, obj);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(DynamicProperty, propSet);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(missingSet); /* FIXME */
-});
-
-/* esxVI_ObjectContent_DeserializeList */
-ESX_VI__TEMPLATE__LIST__DESERIALIZE(ObjectContent);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ObjectUpdate
- */
-
-/* esxVI_ObjectUpdate_Alloc */
-ESX_VI__TEMPLATE__ALLOC(ObjectUpdate);
-
-/* esxVI_ObjectUpdate_Free */
-ESX_VI__TEMPLATE__FREE(ObjectUpdate,
-{
- esxVI_ObjectUpdate_Free(&item->_next);
-
- esxVI_ManagedObjectReference_Free(&item->obj);
- esxVI_PropertyChange_Free(&item->changeSet);
- /*esxVI_MissingProperty_Free(&item->missingSet);*//* FIXME */
-});
-
-/* esxVI_ObjectUpdate_Validate */
-ESX_VI__TEMPLATE__VALIDATE(ObjectUpdate,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(kind);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(obj);
-});
-
-/* esxVI_ObjectUpdate_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(ObjectUpdate);
-
-/* esxVI_ObjectUpdate_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(ObjectUpdate,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(ObjectUpdateKind, kind);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- NULL, obj);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(PropertyChange, changeSet);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(missingSet); /* FIXME */
-});
-
-/* esxVI_ObjectUpdate_DeserializeList */
-ESX_VI__TEMPLATE__LIST__DESERIALIZE(ObjectUpdate);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PropertyFilterUpdate
- */
-
-/* esxVI_PropertyFilterUpdate_Alloc */
-ESX_VI__TEMPLATE__ALLOC(PropertyFilterUpdate);
-
-/* esxVI_PropertyFilterUpdate_Free */
-ESX_VI__TEMPLATE__FREE(PropertyFilterUpdate,
-{
- esxVI_PropertyFilterUpdate_Free(&item->_next);
-
- esxVI_ManagedObjectReference_Free(&item->filter);
- esxVI_ObjectUpdate_Free(&item->objectSet);
- /*esxVI_MissingProperty_Free(&item->missingSet);*//* FIXME */
-});
-
-/* esxVI_PropertyFilterUpdate_Validate */
-ESX_VI__TEMPLATE__VALIDATE(PropertyFilterUpdate,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(filter);
-});
-
-/* esxVI_PropertyFilterUpdate_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(PropertyFilterUpdate);
-
-/* esxVI_PropertyFilterUpdate_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(PropertyFilterUpdate,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- NULL, filter);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(ObjectUpdate, objectSet);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(missingSet); /* FIXME */
-});
-
-/* esxVI_PropertyFilterUpdate_DeserializeList */
-ESX_VI__TEMPLATE__LIST__DESERIALIZE(PropertyFilterUpdate);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: AboutInfo
- */
-
-/* esxVI_AboutInfo_Alloc */
-ESX_VI__TEMPLATE__ALLOC(AboutInfo);
-
-/* esxVI_AboutInfo_Free */
-ESX_VI__TEMPLATE__FREE(AboutInfo,
-{
- VIR_FREE(item->name);
- VIR_FREE(item->fullName);
- VIR_FREE(item->vendor);
- VIR_FREE(item->version);
- VIR_FREE(item->build);
- VIR_FREE(item->localeVersion);
- VIR_FREE(item->localeBuild);
- VIR_FREE(item->osType);
- VIR_FREE(item->productLineId);
- VIR_FREE(item->apiType);
- VIR_FREE(item->apiVersion);
-});
-
-/* esxVI_AboutInfo_Validate */
-ESX_VI__TEMPLATE__VALIDATE(AboutInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(name);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(fullName);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(vendor);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(version);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(build);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(localeVersion);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(localeBuild);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(osType);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(productLineId);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(apiType);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(apiVersion);
-});
-
-/* esxVI_AboutInfo_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(AboutInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, name);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, fullName);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, vendor);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, version);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, build);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, localeVersion);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, localeBuild);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, osType);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, productLineId);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, apiType);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, apiVersion);
-});
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ServiceContent
- */
-
-/* esxVI_ServiceContent_Alloc */
-ESX_VI__TEMPLATE__ALLOC(ServiceContent);
-
-/* esxVI_ServiceContent_Free */
-ESX_VI__TEMPLATE__FREE(ServiceContent,
-{
- esxVI_ManagedObjectReference_Free(&item->rootFolder);
- esxVI_ManagedObjectReference_Free(&item->propertyCollector);
- esxVI_ManagedObjectReference_Free(&item->viewManager);
- esxVI_AboutInfo_Free(&item->about);
- esxVI_ManagedObjectReference_Free(&item->setting);
- esxVI_ManagedObjectReference_Free(&item->userDirectory);
- esxVI_ManagedObjectReference_Free(&item->sessionManager);
- esxVI_ManagedObjectReference_Free(&item->authorizationManager);
- esxVI_ManagedObjectReference_Free(&item->perfManager);
- esxVI_ManagedObjectReference_Free(&item->scheduledTaskManager);
- esxVI_ManagedObjectReference_Free(&item->alarmManager);
- esxVI_ManagedObjectReference_Free(&item->eventManager);
- esxVI_ManagedObjectReference_Free(&item->taskManager);
- esxVI_ManagedObjectReference_Free(&item->extensionManager);
- esxVI_ManagedObjectReference_Free(&item->customizationSpecManager);
- esxVI_ManagedObjectReference_Free(&item->customFieldsManager);
- esxVI_ManagedObjectReference_Free(&item->accountManager);
- esxVI_ManagedObjectReference_Free(&item->diagnosticManager);
- esxVI_ManagedObjectReference_Free(&item->licenseManager);
- esxVI_ManagedObjectReference_Free(&item->searchIndex);
- esxVI_ManagedObjectReference_Free(&item->fileManager);
- esxVI_ManagedObjectReference_Free(&item->virtualDiskManager);
- esxVI_ManagedObjectReference_Free(&item->virtualizationManager);
-});
-
-/* esxVI_ServiceContent_Validate */
-ESX_VI__TEMPLATE__VALIDATE(ServiceContent,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(rootFolder);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(propertyCollector);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(about);
-});
-
-/* esxVI_ServiceContent_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(ServiceContent,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "Folder", rootFolder);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "PropertyCollector",
- propertyCollector);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "ViewManager",
- viewManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(AboutInfo, about);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "OptionManager", setting);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "UserDirectory",
- userDirectory);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "SessionManager",
- sessionManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "AuthorizationManager",
- authorizationManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "PerformanceManager",
- perfManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "ScheduledTaskManager",
- scheduledTaskManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "AlarmManager",
- alarmManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "EventManager",
- eventManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "TaskManager",
- taskManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "ExtensionManager",
- extensionManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "CustomizationSpecManager",
- customizationSpecManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "CustomFieldsManager",
- customFieldsManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "HostLocalAccountManager",
- accountManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "DiagnosticManager",
- diagnosticManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "LicenseManager",
- licenseManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "SearchIndex",
- searchIndex);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "FileManager",
- fileManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "VirtualDiskManager",
- virtualDiskManager);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "VirtualizationManager",
- virtualizationManager);
-});
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: UpdateSet
- */
-
-/* esxVI_UpdateSet_Alloc */
-ESX_VI__TEMPLATE__ALLOC(UpdateSet);
-
-/* esxVI_UpdateSet_Free */
-ESX_VI__TEMPLATE__FREE(UpdateSet,
-{
- VIR_FREE(item->version);
- esxVI_PropertyFilterUpdate_Free(&item->filterSet);
-});
-
-/* esxVI_UpdateSet_Validate */
-ESX_VI__TEMPLATE__VALIDATE(UpdateSet,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(version);
-});
-
-/* esxVI_UpdateSet_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(UpdateSet,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, version);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(PropertyFilterUpdate,
- filterSet);
-});
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: SharesInfo
- */
-
-/* esxVI_SharesInfo_Alloc */
-ESX_VI__TEMPLATE__ALLOC(SharesInfo);
-
-/* esxVI_SharesInfo_Free */
-ESX_VI__TEMPLATE__FREE(SharesInfo,
-{
- esxVI_Int_Free(&item->shares);
-});
-
-/* esxVI_SharesInfo_Validate */
-ESX_VI__TEMPLATE__VALIDATE(SharesInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(shares);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(level);
-});
-
-/* esxVI_SharesInfo_CastFromAnyType */
-ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(SharesInfo);
-
-/* esxVI_SharesInfo_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(SharesInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, shares);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(SharesLevel, level);
-});
-
-/* esxVI_SharesInfo_Serialize */
-ESX_VI__TEMPLATE__SERIALIZE(SharesInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Int, shares);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(SharesLevel, level);
-});
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ResourceAllocationInfo
- */
-
-/* esxVI_ResourceAllocationInfo_Alloc */
-ESX_VI__TEMPLATE__ALLOC(ResourceAllocationInfo);
-
-/* esxVI_ResourceAllocationInfo_Free */
-ESX_VI__TEMPLATE__FREE(ResourceAllocationInfo,
-{
- esxVI_Long_Free(&item->reservation);
- esxVI_Long_Free(&item->limit);
- esxVI_SharesInfo_Free(&item->shares);
- esxVI_Long_Free(&item->overheadLimit);
-});
-
-/* esxVI_ResourceAllocationInfo_Validate */
-ESX_VI__TEMPLATE__VALIDATE_NOOP(ResourceAllocationInfo);
-
-/* esxVI_ResourceAllocationInfo_Serialize */
-ESX_VI__TEMPLATE__SERIALIZE(ResourceAllocationInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Long, reservation);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Boolean, expandableReservation);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Long, limit);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(SharesInfo, shares);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Long, overheadLimit);
-});
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ResourcePoolResourceUsage
- */
-
-/* esxVI_ResourcePoolResourceUsage_Alloc */
-ESX_VI__TEMPLATE__ALLOC(ResourcePoolResourceUsage);
-
-/* esxVI_ResourcePoolResourceUsage_Free */
-ESX_VI__TEMPLATE__FREE(ResourcePoolResourceUsage,
-{
- esxVI_Long_Free(&item->reservationUsed);
- esxVI_Long_Free(&item->reservationUsedForVm);
- esxVI_Long_Free(&item->unreservedForPool);
- esxVI_Long_Free(&item->unreservedForVm);
- esxVI_Long_Free(&item->overallUsage);
- esxVI_Long_Free(&item->maxUsage);
-});
-
-/* esxVI_ResourcePoolResourceUsage_Validate */
-ESX_VI__TEMPLATE__VALIDATE(ResourcePoolResourceUsage,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(reservationUsed);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(reservationUsedForVm);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(unreservedForPool);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(unreservedForVm);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(overallUsage);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(maxUsage);
-});
-
-/* esxVI_ResourcePoolResourceUsage_CastFromAnyType */
-ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(ResourcePoolResourceUsage);
-
-/* esxVI_ResourcePoolResourceUsage_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(ResourcePoolResourceUsage,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Long, reservationUsed);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Long, reservationUsedForVm);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Long, unreservedForPool);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Long, unreservedForVm);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Long, overallUsage);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Long, maxUsage);
-});
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: VirtualMachineConfigSpec
- */
-
-/* esxVI_VirtualMachineConfigSpec_Alloc */
-ESX_VI__TEMPLATE__ALLOC(VirtualMachineConfigSpec);
-
-/* esxVI_VirtualMachineConfigSpec_Free */
-ESX_VI__TEMPLATE__FREE(VirtualMachineConfigSpec,
-{
- VIR_FREE(item->changeVersion);
- VIR_FREE(item->name);
- VIR_FREE(item->version);
- VIR_FREE(item->uuid);
- esxVI_Long_Free(&item->npivNodeWorldWideName);
- esxVI_Long_Free(&item->npivPortWorldWideName);
- VIR_FREE(item->npivWorldWideNameType);
- VIR_FREE(item->npivWorldWideNameOp);
- VIR_FREE(item->locationId);
- VIR_FREE(item->guestId);
- VIR_FREE(item->alternateGuestName);
- VIR_FREE(item->annotation);
- /* FIXME: implement missing */
- esxVI_Int_Free(&item->numCPUs);
- esxVI_Long_Free(&item->memoryMB);
- /* FIXME: implement missing */
- esxVI_ResourceAllocationInfo_Free(&item->cpuAllocation);
- esxVI_ResourceAllocationInfo_Free(&item->memoryAllocation);
- /* FIXME: implement missing */
- VIR_FREE(item->swapPlacement);
- /* FIXME: implement missing */
-});
-
-/* esxVI_VirtualMachineConfigSpec_Validate */
-ESX_VI__TEMPLATE__VALIDATE_NOOP(VirtualMachineConfigSpec);
-
-/* esxVI_VirtualMachineConfigSpec_Serialize */
-ESX_VI__TEMPLATE__SERIALIZE(VirtualMachineConfigSpec,
-{
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, changeVersion);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, name);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, version);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, uuid);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(Long, npivNodeWorldWideName);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(Long, npivPortWorldWideName);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, npivWorldWideNameType);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, npivWorldWideNameOp);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, locationId);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, guestId);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, alternateGuestName);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, annotation);
- /* FIXME: implement missing */
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Int, numCPUs);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Long, memoryMB);
- /* FIXME: implement missing */
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(ResourceAllocationInfo,
- cpuAllocation);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(ResourceAllocationInfo,
- memoryAllocation);
- /* FIXME: implement missing */
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, swapPlacement);
- /* FIXME: implement missing */
-});
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: Event
- */
-
-/* esxVI_Event_Alloc */
-ESX_VI__TEMPLATE__ALLOC(Event);
-
-/* esxVI_Event_Free */
-ESX_VI__TEMPLATE__FREE(Event,
-{
- esxVI_Event_Free(&item->_next);
-
- /* FIXME: implement the rest */
- esxVI_Int_Free(&item->key);
- esxVI_Int_Free(&item->chainId);
- esxVI_DateTime_Free(&item->createdTime);
- VIR_FREE(item->userName);
- VIR_FREE(item->fullFormattedMessage);
-});
-
-/* esxVI_Event_Validate */
-ESX_VI__TEMPLATE__VALIDATE(Event,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(key);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(chainId);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(createdTime);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(userName);
-});
-
-/* esxVI_Event_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(Event,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, key);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, chainId);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(DateTime, createdTime);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, userName);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(datacenter); /* FIXME */
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(computeResource); /* FIXME */
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(host); /* FIXME */
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(vm); /* FIXME */
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, fullFormattedMessage);
-});
-
-/* esxVI_Event_DeserializeList */
-ESX_VI__TEMPLATE__LIST__DESERIALIZE(Event);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: UserSession
- */
-
-/* esxVI_UserSession_Alloc */
-ESX_VI__TEMPLATE__ALLOC(UserSession);
-
-/* esxVI_UserSession_Free */
-ESX_VI__TEMPLATE__FREE(UserSession,
-{
- VIR_FREE(item->key);
- VIR_FREE(item->userName);
- VIR_FREE(item->fullName);
- esxVI_DateTime_Free(&item->loginTime);
- esxVI_DateTime_Free(&item->lastActiveTime);
- VIR_FREE(item->locale);
- VIR_FREE(item->messageLocale);
-});
-
-/* esxVI_UserSession_Validate */
-ESX_VI__TEMPLATE__VALIDATE(UserSession,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(key);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(userName);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(fullName);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(loginTime);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(lastActiveTime);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(locale);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(messageLocale);
-});
-
-/* esxVI_UserSession_CastFromAnyType */
-ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(UserSession);
-
-/* esxVI_UserSession_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(UserSession,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, key);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, userName);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, fullName);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(DateTime, loginTime);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(DateTime, lastActiveTime);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, locale);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, messageLocale);
-});
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: VirtualMachineQuestionInfo
- */
-
-/* esxVI_VirtualMachineQuestionInfo_Alloc */
-ESX_VI__TEMPLATE__ALLOC(VirtualMachineQuestionInfo);
-
-/* esxVI_VirtualMachineQuestionInfo_Free */
-ESX_VI__TEMPLATE__FREE(VirtualMachineQuestionInfo,
-{
- VIR_FREE(item->id);
- VIR_FREE(item->text);
- esxVI_ChoiceOption_Free(&item->choice);
- /*esxVI_VirtualMachineMessage_Free(&item->message);*//* FIXME */
-});
-
-/* esxVI_VirtualMachineQuestionInfo_Validate */
-ESX_VI__TEMPLATE__VALIDATE(VirtualMachineQuestionInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(id);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(text);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(choice);
-});
-
-/* esxVI_VirtualMachineQuestionInfo_CastFromAnyType */
-ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(VirtualMachineQuestionInfo);
-
-/* esxVI_VirtualMachineQuestionInfo_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(VirtualMachineQuestionInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, id);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, text);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(ChoiceOption, choice);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(message); /* FIXME */
-});
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ElementDescription extends Description
- *
- * In contrast to SelectionSpec and TraversalSpec just merge
- * Description into ElementDescription for simplicity, because
- * only ElementDescription is used.
- */
-
-/* esxVI_ElementDescription_Alloc */
-ESX_VI__TEMPLATE__ALLOC(ElementDescription);
-
-/* esxVI_ElementDescription_Free */
-ESX_VI__TEMPLATE__FREE(ElementDescription,
-{
- esxVI_ElementDescription_Free(&item->_next);
-
- VIR_FREE(item->label);
- VIR_FREE(item->summary);
- VIR_FREE(item->key);
-});
-
-/* esxVI_ElementDescription_Validate */
-ESX_VI__TEMPLATE__VALIDATE(ElementDescription,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(label);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(summary);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(key);
-});
-
-/* esxVI_ElementDescription_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(ElementDescription);
-
-/* esxVI_ElementDescription_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(ElementDescription,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, label);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, summary);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, key);
-});
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ChoiceOption extends OptionType
- *
- * In contrast to SelectionSpec and TraversalSpec just merge
- * OptionType into ChoiceOption for simplicity, because
- * only ChoiceOption is used.
- */
-
-/* esxVI_ChoiceOption_Alloc */
-ESX_VI__TEMPLATE__ALLOC(ChoiceOption);
-
-/* esxVI_ChoiceOption_Free */
-ESX_VI__TEMPLATE__FREE(ChoiceOption,
-{
- esxVI_ElementDescription_Free(&item->choiceInfo);
- esxVI_Int_Free(&item->defaultIndex);
-});
-
-/* esxVI_ChoiceOption_Validate */
-ESX_VI__TEMPLATE__VALIDATE(ChoiceOption,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(choiceInfo);
-});
-
-/* esxVI_ChoiceOption_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(ChoiceOption,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Boolean, valueIsReadonly);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(ElementDescription, choiceInfo);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, defaultIndex);
-});
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PerfMetricId
- */
-
-/* esxVI_PerfMetricId_Alloc */
-ESX_VI__TEMPLATE__ALLOC(PerfMetricId);
-
-/* esxVI_PerfMetricId_Free */
-ESX_VI__TEMPLATE__FREE(PerfMetricId,
-{
- esxVI_PerfMetricId_Free(&item->_next);
-
- esxVI_Int_Free(&item->counterId);
- VIR_FREE(item->instance);
-});
-
-/* esxVI_PerfMetricId_Validate */
-ESX_VI__TEMPLATE__VALIDATE(PerfMetricId,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(counterId);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(instance);
-});
-
-/* esxVI_PerfMetricId_Serialize */
-ESX_VI__TEMPLATE__SERIALIZE(PerfMetricId,
-{
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Int, counterId);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, instance);
-});
-
-/* esxVI_PerfMetricId_SerializeList */
-ESX_VI__TEMPLATE__LIST__SERIALIZE(PerfMetricId);
-
-/* esxVI_PerfMetricId_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(PerfMetricId,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, counterId);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, instance);
-});
-
-/* esxVI_PerfMetricId_DeserializeList */
-ESX_VI__TEMPLATE__LIST__DESERIALIZE(PerfMetricId);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PerfCounterInfo
- */
-
-/* esxVI_PerfCounterInfo_Alloc */
-ESX_VI__TEMPLATE__ALLOC(PerfCounterInfo);
-
-/* esxVI_PerfCounterInfo_Free */
-ESX_VI__TEMPLATE__FREE(PerfCounterInfo,
-{
- esxVI_PerfCounterInfo_Free(&item->_next);
-
- esxVI_Int_Free(&item->key);
- esxVI_ElementDescription_Free(&item->nameInfo);
- esxVI_ElementDescription_Free(&item->groupInfo);
- esxVI_ElementDescription_Free(&item->unitInfo);
- esxVI_Int_Free(&item->level);
- esxVI_Int_Free(&item->associatedCounterId);
-});
-
-/* esxVI_PerfCounterInfo_Validate */
-ESX_VI__TEMPLATE__VALIDATE(PerfCounterInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(key);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(nameInfo);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(groupInfo);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(unitInfo);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(rollupType);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(statsType);
-});
-
-/* esxVI_PerfCounterInfo_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(PerfCounterInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, key);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(ElementDescription, nameInfo);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(ElementDescription, groupInfo);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(ElementDescription, unitInfo);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(PerfSummaryType, rollupType);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(PerfStatsType, statsType);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, level);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(Int, associatedCounterId);
-});
-
-/* esxVI_PerfCounterInfo_DeserializeList */
-ESX_VI__TEMPLATE__LIST__DESERIALIZE(PerfCounterInfo);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PerfQuerySpec
- */
-
-/* esxVI_PerfQuerySpec_Alloc */
-ESX_VI__TEMPLATE__ALLOC(PerfQuerySpec);
-
-/* esxVI_PerfQuerySpec_Free */
-ESX_VI__TEMPLATE__FREE(PerfQuerySpec,
-{
- esxVI_PerfQuerySpec_Free(&item->_next);
-
- esxVI_ManagedObjectReference_Free(&item->entity);
- esxVI_DateTime_Free(&item->startTime);
- esxVI_DateTime_Free(&item->endTime);
- esxVI_Int_Free(&item->maxSample);
- esxVI_PerfMetricId_Free(&item->metricId);
- esxVI_Int_Free(&item->intervalId);
- VIR_FREE(item->format);
-});
-
-/* esxVI_PerfQuerySpec_Validate */
-ESX_VI__TEMPLATE__VALIDATE(PerfQuerySpec,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(entity);
-});
-
-/* esxVI_PerfQuerySpec_Serialize */
-ESX_VI__TEMPLATE__SERIALIZE(PerfQuerySpec,
-{
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(ManagedObjectReference, entity);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(DateTime, startTime);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(DateTime, endTime);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Int, maxSample);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(PerfMetricId, metricId);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(Int, intervalId);
- ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(String, format);
-});
-
-/* esxVI_PerfQuerySpec_SerializeList */
-ESX_VI__TEMPLATE__LIST__SERIALIZE(PerfQuerySpec);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PerfSampleInfo
- */
-
-/* esxVI_PerfSampleInfo_Alloc */
-ESX_VI__TEMPLATE__ALLOC(PerfSampleInfo);
-
-/* esxVI_PerfSampleInfo_Free */
-ESX_VI__TEMPLATE__FREE(PerfSampleInfo,
-{
- esxVI_PerfSampleInfo_Free(&item->_next);
-
- esxVI_DateTime_Free(&item->timestamp);
- esxVI_Int_Free(&item->interval);
-});
-
-/* esxVI_PerfSampleInfo_Validate */
-ESX_VI__TEMPLATE__VALIDATE(PerfSampleInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(timestamp);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(interval);
-});
-
-/* esxVI_PerfSampleInfo_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(PerfSampleInfo);
-
-/* esxVI_PerfSampleInfo_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(PerfSampleInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(DateTime, timestamp);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, interval);
-});
-
-/* esxVI_PerfSampleInfo_DeserializeList */
-ESX_VI__TEMPLATE__LIST__DESERIALIZE(PerfSampleInfo);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PerfMetricIntSeries extends PerfMetricSeries
- *
- * In contrast to SelectionSpec and TraversalSpec just merge
- * PerfMetricSeries into PerfMetricIntSeries for simplicity, because
- * only PerfMetricIntSeries is used and the other type inheriting
- * PerfMetricSeries (PerfMetricSeriesCSV) is not used.
- */
-
-/* esxVI_PerfMetricIntSeries_Alloc */
-ESX_VI__TEMPLATE__ALLOC(PerfMetricIntSeries);
-
-/* esxVI_PerfMetricIntSeries_Free */
-ESX_VI__TEMPLATE__FREE(PerfMetricIntSeries,
-{
- esxVI_PerfMetricIntSeries_Free(&item->_next);
-
- esxVI_PerfMetricId_Free(&item->id);
- esxVI_Long_Free(&item->value);
-});
-
-/* esxVI_PerfMetricIntSeries_Validate */
-ESX_VI__TEMPLATE__VALIDATE(PerfMetricIntSeries,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(id);
-});
-
-/* esxVI_PerfMetricIntSeries_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(PerfMetricIntSeries);
-
-/* esxVI_PerfMetricIntSeries_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(PerfMetricIntSeries,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(PerfMetricId, id);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(Long, value);
-});
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PerfEntityMetric extends PerfEntityMetricBase
- *
- * In contrast to SelectionSpec and TraversalSpec just merge
- * PerfEntityMetricBase into PerfEntityMetric for simplicity, because
- * only PerfEntityMetric is used and the other type inheriting
- * PerfEntityMetric (PerfEntityMetricCSV) is not used.
- *
- * Also use PerfMetricIntSeries instead of the correct base type
- * PerfMetricSeries for the value property, because only
- * PerfMetricIntSeries is used.
- */
-
-/* esxVI_PerfEntityMetric_Alloc */
-ESX_VI__TEMPLATE__ALLOC(PerfEntityMetric);
-
-/* esxVI_PerfEntityMetric_Free */
-ESX_VI__TEMPLATE__FREE(PerfEntityMetric,
-{
- esxVI_PerfEntityMetric_Free(&item->_next);
-
- esxVI_ManagedObjectReference_Free(&item->entity);
- esxVI_PerfSampleInfo_Free(&item->sampleInfo);
- esxVI_PerfMetricIntSeries_Free(&item->value);
-});
-
-/* esxVI_PerfEntityMetric_Validate */
-ESX_VI__TEMPLATE__VALIDATE(PerfEntityMetric,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(entity);
-});
-
-/* esxVI_PerfEntityMetric_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(PerfEntityMetric,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- NULL, entity);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(PerfSampleInfo, sampleInfo);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(PerfMetricIntSeries, value);
-});
-
-/* esxVI_PerfEntityMetric_DeserializeList */
-ESX_VI__TEMPLATE__LIST__DESERIALIZE(PerfEntityMetric);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: TaskInfo
- */
-
-/* esxVI_TaskInfo_Alloc */
-ESX_VI__TEMPLATE__ALLOC(TaskInfo);
-
-/* esxVI_TaskInfo_Free */
-ESX_VI__TEMPLATE__FREE(TaskInfo,
-{
- esxVI_TaskInfo_Free(&item->_next);
-
- VIR_FREE(item->key);
- esxVI_ManagedObjectReference_Free(&item->task);
- VIR_FREE(item->name);
- VIR_FREE(item->descriptionId);
- esxVI_ManagedObjectReference_Free(&item->entity);
- VIR_FREE(item->entityName);
- /*esxVI_ManagedObjectReference_Free(&item->locked);*//* FIXME */
- /*esxVI_MethodFault_Free(&item->error);*//* FIXME */
- esxVI_AnyType_Free(&item->result);
- esxVI_Int_Free(&item->progress);
- /*esxVI_TaskReason_Free(&item->reason);*//* FIXME */
- esxVI_DateTime_Free(&item->queueTime);
- esxVI_DateTime_Free(&item->startTime);
- esxVI_DateTime_Free(&item->completeTime);
- esxVI_Int_Free(&item->eventChainId);
-});
-
-/* esxVI_TaskInfo_Validate */
-ESX_VI__TEMPLATE__VALIDATE(TaskInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(key);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(task);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(descriptionId);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(state);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(cancelled);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(cancelable);
- /*ESX_VI__TEMPLATE__PROPERTY__REQUIRE(reason);*//* FIXME */
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(queueTime);
- ESX_VI__TEMPLATE__PROPERTY__REQUIRE(eventChainId);
-});
-
-/* esxVI_TaskInfo_CastFromAnyType */
-ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(TaskInfo);
-
-/* esxVI_TaskInfo_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(TaskInfo);
-
-/* esxVI_TaskInfo_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE(TaskInfo,
-{
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, key);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- "Task", task);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, name);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, descriptionId);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(ManagedObjectReference,
- NULL, entity);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, entityName);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(locked); /* FIXME */
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(TaskInfoState, state);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Boolean, cancelled);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Boolean, cancelable);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(error); /* FIXME */
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(AnyType, result);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, progress);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_NOOP(reason); /* FIXME */
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(DateTime, queueTime);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(DateTime, startTime);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(DateTime, completeTime);
- ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(Int, eventChainId);
-});
+#include "esx_vi_types.generated.c"
diff --git a/src/esx/esx_vi_types.h b/src/esx/esx_vi_types.h
index e5451e9..a61cdc1 100644
--- a/src/esx/esx_vi_types.h
+++ b/src/esx/esx_vi_types.h
@@ -25,13 +25,8 @@
# include "buf.h"
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * XSI
- */
-
typedef enum _esxVI_Type esxVI_Type;
+typedef struct _esxVI_Object esxVI_Object;
@@ -49,75 +44,50 @@ typedef struct _esxVI_DateTime esxVI_DateTime;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enums
- */
-
-typedef enum _esxVI_ManagedEntityStatus esxVI_ManagedEntityStatus;
-typedef enum _esxVI_ObjectUpdateKind esxVI_ObjectUpdateKind;
-typedef enum _esxVI_PerfSummaryType esxVI_PerfSummaryType;
-typedef enum _esxVI_PerfStatsType esxVI_PerfStatsType;
-typedef enum _esxVI_PropertyChangeOp esxVI_PropertyChangeOp;
-typedef enum _esxVI_SharesLevel esxVI_SharesLevel;
-typedef enum _esxVI_TaskInfoState esxVI_TaskInfoState;
-typedef enum _esxVI_VirtualMachineMovePriority esxVI_VirtualMachineMovePriority;
-typedef enum _esxVI_VirtualMachinePowerState esxVI_VirtualMachinePowerState;
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* VI Types
*/
typedef struct _esxVI_Fault esxVI_Fault;
typedef struct _esxVI_ManagedObjectReference esxVI_ManagedObjectReference;
-typedef struct _esxVI_DynamicProperty esxVI_DynamicProperty;
-typedef struct _esxVI_HostCpuIdInfo esxVI_HostCpuIdInfo;
-typedef struct _esxVI_SelectionSpec esxVI_SelectionSpec;
-typedef struct _esxVI_TraversalSpec esxVI_TraversalSpec;
-typedef struct _esxVI_ObjectSpec esxVI_ObjectSpec;
-typedef struct _esxVI_PropertyChange esxVI_PropertyChange;
-typedef struct _esxVI_PropertySpec esxVI_PropertySpec;
-typedef struct _esxVI_PropertyFilterSpec esxVI_PropertyFilterSpec;
-typedef struct _esxVI_ObjectContent esxVI_ObjectContent;
-typedef struct _esxVI_ObjectUpdate esxVI_ObjectUpdate;
-typedef struct _esxVI_PropertyFilterUpdate esxVI_PropertyFilterUpdate;
-typedef struct _esxVI_AboutInfo esxVI_AboutInfo;
-typedef struct _esxVI_ServiceContent esxVI_ServiceContent;
-typedef struct _esxVI_UpdateSet esxVI_UpdateSet;
-typedef struct _esxVI_SharesInfo esxVI_SharesInfo;
-typedef struct _esxVI_ResourceAllocationInfo esxVI_ResourceAllocationInfo;
-typedef struct _esxVI_ResourcePoolResourceUsage esxVI_ResourcePoolResourceUsage;
-typedef struct _esxVI_VirtualMachineConfigSpec esxVI_VirtualMachineConfigSpec;
-typedef struct _esxVI_Event esxVI_Event;
-typedef struct _esxVI_UserSession esxVI_UserSession;
-typedef struct _esxVI_VirtualMachineQuestionInfo esxVI_VirtualMachineQuestionInfo;
-typedef struct _esxVI_ElementDescription esxVI_ElementDescription;
-typedef struct _esxVI_ChoiceOption esxVI_ChoiceOption;
-typedef struct _esxVI_PerfMetricId esxVI_PerfMetricId;
-typedef struct _esxVI_PerfCounterInfo esxVI_PerfCounterInfo;
-typedef struct _esxVI_PerfQuerySpec esxVI_PerfQuerySpec;
-typedef struct _esxVI_PerfSampleInfo esxVI_PerfSampleInfo;
-typedef struct _esxVI_PerfMetricIntSeries esxVI_PerfMetricIntSeries;
-typedef struct _esxVI_PerfEntityMetric esxVI_PerfEntityMetric;
-typedef struct _esxVI_TaskInfo esxVI_TaskInfo;
+
+#include "esx_vi_types.generated.typedef"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * XSI: Type
+ * Type
*/
enum _esxVI_Type {
esxVI_Type_Undefined = 0,
esxVI_Type_Boolean,
+ esxVI_Type_AnyType,
esxVI_Type_String,
esxVI_Type_Short,
esxVI_Type_Int,
esxVI_Type_Long,
+ esxVI_Type_DateTime,
+ esxVI_Type_Fault,
+ esxVI_Type_ManagedObjectReference,
+
+#include "esx_vi_types.generated.typeenum"
+
esxVI_Type_Other,
};
-const char *esxVI_Type_Name(esxVI_Type type);
+const char *esxVI_Type_ToString(esxVI_Type type);
+esxVI_Type esxVI_Type_FromString(const char *type);
+
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Object extends List
+ */
+
+struct _esxVI_Object {
+ esxVI_Object *_next; /* optional */
+ esxVI_Type _type; /* required */
+};
@@ -142,8 +112,10 @@ int esxVI_Boolean_Deserialize(xmlNodePtr node, esxVI_Boolean *boolean_);
*/
struct _esxVI_AnyType {
- xmlNodePtr _node; /* required */
+ esxVI_AnyType *_unused; /* optional */
+ esxVI_Type _type; /* = esxVI_Type_AnyType */ /* required */
+ xmlNodePtr node; /* required */
esxVI_Type type; /* required */
char *other; /* required */
char *value; /* required */
@@ -170,12 +142,14 @@ int esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType);
struct _esxVI_String {
esxVI_String *_next; /* optional */
+ esxVI_Type _type; /* required */
char *value; /* required */
};
int esxVI_String_Alloc(esxVI_String **string);
void esxVI_String_Free(esxVI_String **stringList);
+int esxVI_String_Validate(esxVI_String *string);
int esxVI_String_AppendToList(esxVI_String **stringList, esxVI_String *string);
int esxVI_String_AppendValueToList(esxVI_String **stringList,
const char *value);
@@ -202,6 +176,7 @@ int esxVI_String_DeserializeValue(xmlNodePtr node, char **value);
struct _esxVI_Int {
esxVI_Int *_next; /* optional */
+ esxVI_Type _type; /* required */
int32_t value; /* required */
};
@@ -225,6 +200,7 @@ int esxVI_Int_Deserialize(xmlNodePtr node, esxVI_Int **number);
struct _esxVI_Long {
esxVI_Long *_next; /* optional */
+ esxVI_Type _type; /* required */
int64_t value; /* required */
};
@@ -246,6 +222,9 @@ int esxVI_Long_Deserialize(xmlNodePtr node, esxVI_Long **number);
*/
struct _esxVI_DateTime {
+ esxVI_DateTime *_unused; /* optional */
+ esxVI_Type _type; /* required */
+
char *value; /* required */
};
@@ -259,170 +238,13 @@ int esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: ManagedEntityStatus
- */
-
-enum _esxVI_ManagedEntityStatus {
- esxVI_ManagedEntityStatus_Undefined = 0,
- esxVI_ManagedEntityStatus_Gray,
- esxVI_ManagedEntityStatus_Green,
- esxVI_ManagedEntityStatus_Yellow,
- esxVI_ManagedEntityStatus_Red,
-};
-
-int esxVI_ManagedEntityStatus_CastFromAnyType
- (esxVI_AnyType *anyType, esxVI_ManagedEntityStatus *managedEntityStatus);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: ObjectUpdateKind
- */
-
-enum _esxVI_ObjectUpdateKind {
- esxVI_ObjectUpdateKind_Undefined = 0,
- esxVI_ObjectUpdateKind_Enter,
- esxVI_ObjectUpdateKind_Leave,
- esxVI_ObjectUpdateKind_Modify,
-};
-
-int esxVI_ObjectUpdateKind_Deserialize
- (xmlNodePtr node, esxVI_ObjectUpdateKind *objectUpdateKind);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: PerfSummaryType
- */
-
-enum _esxVI_PerfSummaryType {
- esxVI_PerfSummaryType_Undefined = 0,
- esxVI_PerfSummaryType_Average,
- esxVI_PerfSummaryType_Latest,
- esxVI_PerfSummaryType_Maximum,
- esxVI_PerfSummaryType_Minimum,
- esxVI_PerfSummaryType_None,
- esxVI_PerfSummaryType_Summation,
-};
-
-int esxVI_PerfSummaryType_Deserialize(xmlNodePtr node,
- esxVI_PerfSummaryType *perfSummaryType);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: PerfStatsType
- */
-
-enum _esxVI_PerfStatsType {
- esxVI_PerfStatsType_Undefined = 0,
- esxVI_PerfStatsType_Absolute,
- esxVI_PerfStatsType_Delta,
- esxVI_PerfStatsType_Rate,
-};
-
-int esxVI_PerfStatsType_Deserialize(xmlNodePtr node,
- esxVI_PerfStatsType *perfStatsType);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: PropertyChangeOp
- */
-
-enum _esxVI_PropertyChangeOp {
- esxVI_PropertyChangeOp_Undefined = 0,
- esxVI_PropertyChangeOp_Add,
- esxVI_PropertyChangeOp_Remove,
- esxVI_PropertyChangeOp_Assign,
- esxVI_PropertyChangeOp_IndirectRemove,
-};
-
-int esxVI_PropertyChangeOp_Deserialize
- (xmlNodePtr node, esxVI_PropertyChangeOp *propertyChangeOp);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: SharesLevel
- */
-
-enum _esxVI_SharesLevel {
- esxVI_SharesLevel_Undefined = 0,
- esxVI_SharesLevel_Custom,
- esxVI_SharesLevel_High,
- esxVI_SharesLevel_Low,
- esxVI_SharesLevel_Normal,
-};
-
-int esxVI_SharesLevel_Serialize(esxVI_SharesLevel sharesLevel,
- const char *element, virBufferPtr output);
-int esxVI_SharesLevel_Deserialize(xmlNodePtr node,
- esxVI_SharesLevel *sharesLevel);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: TaskInfoState
- */
-
-enum _esxVI_TaskInfoState {
- esxVI_TaskInfoState_Undefined = 0,
- esxVI_TaskInfoState_Error,
- esxVI_TaskInfoState_Queued,
- esxVI_TaskInfoState_Running,
- esxVI_TaskInfoState_Success,
-};
-
-int esxVI_TaskInfoState_CastFromAnyType(esxVI_AnyType *anyType,
- esxVI_TaskInfoState *taskInfoState);
-int esxVI_TaskInfoState_Deserialize(xmlNodePtr node,
- esxVI_TaskInfoState *taskInfoState);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: VirtualMachineMovePriority
- */
-
-enum _esxVI_VirtualMachineMovePriority {
- esxVI_VirtualMachineMovePriority_Undefined = 0,
- esxVI_VirtualMachineMovePriority_LowPriority,
- esxVI_VirtualMachineMovePriority_HighPriority,
- esxVI_VirtualMachineMovePriority_DefaultPriority,
-};
-
-int esxVI_VirtualMachineMovePriority_Serialize
- (esxVI_VirtualMachineMovePriority virtualMachineMovePriority,
- const char *element, virBufferPtr output);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Enum: VirtualMachinePowerState
- */
-
-enum _esxVI_VirtualMachinePowerState {
- esxVI_VirtualMachinePowerState_Undefined = 0,
- esxVI_VirtualMachinePowerState_PoweredOff,
- esxVI_VirtualMachinePowerState_PoweredOn,
- esxVI_VirtualMachinePowerState_Suspended,
-};
-
-int esxVI_VirtualMachinePowerState_CastFromAnyType
- (esxVI_AnyType *anyType,
- esxVI_VirtualMachinePowerState *virtualMachinePowerState);
-int esxVI_VirtualMachinePowerState_Serialize
- (esxVI_VirtualMachinePowerState virtualMachinePowerState,
- const char *element, virBufferPtr output);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* VI Type: Fault
*/
struct _esxVI_Fault {
+ esxVI_Fault *_unused; /* optional */
+ esxVI_Type _type; /* required */
+
char *faultcode; /* required */
char *faultstring; /* required */
};
@@ -440,6 +262,7 @@ int esxVI_Fault_Deserialize(xmlNodePtr node, esxVI_Fault **fault);
struct _esxVI_ManagedObjectReference {
esxVI_ManagedObjectReference *_next; /* optional */
+ esxVI_Type _type; /* required */
char *type; /* required */
char *value; /* required */
@@ -454,14 +277,12 @@ int esxVI_ManagedObjectReference_DeepCopy(esxVI_ManagedObjectReference **dest,
int esxVI_ManagedObjectReference_AppendToList
(esxVI_ManagedObjectReference **managedObjectReferenceList,
esxVI_ManagedObjectReference *managedObjectReference);
-int esxVI_ManagedObjectReference_CastFromAnyType(esxVI_AnyType *anyType,
- esxVI_ManagedObjectReference
- **managedObjectReference,
- const char *expectedType);
+int esxVI_ManagedObjectReference_CastFromAnyType
+ (esxVI_AnyType *anyType,
+ esxVI_ManagedObjectReference **managedObjectReference);
int esxVI_ManagedObjectReference_CastListFromAnyType
(esxVI_AnyType *anyType,
- esxVI_ManagedObjectReference **managedObjectReferenceList,
- const char *expectedType);
+ esxVI_ManagedObjectReference **managedObjectReferenceList);
int esxVI_ManagedObjectReference_Serialize
(esxVI_ManagedObjectReference *managedObjectReference,
const char *element, virBufferPtr output);
@@ -469,833 +290,10 @@ int esxVI_ManagedObjectReference_SerializeList
(esxVI_ManagedObjectReference *managedObjectReference,
const char *element, virBufferPtr output);
int esxVI_ManagedObjectReference_Deserialize
- (xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference,
- const char *expectedType);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: DynamicProperty
- */
-
-struct _esxVI_DynamicProperty {
- esxVI_DynamicProperty *_next; /* optional */
-
- char *name; /* required */
- esxVI_AnyType *val; /* required */
-};
-
-int esxVI_DynamicProperty_Alloc(esxVI_DynamicProperty **dynamicProperty);
-void esxVI_DynamicProperty_Free
- (esxVI_DynamicProperty **dynamicPropertyList);
-int esxVI_DynamicProperty_Validate(esxVI_DynamicProperty *dynamicProperty);
-int esxVI_DynamicProperty_DeepCopy(esxVI_DynamicProperty **dest,
- esxVI_DynamicProperty *src);
-int esxVI_DynamicProperty_DeepCopyList(esxVI_DynamicProperty **destList,
- esxVI_DynamicProperty *srcList);
-int esxVI_DynamicProperty_AppendToList
- (esxVI_DynamicProperty **dynamicPropertyList,
- esxVI_DynamicProperty *dynamicProperty);
-int esxVI_DynamicProperty_Deserialize(xmlNodePtr node,
- esxVI_DynamicProperty **dynamicProperty);
-int esxVI_DynamicProperty_DeserializeList
- (xmlNodePtr node, esxVI_DynamicProperty **dynamicPropertyList);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: HostCpuIdInfo
- */
-
-struct _esxVI_HostCpuIdInfo {
- esxVI_HostCpuIdInfo *_next; /* optional */
-
- esxVI_Int *level; /* required */
- char *vendor; /* optional */
- char *eax; /* optional */
- char *ebx; /* optional */
- char *ecx; /* optional */
- char *edx; /* optional */
-};
-
-int esxVI_HostCpuIdInfo_Alloc(esxVI_HostCpuIdInfo **hostCpuIdInfo);
-void esxVI_HostCpuIdInfo_Free(esxVI_HostCpuIdInfo **hostCpuIdInfoList);
-int esxVI_HostCpuIdInfo_Validate(esxVI_HostCpuIdInfo *hostCpuIdInfo);
-int esxVI_HostCpuIdInfo_CastFromAnyType(esxVI_AnyType *anyType,
- esxVI_HostCpuIdInfo **hostCpuIdInfo);
-int esxVI_HostCpuIdInfo_CastListFromAnyType
- (esxVI_AnyType *anyType, esxVI_HostCpuIdInfo **hostCpuIdInfoList);
-int esxVI_HostCpuIdInfo_Deserialize(xmlNodePtr node,
- esxVI_HostCpuIdInfo **hostCpuIdInfo);
-int esxVI_HostCpuIdInfo_DeserializeList
- (xmlNodePtr node, esxVI_HostCpuIdInfo **hostCpuIdInfoList);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: SelectionSpec
- */
-
-struct _esxVI_SelectionSpec {
- esxVI_SelectionSpec *_next; /* optional */
- esxVI_TraversalSpec *_super; /* optional */
-
- char *name; /* optional */
-};
-
-int esxVI_SelectionSpec_Alloc(esxVI_SelectionSpec **selectionSpec);
-void esxVI_SelectionSpec_Free(esxVI_SelectionSpec **selectionSpecList);
-int esxVI_SelectionSpec_Validate(esxVI_SelectionSpec *selectionSpec);
-int esxVI_SelectionSpec_AppendToList(esxVI_SelectionSpec **selectionSpecList,
- esxVI_SelectionSpec *selectionSpec);
-int esxVI_SelectionSpec_Serialize(esxVI_SelectionSpec *selectionSpec,
- const char *element, virBufferPtr output);
-int esxVI_SelectionSpec_SerializeList(esxVI_SelectionSpec *selectionSpecList,
- const char *element, virBufferPtr output);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: TraversalSpec extends SelectionSpec
- */
-
-struct _esxVI_TraversalSpec {
- esxVI_SelectionSpec *_base; /* required */
-
- char *type; /* required */
- char *path; /* required */
- esxVI_Boolean skip; /* optional */
- esxVI_SelectionSpec *selectSet; /* optional, list */
-};
-
-int esxVI_TraversalSpec_Alloc(esxVI_TraversalSpec **traversalSpec);
-void esxVI_TraversalSpec_Free(esxVI_TraversalSpec **traversalSpec);
-int esxVI_TraversalSpec_Validate(esxVI_TraversalSpec *traversalSpec);
-int esxVI_TraversalSpec_Serialize(esxVI_TraversalSpec *traversalSpec,
- const char *element, virBufferPtr output);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ObjectSpec
- */
-
-struct _esxVI_ObjectSpec {
- esxVI_ObjectSpec *_next; /* optional */
-
- esxVI_ManagedObjectReference *obj; /* required */
- esxVI_Boolean skip; /* optional */
- esxVI_SelectionSpec *selectSet; /* optional, list */
-};
-
-int esxVI_ObjectSpec_Alloc(esxVI_ObjectSpec **objectSpec);
-void esxVI_ObjectSpec_Free(esxVI_ObjectSpec **objectSpecList);
-int esxVI_ObjectSpec_Validate(esxVI_ObjectSpec *objectSpec);
-int esxVI_ObjectSpec_AppendToList(esxVI_ObjectSpec **objectSpecList,
- esxVI_ObjectSpec *objectSpec);
-int esxVI_ObjectSpec_Serialize(esxVI_ObjectSpec *objectSpec,
- const char *element, virBufferPtr output);
-int esxVI_ObjectSpec_SerializeList(esxVI_ObjectSpec *objectSpecList,
- const char *element, virBufferPtr output);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PropertyChange
- */
-
-struct _esxVI_PropertyChange {
- esxVI_PropertyChange *_next; /* optional */
-
- char *name; /* required */
- esxVI_PropertyChangeOp op; /* required */
- esxVI_AnyType *val; /* optional */
-};
-
-int esxVI_PropertyChange_Alloc(esxVI_PropertyChange **propertyChange);
-void esxVI_PropertyChange_Free(esxVI_PropertyChange **propertyChangeList);
-int esxVI_PropertyChange_Validate(esxVI_PropertyChange *propertyChange);
-int esxVI_PropertyChange_AppendToList
- (esxVI_PropertyChange **propertyChangeList,
- esxVI_PropertyChange *propertyChange);
-int esxVI_PropertyChange_Deserialize(xmlNodePtr node,
- esxVI_PropertyChange **propertyChange);
-int esxVI_PropertyChange_DeserializeList
- (xmlNodePtr node, esxVI_PropertyChange **propertyChangeList);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PropertySpec
- */
-
-struct _esxVI_PropertySpec {
- esxVI_PropertySpec *_next; /* optional */
-
- char *type; /* required */
- esxVI_Boolean all; /* optional */
- esxVI_String *pathSet; /* optional, list */
-};
-
-int esxVI_PropertySpec_Alloc(esxVI_PropertySpec **propertySpec);
-void esxVI_PropertySpec_Free(esxVI_PropertySpec **propertySpecList);
-int esxVI_PropertySpec_Validate(esxVI_PropertySpec *propertySpec);
-int esxVI_PropertySpec_AppendToList(esxVI_PropertySpec **propertySpecList,
- esxVI_PropertySpec *propertySpec);
-int esxVI_PropertySpec_Serialize(esxVI_PropertySpec *propertySpec,
- const char *element, virBufferPtr output);
-int esxVI_PropertySpec_SerializeList(esxVI_PropertySpec *propertySpecList,
- const char *element, virBufferPtr output);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PropertyFilterSpec
- */
-
-struct _esxVI_PropertyFilterSpec {
- esxVI_PropertyFilterSpec *_next; /* optional */
-
- esxVI_PropertySpec *propSet; /* required, list */
- esxVI_ObjectSpec *objectSet; /* required, list */
-};
-
-int esxVI_PropertyFilterSpec_Alloc
- (esxVI_PropertyFilterSpec **propertyFilterSpec);
-void esxVI_PropertyFilterSpec_Free
- (esxVI_PropertyFilterSpec **propertyFilterSpecList);
-int esxVI_PropertyFilterSpec_Validate
- (esxVI_PropertyFilterSpec *propertyFilterSpec);
-int esxVI_PropertyFilterSpec_AppendToList
- (esxVI_PropertyFilterSpec **propertyFilterSpecList,
- esxVI_PropertyFilterSpec *propertyFilterSpec);
-int esxVI_PropertyFilterSpec_Serialize
- (esxVI_PropertyFilterSpec *propertyFilterSpec, const char *element,
- virBufferPtr output);
-int esxVI_PropertyFilterSpec_SerializeList
- (esxVI_PropertyFilterSpec *propertyFilterSpecList, const char *element,
- virBufferPtr output);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ObjectContent
- */
-
-struct _esxVI_ObjectContent {
- esxVI_ObjectContent *_next; /* optional */
-
- esxVI_ManagedObjectReference *obj; /* required */
- esxVI_DynamicProperty *propSet; /* optional, list */
- /*esxVI_MissingProperty *missingSet; *//* optional, list *//* FIXME */
-};
-
-int esxVI_ObjectContent_Alloc(esxVI_ObjectContent **objectContent);
-void esxVI_ObjectContent_Free(esxVI_ObjectContent **objectContentList);
-int esxVI_ObjectContent_Validate(esxVI_ObjectContent *objectContent);
-int esxVI_ObjectContent_AppendToList(esxVI_ObjectContent **objectContentList,
- esxVI_ObjectContent *objectContent);
-int esxVI_ObjectContent_DeepCopy(esxVI_ObjectContent **dest,
- esxVI_ObjectContent *src);
-int esxVI_ObjectContent_Deserialize(xmlNodePtr node,
- esxVI_ObjectContent **objectContent);
-int esxVI_ObjectContent_DeserializeList
- (xmlNodePtr node, esxVI_ObjectContent **objectContentList);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ObjectUpdate
- */
-
-struct _esxVI_ObjectUpdate {
- esxVI_ObjectUpdate *_next; /* optional */
-
- esxVI_ObjectUpdateKind kind; /* required */
- esxVI_ManagedObjectReference *obj; /* required */
- esxVI_PropertyChange *changeSet; /* optional, list */
- /*esxVI_MissingProperty *missingSet; *//* optional, list *//* FIXME */
-};
-
-int esxVI_ObjectUpdate_Alloc(esxVI_ObjectUpdate **objectUpdate);
-void esxVI_ObjectUpdate_Free(esxVI_ObjectUpdate **objectUpdateList);
-int esxVI_ObjectUpdate_Validate(esxVI_ObjectUpdate *objectUpdate);
-int esxVI_ObjectUpdate_AppendToList(esxVI_ObjectUpdate **objectUpdateList,
- esxVI_ObjectUpdate *objectUpdate);
-int esxVI_ObjectUpdate_Deserialize(xmlNodePtr node,
- esxVI_ObjectUpdate **objectUpdate);
-int esxVI_ObjectUpdate_DeserializeList(xmlNodePtr node,
- esxVI_ObjectUpdate **objectUpdateList);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PropertyFilterUpdate
- */
-
-struct _esxVI_PropertyFilterUpdate {
- esxVI_PropertyFilterUpdate *_next; /* optional */
-
- esxVI_ManagedObjectReference *filter; /* required */
- esxVI_ObjectUpdate *objectSet; /* optional, list */
- /*esxVI_MissingProperty *missingSet; *//* optional, list *//* FIXME */
-};
-
-int esxVI_PropertyFilterUpdate_Alloc
- (esxVI_PropertyFilterUpdate **propertyFilterUpdate);
-void esxVI_PropertyFilterUpdate_Free
- (esxVI_PropertyFilterUpdate **propertyFilterUpdateList);
-int esxVI_PropertyFilterUpdate_Validate
- (esxVI_PropertyFilterUpdate *propertyFilterUpdate);
-int esxVI_PropertyFilterUpdate_AppendToList
- (esxVI_PropertyFilterUpdate **propertyFilterUpdateList,
- esxVI_PropertyFilterUpdate *propertyFilterUpdate);
-int esxVI_PropertyFilterUpdate_Deserialize
- (xmlNodePtr node, esxVI_PropertyFilterUpdate **propertyFilterUpdate);
-int esxVI_PropertyFilterUpdate_DeserializeList
- (xmlNodePtr node, esxVI_PropertyFilterUpdate **propertyFilterUpdateList);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: AboutInfo
- */
-
-struct _esxVI_AboutInfo {
- char *name; /* required */
- char *fullName; /* required */
- char *vendor; /* required */
- char *version; /* required */
- char *build; /* required */
- char *localeVersion; /* optional */
- char *localeBuild; /* optional */
- char *osType; /* required */
- char *productLineId; /* required */
- char *apiType; /* required */
- char *apiVersion; /* required */
-};
-
-int esxVI_AboutInfo_Alloc(esxVI_AboutInfo **aboutInfo);
-void esxVI_AboutInfo_Free(esxVI_AboutInfo **aboutInfo);
-int esxVI_AboutInfo_Validate(esxVI_AboutInfo *aboutInfo);
-int esxVI_AboutInfo_Deserialize(xmlNodePtr node, esxVI_AboutInfo **aboutInfo);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ServiceContent
- */
-
-struct _esxVI_ServiceContent {
- esxVI_ManagedObjectReference *rootFolder; /* required */
- esxVI_ManagedObjectReference *propertyCollector; /* required */
- esxVI_ManagedObjectReference *viewManager; /* optional */
- esxVI_AboutInfo *about; /* required */
- esxVI_ManagedObjectReference *setting; /* optional */
- esxVI_ManagedObjectReference *userDirectory; /* optional */
- esxVI_ManagedObjectReference *sessionManager; /* optional */
- esxVI_ManagedObjectReference *authorizationManager; /* optional */
- esxVI_ManagedObjectReference *perfManager; /* optional */
- esxVI_ManagedObjectReference *scheduledTaskManager; /* optional */
- esxVI_ManagedObjectReference *alarmManager; /* optional */
- esxVI_ManagedObjectReference *eventManager; /* optional */
- esxVI_ManagedObjectReference *taskManager; /* optional */
- esxVI_ManagedObjectReference *extensionManager; /* optional */
- esxVI_ManagedObjectReference *customizationSpecManager; /* optional */
- esxVI_ManagedObjectReference *customFieldsManager; /* optional */
- esxVI_ManagedObjectReference *accountManager; /* optional */
- esxVI_ManagedObjectReference *diagnosticManager; /* optional */
- esxVI_ManagedObjectReference *licenseManager; /* optional */
- esxVI_ManagedObjectReference *searchIndex; /* optional */
- esxVI_ManagedObjectReference *fileManager; /* optional */
- esxVI_ManagedObjectReference *virtualDiskManager; /* optional */
- esxVI_ManagedObjectReference *virtualizationManager; /* optional */
-};
-
-int esxVI_ServiceContent_Alloc(esxVI_ServiceContent **serviceContent);
-void esxVI_ServiceContent_Free(esxVI_ServiceContent **serviceContent);
-int esxVI_ServiceContent_Validate(esxVI_ServiceContent *serviceContent);
-int esxVI_ServiceContent_Deserialize(xmlNodePtr node,
- esxVI_ServiceContent **serviceContent);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: UpdateSet
- */
-
-struct _esxVI_UpdateSet {
- char *version; /* required */
- esxVI_PropertyFilterUpdate *filterSet; /* optional, list */
-};
-
-int esxVI_UpdateSet_Alloc(esxVI_UpdateSet **updateSet);
-void esxVI_UpdateSet_Free(esxVI_UpdateSet **updateSet);
-int esxVI_UpdateSet_Validate(esxVI_UpdateSet *updateSet);
-int esxVI_UpdateSet_Deserialize(xmlNodePtr node, esxVI_UpdateSet **updateSet);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: SharesInfo
- */
-
-struct _esxVI_SharesInfo {
- esxVI_Int *shares; /* required */
- esxVI_SharesLevel level; /* required */
-};
-
-int esxVI_SharesInfo_Alloc(esxVI_SharesInfo **sharesInfo);
-void esxVI_SharesInfo_Free(esxVI_SharesInfo **sharesInfo);
-int esxVI_SharesInfo_Validate(esxVI_SharesInfo *sharesInfo);
-int esxVI_SharesInfo_CastFromAnyType(esxVI_AnyType *anyType,
- esxVI_SharesInfo **sharesInfo);
-int esxVI_SharesInfo_Deserialize(xmlNodePtr node,
- esxVI_SharesInfo **sharesInfo);
-int esxVI_SharesInfo_Serialize(esxVI_SharesInfo *sharesInfo,
- const char *element, virBufferPtr output);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ResourceAllocationInfo
- */
-
-struct _esxVI_ResourceAllocationInfo {
- esxVI_Long *reservation; /* optional */
- esxVI_Boolean expandableReservation; /* optional */
- esxVI_Long *limit; /* optional */
- esxVI_SharesInfo *shares; /* optional */
- esxVI_Long *overheadLimit; /* optional */
-};
-
-int esxVI_ResourceAllocationInfo_Alloc
- (esxVI_ResourceAllocationInfo **resourceAllocationInfo);
-void esxVI_ResourceAllocationInfo_Free
- (esxVI_ResourceAllocationInfo **resourceAllocationInfo);
-int esxVI_ResourceAllocationInfo_Validate
- (esxVI_ResourceAllocationInfo *resourceAllocationInfo);
-int esxVI_ResourceAllocationInfo_Serialize
- (esxVI_ResourceAllocationInfo *resourceAllocationInfo,
- const char *element, virBufferPtr output);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ResourcePoolResourceUsage
- */
-
-struct _esxVI_ResourcePoolResourceUsage {
- esxVI_Long *reservationUsed; /* required */
- esxVI_Long *reservationUsedForVm; /* required */
- esxVI_Long *unreservedForPool; /* required */
- esxVI_Long *unreservedForVm; /* required */
- esxVI_Long *overallUsage; /* required */
- esxVI_Long *maxUsage; /* required */
-};
-
-int esxVI_ResourcePoolResourceUsage_Alloc
- (esxVI_ResourcePoolResourceUsage **resourcePoolResourceUsage);
-void esxVI_ResourcePoolResourceUsage_Free
- (esxVI_ResourcePoolResourceUsage **resourcePoolResourceUsage);
-int esxVI_ResourcePoolResourceUsage_Validate
- (esxVI_ResourcePoolResourceUsage *resourcePoolResourceUsage);
-int esxVI_ResourcePoolResourceUsage_CastFromAnyType
- (esxVI_AnyType *anyType,
- esxVI_ResourcePoolResourceUsage **resourcePoolResourceUsage);
-int esxVI_ResourcePoolResourceUsage_Deserialize
- (xmlNodePtr node,
- esxVI_ResourcePoolResourceUsage **resourcePoolResourceUsage);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: VirtualMachineConfigSpec
- */
-
-/* FIXME: implement the rest */
-struct _esxVI_VirtualMachineConfigSpec {
- char *changeVersion; /* optional */
- char *name; /* optional */
- char *version; /* optional */
- char *uuid; /* optional */
- esxVI_Long *npivNodeWorldWideName; /* optional, list */
- esxVI_Long *npivPortWorldWideName; /* optional, list */
- char *npivWorldWideNameType; /* optional */
- char *npivWorldWideNameOp; /* optional */
- char *locationId; /* optional */
- char *guestId; /* optional */
- char *alternateGuestName; /* optional */
- char *annotation; /* optional */
- //esxVI_VirtualMachineFileInfo *files; /* optional */
- //esxVI_ToolsConfigInfo *tools; /* optional */
- //esxVI_VirtualMachineFlagInfo *flags; /* optional */
- //esxVI_VirtualMachineConsolePreferences *consolePreferences; /* optional */
- //esxVI_VirtualMachineDefaultPowerOpInfo *powerOpInfo; /* optional */
- esxVI_Int *numCPUs; /* optional */
- esxVI_Long *memoryMB; /* optional */
- //esxVI_VirtualDeviceConfigSpec *deviceChange; /* optional, list */
- esxVI_ResourceAllocationInfo *cpuAllocation; /* optional */
- esxVI_ResourceAllocationInfo *memoryAllocation; /* optional */
- //esxVI_VirtualMachineAffinityInfo *cpuAffinity; /* optional */
- //esxVI_VirtualMachineAffinityInfo *memoryAffinity; /* optional */
- //esxVI_VirtualMachineNetworkShaperInfo *networkShaper; /* optional */
- //esxVI_VirtualMachineCpuIdInfoSpec *cpuFeatureMask; /* optional, list */
- //esxVI_OptionValue *extraConfig; /* optional, list */
- char *swapPlacement; /* optional */
- //esxVI_VirtualMachineBootOptions *bootOptions; /* optional */
-};
-
-int esxVI_VirtualMachineConfigSpec_Alloc
- (esxVI_VirtualMachineConfigSpec **virtualMachineConfigSpec);
-void esxVI_VirtualMachineConfigSpec_Free
- (esxVI_VirtualMachineConfigSpec **virtualMachineConfigSpec);
-int esxVI_VirtualMachineConfigSpec_Validate
- (esxVI_VirtualMachineConfigSpec *virtualMachineConfigSpec);
-int esxVI_VirtualMachineConfigSpec_Serialize
- (esxVI_VirtualMachineConfigSpec *virtualMachineConfigSpec,
- const char *element, virBufferPtr output);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: Event
- */
-
-/* FIXME: implement the rest */
-struct _esxVI_Event {
- esxVI_Event *_next; /* optional */
-
- esxVI_Int *key; /* required */
- esxVI_Int *chainId; /* required */
- esxVI_DateTime *createdTime; /* required */
- char *userName; /* required */
- //??? datacenter; /* optional */
- //??? computeResource; /* optional */
- //??? host; /* optional */
- //??? vm; /* optional */
- char *fullFormattedMessage; /* optional */
-};
-
-int esxVI_Event_Alloc(esxVI_Event **event);
-void esxVI_Event_Free(esxVI_Event **eventList);
-int esxVI_Event_Validate(esxVI_Event *event);
-int esxVI_Event_Deserialize(xmlNodePtr node, esxVI_Event **event);
-int esxVI_Event_DeserializeList(xmlNodePtr node, esxVI_Event **eventList);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: UserSession
- */
-
-struct _esxVI_UserSession {
- char *key; /* required */
- char *userName; /* required */
- char *fullName; /* required */
- esxVI_DateTime *loginTime; /* required */
- esxVI_DateTime *lastActiveTime; /* required */
- char *locale; /* required */
- char *messageLocale; /* required */
-};
-
-int esxVI_UserSession_Alloc(esxVI_UserSession **userSession);
-void esxVI_UserSession_Free(esxVI_UserSession **userSession);
-int esxVI_UserSession_Validate(esxVI_UserSession *userSession);
-int esxVI_UserSession_CastFromAnyType(esxVI_AnyType *anyType,
- esxVI_UserSession **userSession);
-int esxVI_UserSession_Deserialize(xmlNodePtr node,
- esxVI_UserSession **userSession);
-
+ (xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference);
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: VirtualMachineQuestionInfo
- */
-
-/* FIXME: implement the rest */
-struct _esxVI_VirtualMachineQuestionInfo {
- char *id; /* required */
- char *text; /* required */
- esxVI_ChoiceOption *choice; /* required */
- /*esxVI_VirtualMachineMessage *message;*/ /* optional, list */
-};
-
-int esxVI_VirtualMachineQuestionInfo_Alloc
- (esxVI_VirtualMachineQuestionInfo **virtualMachineQuestionInfo);
-void esxVI_VirtualMachineQuestionInfo_Free
- (esxVI_VirtualMachineQuestionInfo **virtualMachineQuestionInfo);
-int esxVI_VirtualMachineQuestionInfo_Validate
- (esxVI_VirtualMachineQuestionInfo *virtualMachineQuestionInfo);
-int esxVI_VirtualMachineQuestionInfo_CastFromAnyType
- (esxVI_AnyType *anyType,
- esxVI_VirtualMachineQuestionInfo **virtualMachineQuestionInfo);
-int esxVI_VirtualMachineQuestionInfo_Deserialize
- (xmlNodePtr node,
- esxVI_VirtualMachineQuestionInfo **virtualMachineQuestionInfo);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ElementDescription extends Description
- *
- * In contrast to SelectionSpec and TraversalSpec just merge
- * Description into ElementDescription for simplicity, because
- * only ElementDescription is used.
- */
-
-struct _esxVI_ElementDescription {
- esxVI_ElementDescription *_next; /* optional */
-
- /* Description */
- char *label; /* required */
- char *summary; /* required */
-
- /* ElementDescription */
- char *key; /* required */
-};
-
-int esxVI_ElementDescription_Alloc
- (esxVI_ElementDescription **elementDescription);
-void esxVI_ElementDescription_Free
- (esxVI_ElementDescription **elementDescription);
-int esxVI_ElementDescription_Validate
- (esxVI_ElementDescription *elementDescription);
-int esxVI_ElementDescription_AppendToList
- (esxVI_ElementDescription **elementDescriptionList,
- esxVI_ElementDescription *elementDescription);
-int esxVI_ElementDescription_Deserialize
- (xmlNodePtr node, esxVI_ElementDescription **elementDescription);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: ChoiceOption extends OptionType
- *
- * In contrast to SelectionSpec and TraversalSpec just merge
- * OptionType into ChoiceOption for simplicity, because
- * only ChoiceOption is used.
- */
-
-struct _esxVI_ChoiceOption {
- /* OptionType */
- esxVI_Boolean valueIsReadonly; /* optional */
-
- /* ChoiceOption */
- esxVI_ElementDescription *choiceInfo; /* required, list */
- esxVI_Int *defaultIndex; /* optional */
-};
-
-int esxVI_ChoiceOption_Alloc(esxVI_ChoiceOption **choiceOption);
-void esxVI_ChoiceOption_Free(esxVI_ChoiceOption **choiceOption);
-int esxVI_ChoiceOption_Validate(esxVI_ChoiceOption *choiceOption);
-int esxVI_ChoiceOption_Deserialize(xmlNodePtr node,
- esxVI_ChoiceOption **choiceOption);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PerfMetricId
- */
-
-struct _esxVI_PerfMetricId {
- esxVI_PerfMetricId *_next; /* optional */
-
- esxVI_Int *counterId; /* required */
- char *instance; /* required */
-};
-
-int esxVI_PerfMetricId_Alloc(esxVI_PerfMetricId **perfMetricId);
-void esxVI_PerfMetricId_Free(esxVI_PerfMetricId **perfMetricId);
-int esxVI_PerfMetricId_Validate(esxVI_PerfMetricId *perfMetricId);
-int esxVI_PerfMetricId_Serialize(esxVI_PerfMetricId *perfMetricId,
- const char *element, virBufferPtr output);
-int esxVI_PerfMetricId_SerializeList(esxVI_PerfMetricId *perfMetricIdList,
- const char *element, virBufferPtr output);
-int esxVI_PerfMetricId_Deserialize(xmlNodePtr node,
- esxVI_PerfMetricId **perfMetricId);
-int esxVI_PerfMetricId_DeserializeList(xmlNodePtr node,
- esxVI_PerfMetricId **perfMetricIdList);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PerfCounterInfo
- */
-
-struct _esxVI_PerfCounterInfo {
- esxVI_PerfCounterInfo *_next; /* optional */
-
- esxVI_Int *key; /* required */
- esxVI_ElementDescription *nameInfo; /* required */
- esxVI_ElementDescription *groupInfo; /* required */
- esxVI_ElementDescription *unitInfo; /* required */
- esxVI_PerfSummaryType rollupType; /* required */
- esxVI_PerfStatsType statsType; /* required */
- esxVI_Int *level; /* optional */
- esxVI_Int *associatedCounterId; /* optional, list */
-};
-
-int esxVI_PerfCounterInfo_Alloc(esxVI_PerfCounterInfo **perfCounterInfo);
-void esxVI_PerfCounterInfo_Free(esxVI_PerfCounterInfo **perfCounterInfo);
-int esxVI_PerfCounterInfo_Validate(esxVI_PerfCounterInfo *perfCounterInfo);
-int esxVI_PerfCounterInfo_Deserialize(xmlNodePtr node,
- esxVI_PerfCounterInfo **perfCounterInfo);
-int esxVI_PerfCounterInfo_DeserializeList
- (xmlNodePtr node, esxVI_PerfCounterInfo **perfCounterInfoList);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PerfQuerySpec
- */
-
-struct _esxVI_PerfQuerySpec {
- esxVI_PerfQuerySpec *_next; /* optional */
-
- esxVI_ManagedObjectReference *entity; /* required */
- esxVI_DateTime *startTime; /* optional */
- esxVI_DateTime *endTime; /* optional */
- esxVI_Int *maxSample; /* optional */
- esxVI_PerfMetricId *metricId; /* optional, list */
- esxVI_Int *intervalId; /* optional */
- char *format; /* optional */ // FIXME: see PerfFormat
-};
-
-int esxVI_PerfQuerySpec_Alloc(esxVI_PerfQuerySpec **perfQuerySpec);
-void esxVI_PerfQuerySpec_Free(esxVI_PerfQuerySpec **perfQuerySpec);
-int esxVI_PerfQuerySpec_Validate(esxVI_PerfQuerySpec *perfQuerySpec);
-int esxVI_PerfQuerySpec_Serialize(esxVI_PerfQuerySpec *perfQuerySpec,
- const char *element, virBufferPtr output);
-int esxVI_PerfQuerySpec_SerializeList(esxVI_PerfQuerySpec *perfQuerySpecList,
- const char *element, virBufferPtr output);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PerfSampleInfo
- */
-
-struct _esxVI_PerfSampleInfo {
- esxVI_PerfSampleInfo *_next; /* optional */
-
- esxVI_DateTime *timestamp; /* required */
- esxVI_Int *interval; /* required */
-};
-
-int esxVI_PerfSampleInfo_Alloc(esxVI_PerfSampleInfo **perfSampleInfo);
-void esxVI_PerfSampleInfo_Free(esxVI_PerfSampleInfo **perfSampleInfo);
-int esxVI_PerfSampleInfo_Validate(esxVI_PerfSampleInfo *perfSampleInfo);
-int esxVI_PerfSampleInfo_AppendToList(esxVI_PerfSampleInfo **perfSampleInfoList,
- esxVI_PerfSampleInfo *perfSampleInfo);
-int esxVI_PerfSampleInfo_Deserialize(xmlNodePtr node,
- esxVI_PerfSampleInfo **perfSampleInfo);
-int esxVI_PerfSampleInfo_DeserializeList
- (xmlNodePtr node, esxVI_PerfSampleInfo **perfSampleInfoList);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PerfMetricIntSeries extends PerfMetricSeries
- *
- * In contrast to SelectionSpec and TraversalSpec just merge
- * PerfMetricSeries into PerfMetricIntSeries for simplicity, because
- * only PerfMetricIntSeries is used and the other type inheriting
- * PerfMetricSeries (PerfMetricSeriesCSV) is not used.
- */
-
-struct _esxVI_PerfMetricIntSeries {
- esxVI_PerfMetricIntSeries *_next; /* optional */
-
- /* PerfMetricSeries */
- esxVI_PerfMetricId *id; /* required */
-
- /* PerfMetricIntSeries */
- esxVI_Long *value; /* optional, list */
-};
-
-int esxVI_PerfMetricIntSeries_Alloc
- (esxVI_PerfMetricIntSeries **perfMetricIntSeries);
-void esxVI_PerfMetricIntSeries_Free
- (esxVI_PerfMetricIntSeries **perfMetricIntSeries);
-int esxVI_PerfMetricIntSeries_Validate
- (esxVI_PerfMetricIntSeries *perfMetricIntSeries);
-int esxVI_PerfMetricIntSeries_AppendToList
- (esxVI_PerfMetricIntSeries **perfMetricIntSeriesList,
- esxVI_PerfMetricIntSeries *perfMetricIntSeries);
-int esxVI_PerfMetricIntSeries_Deserialize
- (xmlNodePtr node, esxVI_PerfMetricIntSeries **perfMetricIntSeries);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: PerfEntityMetric extends PerfEntityMetricBase
- *
- * In contrast to SelectionSpec and TraversalSpec just merge
- * PerfEntityMetricBase into PerfEntityMetric for simplicity, because
- * only PerfEntityMetric is used and the other type inheriting
- * PerfEntityMetric (PerfEntityMetricCSV) is not used.
- *
- * Also use PerfMetricIntSeries instead of the correct base type
- * PerfMetricSeries for the value property, because only
- * PerfMetricIntSeries is used.
- */
-
-struct _esxVI_PerfEntityMetric {
- esxVI_PerfEntityMetric *_next; /* optional */
-
- /* PerfEntityMetricBase */
- esxVI_ManagedObjectReference *entity; /* required */
-
- /* PerfEntityMetric */
- esxVI_PerfSampleInfo *sampleInfo; /* optional, list */
- esxVI_PerfMetricIntSeries *value; /* optional, list */
-};
-
-int esxVI_PerfEntityMetric_Alloc(esxVI_PerfEntityMetric **perfEntityMetric);
-void esxVI_PerfEntityMetric_Free(esxVI_PerfEntityMetric **perfEntityMetric);
-int esxVI_PerfEntityMetric_Validate(esxVI_PerfEntityMetric *perfEntityMetric);
-int esxVI_PerfEntityMetric_Deserialize
- (xmlNodePtr node, esxVI_PerfEntityMetric **perfEntityMetric);
-int esxVI_PerfEntityMetric_DeserializeList
- (xmlNodePtr node, esxVI_PerfEntityMetric **perfEntityMetricList);
-
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * VI Type: TaskInfo
- */
-
-struct _esxVI_TaskInfo {
- esxVI_TaskInfo *_next; /* optional */
-
- char *key; /* required */
- esxVI_ManagedObjectReference *task; /* required */
- char *name; /* optional */
- char *descriptionId; /* required */
- esxVI_ManagedObjectReference *entity; /* optional */
- char *entityName; /* optional */
- /*esxVI_ManagedObjectReference *locked;*/ /* optional, list *//* FIXME */
- esxVI_TaskInfoState state; /* required */
- esxVI_Boolean cancelled; /* required */
- esxVI_Boolean cancelable; /* required */
- /*esxVI_MethodFault *error;*/ /* optional *//* FIXME */
- esxVI_AnyType *result; /* optional */
- esxVI_Int *progress; /* optional */
- /*esxVI_TaskReason *reason;*/ /* required *//* FIXME */
- esxVI_DateTime *queueTime; /* required */
- esxVI_DateTime *startTime; /* optional */
- esxVI_DateTime *completeTime; /* optional */
- esxVI_Int *eventChainId; /* required */
-};
-int esxVI_TaskInfo_Alloc(esxVI_TaskInfo **taskInfo);
-void esxVI_TaskInfo_Free(esxVI_TaskInfo **taskInfoList);
-int esxVI_TaskInfo_Validate(esxVI_TaskInfo *taskInfo);
-int esxVI_TaskInfo_CastFromAnyType(esxVI_AnyType *anyType,
- esxVI_TaskInfo **taskInfo);
-int esxVI_TaskInfo_AppendToList(esxVI_TaskInfo **taskInfoList,
- esxVI_TaskInfo *taskInfo);
-int esxVI_TaskInfo_Deserialize(xmlNodePtr node, esxVI_TaskInfo **taskInfo);
+#include "esx_vi_types.generated.h"
#endif /* __ESX_VI_TYPES_H__ */
--
1.6.3.3
2
2
31 Mar '10
2010/3/31 Daniel Veillard <veillard(a)redhat.com>:
> On Wed, Mar 31, 2010 at 01:38:48PM +0200, Matthias Bolte wrote:
>> ---
>> src/.gitignore | 1 +
>> tests/.gitignore | 1 +
>> 2 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/.gitignore b/src/.gitignore
>> index 26b8689..e407dcb 100644
>> --- a/src/.gitignore
>> +++ b/src/.gitignore
>> @@ -15,3 +15,4 @@ libvirt_lxc
>> libvirt.syms
>> *.i
>> *.s
>> +virt-aa-helper
>> diff --git a/tests/.gitignore b/tests/.gitignore
>> index 399baee..387a924 100644
>> --- a/tests/.gitignore
>> +++ b/tests/.gitignore
>> @@ -33,3 +33,4 @@ object-locking-files.txt
>> esxutilstest
>> vmx2xmltest
>> xml2vmxtest
>> +secaatest
>
> ACK,
>
> Daniel
>
Thanks, pushed.
Matthias
1
0
---
src/esx/esx_vi_types.c | 66 ++++++++++++++++++++++++------------------------
1 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index 6f257b2..3a30712 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -682,10 +682,10 @@ static const esxVI_Enumeration _esxVI_Boolean_Enumeration = {
};
/* esxVI_Boolean_Serialize */
-ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(Boolean);
+ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(Boolean)
/* esxVI_Boolean_Deserialize */
-ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(Boolean);
+ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(Boolean)
@@ -694,7 +694,7 @@ ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(Boolean);
*/
/* esxVI_AnyType_Alloc */
-ESX_VI__TEMPLATE__ALLOC(AnyType);
+ESX_VI__TEMPLATE__ALLOC(AnyType)
/* esxVI_AnyType_Free */
ESX_VI__TEMPLATE__FREE(AnyType,
@@ -702,7 +702,7 @@ ESX_VI__TEMPLATE__FREE(AnyType,
xmlFreeNode(item->node);
VIR_FREE(item->other);
VIR_FREE(item->value);
-});
+})
int
esxVI_AnyType_ExpectType(esxVI_AnyType *anyType, esxVI_Type type)
@@ -908,7 +908,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
*/
/* esxVI_String_Alloc */
-ESX_VI__TEMPLATE__ALLOC(String);
+ESX_VI__TEMPLATE__ALLOC(String)
/* esxVI_String_Free */
ESX_VI__TEMPLATE__FREE(String,
@@ -916,7 +916,7 @@ ESX_VI__TEMPLATE__FREE(String,
esxVI_String_Free(&item->_next);
VIR_FREE(item->value);
-});
+})
/* esxVI_String_Validate */
ESX_VI__TEMPLATE__VALIDATE(String,
@@ -925,7 +925,7 @@ ESX_VI__TEMPLATE__VALIDATE(String,
})
/* esxVI_String_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(String);
+ESX_VI__TEMPLATE__LIST__APPEND(String)
int
esxVI_String_AppendValueToList(esxVI_String **stringList, const char *value)
@@ -989,7 +989,7 @@ ESX_VI__TEMPLATE__DEEP_COPY(String,
})
/* esxVI_String_DeepCopyList */
-ESX_VI__TEMPLATE__LIST__DEEP_COPY(String);
+ESX_VI__TEMPLATE__LIST__DEEP_COPY(String)
int
esxVI_String_DeepCopyValue(char **dest, const char *src)
@@ -1022,7 +1022,7 @@ esxVI_String_Serialize(esxVI_String *string, const char *element,
}
/* esxVI_String_SerializeList */
-ESX_VI__TEMPLATE__LIST__SERIALIZE(String);
+ESX_VI__TEMPLATE__LIST__SERIALIZE(String)
int
esxVI_String_SerializeValue(const char *value, const char *element,
@@ -1053,7 +1053,7 @@ ESX_VI__TEMPLATE__DESERIALIZE(String,
})
/* esxVI_String_DeserializeList */
-ESX_VI__TEMPLATE__LIST__DESERIALIZE(String);
+ESX_VI__TEMPLATE__LIST__DESERIALIZE(String)
int
esxVI_String_DeserializeValue(xmlNodePtr node, char **value)
@@ -1084,13 +1084,13 @@ esxVI_String_DeserializeValue(xmlNodePtr node, char **value)
*/
/* esxVI_Int_Alloc */
-ESX_VI__TEMPLATE__ALLOC(Int);
+ESX_VI__TEMPLATE__ALLOC(Int)
/* esxVI_Int_Free */
ESX_VI__TEMPLATE__FREE(Int,
{
esxVI_Int_Free(&item->_next);
-});
+})
/* esxVI_Int_Validate */
ESX_VI__TEMPLATE__VALIDATE(Int,
@@ -1098,7 +1098,7 @@ ESX_VI__TEMPLATE__VALIDATE(Int,
})
/* esxVI_Int_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(Int);
+ESX_VI__TEMPLATE__LIST__APPEND(Int)
/* esxVI_Int_DeepCopy */
ESX_VI__TEMPLATE__DEEP_COPY(Int,
@@ -1110,13 +1110,13 @@ ESX_VI__TEMPLATE__DEEP_COPY(Int,
ESX_VI__TEMPLATE__SERIALIZE(Int,
{
virBufferVSprintf(output, "%d", (int)item->value);
-});
+})
/* esxVI_Int_SerializeList */
-ESX_VI__TEMPLATE__LIST__SERIALIZE(Int);
+ESX_VI__TEMPLATE__LIST__SERIALIZE(Int)
/* esxVI_Int_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(Int, "xsd:int", INT32_MIN, INT32_MAX);
+ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(Int, "xsd:int", INT32_MIN, INT32_MAX)
@@ -1125,13 +1125,13 @@ ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(Int, "xsd:int", INT32_MIN, INT32_MAX);
*/
/* esxVI_Long_Alloc */
-ESX_VI__TEMPLATE__ALLOC(Long);
+ESX_VI__TEMPLATE__ALLOC(Long)
/* esxVI_Long_Free */
ESX_VI__TEMPLATE__FREE(Long,
{
esxVI_Long_Free(&item->_next);
-});
+})
/* esxVI_Long_Validate */
ESX_VI__TEMPLATE__VALIDATE(Long,
@@ -1139,19 +1139,19 @@ ESX_VI__TEMPLATE__VALIDATE(Long,
})
/* esxVI_Long_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(Long);
+ESX_VI__TEMPLATE__LIST__APPEND(Long)
/* esxVI_Long_Serialize */
ESX_VI__TEMPLATE__SERIALIZE(Long,
{
virBufferVSprintf(output, "%lld", (long long int)item->value);
-});
+})
/* esxVI_Long_SerializeList */
-ESX_VI__TEMPLATE__LIST__SERIALIZE(Long);
+ESX_VI__TEMPLATE__LIST__SERIALIZE(Long)
/* esxVI_Long_Deserialize */
-ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(Long, "xsd:long", INT64_MIN, INT64_MAX);
+ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(Long, "xsd:long", INT64_MIN, INT64_MAX)
@@ -1160,25 +1160,25 @@ ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(Long, "xsd:long", INT64_MIN, INT64_MAX);
*/
/* esxVI_DateTime_Alloc */
-ESX_VI__TEMPLATE__ALLOC(DateTime);
+ESX_VI__TEMPLATE__ALLOC(DateTime)
/* esxVI_DateTime_Free */
ESX_VI__TEMPLATE__FREE(DateTime,
{
VIR_FREE(item->value);
-});
+})
/* esxVI_DateTime_Validate */
ESX_VI__TEMPLATE__VALIDATE(DateTime,
{
ESX_VI__TEMPLATE__PROPERTY__REQUIRE(value);
-});
+})
/* esxVI_DateTime_Serialize */
ESX_VI__TEMPLATE__SERIALIZE(DateTime,
{
virBufferAdd(output, item->value, -1);
-});
+})
int
esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
@@ -1224,14 +1224,14 @@ ESX_VI__TEMPLATE__FREE(Fault,
{
VIR_FREE(item->faultcode);
VIR_FREE(item->faultstring);
-});
+})
/* esxVI_Fault_Validate */
ESX_VI__TEMPLATE__VALIDATE(Fault,
{
ESX_VI__TEMPLATE__PROPERTY__REQUIRE(faultcode);
ESX_VI__TEMPLATE__PROPERTY__REQUIRE(faultstring);
-});
+})
/* esxVI_Fault_Deserialize */
ESX_VI__TEMPLATE__DESERIALIZE(Fault,
@@ -1239,7 +1239,7 @@ ESX_VI__TEMPLATE__DESERIALIZE(Fault,
ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, faultcode);
ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, faultstring);
ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_IGNORE(detail); /* FIXME */
-});
+})
@@ -1248,7 +1248,7 @@ ESX_VI__TEMPLATE__DESERIALIZE(Fault,
*/
/* esxVI_ManagedObjectReference_Alloc */
-ESX_VI__TEMPLATE__ALLOC(ManagedObjectReference);
+ESX_VI__TEMPLATE__ALLOC(ManagedObjectReference)
/* esxVI_ManagedObjectReference_Free */
ESX_VI__TEMPLATE__FREE(ManagedObjectReference,
@@ -1257,7 +1257,7 @@ ESX_VI__TEMPLATE__FREE(ManagedObjectReference,
VIR_FREE(item->type);
VIR_FREE(item->value);
-});
+})
/* esxVI_ManagedObjectReference_DeepCopy */
ESX_VI__TEMPLATE__DEEP_COPY(ManagedObjectReference,
@@ -1267,7 +1267,7 @@ ESX_VI__TEMPLATE__DEEP_COPY(ManagedObjectReference,
})
/* esxVI_ManagedObjectReference_AppendToList */
-ESX_VI__TEMPLATE__LIST__APPEND(ManagedObjectReference);
+ESX_VI__TEMPLATE__LIST__APPEND(ManagedObjectReference)
/* esxVI_ManagedObjectReference_CastFromAnyType */
ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(ManagedObjectReference)
@@ -1304,7 +1304,7 @@ esxVI_ManagedObjectReference_Serialize
}
/* esxVI_ManagedObjectReference_SerializeList */
-ESX_VI__TEMPLATE__LIST__SERIALIZE(ManagedObjectReference);
+ESX_VI__TEMPLATE__LIST__SERIALIZE(ManagedObjectReference)
int
esxVI_ManagedObjectReference_Deserialize
--
1.6.3.3
2
2
[libvirt] [PATCH] maint: mark xenapiSessionErrorHandler messages for translation
by Jim Meyering 31 Mar '10
by Jim Meyering 31 Mar '10
31 Mar '10
This makes sure that all xenapiSessionErrorHandler diagnostics
are marked for translation.
>From c79adc5fb5efb7aa2fbeee20d41d1c765e90b022 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Wed, 31 Mar 2010 12:24:25 +0200
Subject: [PATCH] maint: mark xenapiSessionErrorHandler messages for translation
* cfg.mk (msg_gen_function): Add xenapiSessionErrorHandler.
* po/POTFILES.in: Add src/xenapi/xenapi_driver.c
* src/xenapi/xenapi_driver.c: Mark strings for translation.
* src/xenapi/xenapi_utils.c (xenapiUtil_ParseQuery):
---
cfg.mk | 1 +
po/POTFILES.in | 1 +
src/xenapi/xenapi_driver.c | 138 +++++++++++++++++++++++++++-----------------
src/xenapi/xenapi_utils.c | 2 +-
4 files changed, 89 insertions(+), 53 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 9b8ee00..45da56a 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -215,6 +215,7 @@ msg_gen_function += virXenInotifyError
msg_gen_function += virXenStoreError
msg_gen_function += virXendError
msg_gen_function += vshCloseLogFile
+msg_gen_function += xenapiSessionErrorHandler
msg_gen_function += xenUnifiedError
msg_gen_function += xenXMError
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 645c344..417bfa1 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -85,6 +85,7 @@ src/xen/xen_hypervisor.c
src/xen/xen_inotify.c
src/xen/xm_internal.c
src/xen/xs_internal.c
+src/xenapi/xenapi_driver.c
src/xenapi/xenapi_utils.c
tools/console.c
tools/virsh.c
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 6e1183d..d48bb4d 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -95,13 +95,13 @@ xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUS
if (conn->uri->server == NULL) {
xenapiSessionErrorHandler(conn, VIR_ERR_AUTH_FAILED,
- "Server name not in URI");
+ _("Server name not in URI"));
goto error;
}
if (auth == NULL) {
xenapiSessionErrorHandler(conn, VIR_ERR_AUTH_FAILED,
- "Authentication Credentials not found");
+ _("Authentication Credentials not found"));
goto error;
}
@@ -117,7 +117,7 @@ xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUS
if (username == NULL) {
xenapiSessionErrorHandler(conn, VIR_ERR_AUTH_FAILED,
- "Username request failed");
+ _("Username request failed"));
goto error;
}
}
@@ -126,7 +126,7 @@ xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUS
if (password == NULL) {
xenapiSessionErrorHandler(conn, VIR_ERR_AUTH_FAILED,
- "Password request failed");
+ _("Password request failed"));
goto error;
}
@@ -145,7 +145,7 @@ xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUS
if (!(privP->caps = getCapsObject())) {
xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
- "Capabilities not found");
+ _("Capabilities not found"));
goto error;
}
@@ -166,7 +166,7 @@ xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUS
return VIR_DRV_OPEN_SUCCESS;
}
- xenapiSessionErrorHandler(conn, VIR_ERR_AUTH_FAILED, "");
+ xenapiSessionErrorHandler(conn, VIR_ERR_AUTH_FAILED, NULL);
error:
VIR_FREE(username);
@@ -279,7 +279,8 @@ xenapiGetVersion (virConnectPtr conn, unsigned long *hvVer)
}
if (version) {
if (sscanf(version, "%ld.%ld.%ld", &major, &minor, &release) != 3) {
- xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, "Couldn't get version info");
+ xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Couldn't get version info"));
xen_string_string_map_free(result);
VIR_FREE(version);
return -1;
@@ -356,7 +357,8 @@ xenapiNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info)
info->memory = (unsigned long)(memory / 1024);
xen_host_metrics_set_free(xen_met_set);
} else {
- xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, "Unable to get host metric Information");
+ xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Unable to get host metric Information"));
return -1;
}
if (xen_host_cpu_get_all(session, &host_cpu_set)) {
@@ -377,7 +379,8 @@ xenapiNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info)
VIR_FREE(modelname);
return 0;
}
- xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, "Unable to get Host CPU set");
+ xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Unable to get Host CPU set"));
return -1;
}
@@ -397,7 +400,8 @@ xenapiGetCapabilities (virConnectPtr conn)
return xml;
}
cleanup:
- xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, "Capabilities not available");
+ xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Capabilities not available"));
return NULL;
}
@@ -426,7 +430,8 @@ xenapiListDomains (virConnectPtr conn, int *ids, int maxids)
for (i = 0; (i < (result->size)) && (i < maxids); i++) {
xen_vm_get_domid(session, &t0, result->contents[i]);
if (t0 > (int64_t)INT_MAX || t0 < (int64_t)INT_MIN) {
- xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, "DomainID can't fit in 32 bits");
+ xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
+ _("DomainID can't fit in 32 bits"));
xen_vm_set_free(result);
return -1;
}
@@ -497,7 +502,8 @@ xenapiDomainCreateXML (virConnectPtr conn,
domP = virGetDomain(conn, record->name_label, raw_uuid);
if (!domP) {
xen_vm_record_free(record);
- xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, "Domain Pointer is invalid");
+ xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain Pointer is invalid"));
return domP;
}
domP->id = record->domid;
@@ -549,7 +555,8 @@ xenapiDomainLookupByID (virConnectPtr conn, int id)
xen_vm_get_domid(session, &domid, result->contents[i]);
domP->id = domid;
} else {
- xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, "Domain Pointer not valid");
+ xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain Pointer not valid"));
domP = NULL;
}
xen_uuid_free(uuid);
@@ -590,7 +597,8 @@ xenapiDomainLookupByUUID (virConnectPtr conn,
if (record != NULL) {
domP = virGetDomain(conn, record->name_label, uuid);
if (!domP) {
- xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, "Domain Pointer not valid");
+ xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain Pointer not valid"));
domP = NULL;
} else {
domP->id = record->domid;
@@ -624,7 +632,8 @@ xenapiDomainLookupByName (virConnectPtr conn,
xen_session *session = ((struct _xenapiPrivate *)(conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, (char *)name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return NULL;
}
@@ -644,13 +653,14 @@ xenapiDomainLookupByName (virConnectPtr conn,
xen_uuid_free(uuid);
xen_vm_set_free(vms);
if (!session->ok)
- xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, "Couldn't get the Domain Pointer");
+ xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Couldn't get the Domain Pointer"));
return NULL;
}
}
}
if (vms) xen_vm_set_free(vms);
- xenapiSessionErrorHandler(conn, VIR_ERR_NO_DOMAIN, "");
+ xenapiSessionErrorHandler(conn, VIR_ERR_NO_DOMAIN, NULL);
return NULL;
}
@@ -669,7 +679,8 @@ xenapiDomainSuspend (virDomainPtr dom)
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
} else {
@@ -684,7 +695,7 @@ xenapiDomainSuspend (virDomainPtr dom)
}
}
if (vms) xen_vm_set_free(vms);
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, "");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
return -1;
}
@@ -703,7 +714,8 @@ xenapiDomainResume (virDomainPtr dom)
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
} else {
@@ -718,7 +730,7 @@ xenapiDomainResume (virDomainPtr dom)
}
}
if (vms) xen_vm_set_free(vms);
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, "");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
return -1;
}
@@ -737,7 +749,8 @@ xenapiDomainShutdown (virDomainPtr dom)
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
} else {
@@ -752,7 +765,7 @@ xenapiDomainShutdown (virDomainPtr dom)
}
}
if (vms) xen_vm_set_free(vms);
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, "");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
return -1;
}
@@ -771,7 +784,8 @@ xenapiDomainReboot (virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
}
@@ -785,7 +799,7 @@ xenapiDomainReboot (virDomainPtr dom, unsigned int flags ATTRIBUTE_UNUSED)
return 0;
}
if (vms) xen_vm_set_free(vms);
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, "");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
return -1;
}
@@ -804,7 +818,8 @@ xenapiDomainDestroy (virDomainPtr dom)
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
}
@@ -818,7 +833,7 @@ xenapiDomainDestroy (virDomainPtr dom)
return 0;
}
if (vms) xen_vm_set_free(vms);
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, "");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
return -1;
}
@@ -839,7 +854,8 @@ xenapiDomainGetOSType (virDomainPtr dom)
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return NULL;
}
@@ -852,7 +868,7 @@ xenapiDomainGetOSType (virDomainPtr dom)
virReportOOMError();
VIR_FREE(boot_policy);
} else
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, "");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
cleanup:
if (vms) xen_vm_set_free(vms);
@@ -873,7 +889,8 @@ xenapiDomainGetMaxMemory (virDomainPtr dom)
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return 0;
}
@@ -903,7 +920,8 @@ xenapiDomainSetMaxMemory (virDomainPtr dom, unsigned long memory)
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
}
@@ -939,7 +957,8 @@ xenapiDomainGetInfo (virDomainPtr dom, virDomainInfoPtr info)
info->cpuTime = 0; /* CPU time is not advertised */
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
}
@@ -982,7 +1001,8 @@ xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
}
@@ -1013,7 +1033,8 @@ xenapiDomainPinVcpu (virDomainPtr dom, unsigned int vcpu ATTRIBUTE_UNUSED,
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
}
@@ -1063,13 +1084,15 @@ xenapiDomainGetVcpus (virDomainPtr dom,
if (xenapiDomainGetInfo(dom, &domInfo) == 0) {
nvcpus = domInfo.nrVirtCpu;
} else {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Couldn't fetch Domain Information");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Couldn't fetch Domain Information"));
return -1;
}
if (xenapiNodeGetInfo(dom->conn, &nodeInfo) == 0)
cpus = nodeInfo.cpus;
else {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Couldn't fetch Node Information");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Couldn't fetch Node Information"));
return -1;
}
if (nvcpus > maxinfo)
@@ -1079,7 +1102,8 @@ xenapiDomainGetVcpus (virDomainPtr dom,
if (!xen_vm_get_by_name_label(session, &vms, dom->name))
return -1;
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
}
@@ -1130,7 +1154,8 @@ xenapiDomainGetMaxVcpus (virDomainPtr dom)
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
}
@@ -1166,7 +1191,8 @@ xenapiDomainDumpXML (virDomainPtr dom, int flags ATTRIBUTE_UNUSED)
if (!xen_vm_get_by_name_label(session, &vms, dom->name)) return NULL;
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return NULL;
}
@@ -1322,7 +1348,7 @@ xenapiDomainDumpXML (virDomainPtr dom, int flags ATTRIBUTE_UNUSED)
if (vif_rec != NULL) {
if (virParseMacAddr((const char *)vif_rec->mac,defPtr->nets[i]->mac) < 0)
xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
- "Unable to parse given mac address");
+ _("Unable to parse given mac address"));
xen_vif_record_free(vif_rec);
}
}
@@ -1373,7 +1399,8 @@ xenapiListDefinedDomains (virConnectPtr conn, char **const names,
}
xen_vm_record_free(record);
} else {
- xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, "Couldn't get VM record");
+ xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Couldn't get VM record"));
xen_vm_set_free(result);
while (--j >= 0) VIR_FREE(names[j]);
return -1;
@@ -1434,7 +1461,8 @@ xenapiDomainCreate (virDomainPtr dom)
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
}
@@ -1476,7 +1504,8 @@ xenapiDomainDefineXML (virConnectPtr conn, const char *xml)
if (!session->ok)
xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, NULL);
else
- xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, "Couldn't get VM information from XML");
+ xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Couldn't get VM information from XML"));
virDomainDefFree(defPtr);
return NULL;
}
@@ -1508,7 +1537,8 @@ xenapiDomainUndefine (virDomainPtr dom)
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
}
@@ -1522,7 +1552,7 @@ xenapiDomainUndefine (virDomainPtr dom)
return 0;
}
if (vms) xen_vm_set_free(vms);
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, "");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
return -1;
}
@@ -1543,7 +1573,8 @@ xenapiDomainGetAutostart (virDomainPtr dom, int *autostart)
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
}
@@ -1569,7 +1600,7 @@ xenapiDomainGetAutostart (virDomainPtr dom, int *autostart)
return 0;
}
if (vms) xen_vm_set_free(vms);
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, "");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
return -1;
}
@@ -1588,7 +1619,8 @@ xenapiDomainSetAutostart (virDomainPtr dom, int autostart)
xen_session *session = ((struct _xenapiPrivate *)(dom->conn->privateData))->session;
if (xen_vm_get_by_name_label(session, &vms, dom->name) && vms->size > 0) {
if (vms->size != 1) {
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR, "Domain name is not unique");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("Domain name is not unique"));
xen_vm_set_free(vms);
return -1;
}
@@ -1607,7 +1639,7 @@ xenapiDomainSetAutostart (virDomainPtr dom, int autostart)
return 0;
}
if (vms) xen_vm_set_free(vms);
- xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, "");
+ xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
return -1;
}
@@ -1636,12 +1668,14 @@ xenapiNodeGetFreeMemory (virConnectPtr conn)
xen_host_metrics_get_all(session, &xen_met_set);
if (xen_met_set != NULL) {
if (!xen_host_metrics_get_memory_free(session, (int64_t *)&freeMem, xen_met_set->contents[0])) {
- xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, "Couldn't get host metrics - memory information");
+ xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Couldn't get host metrics - memory information"));
freeMem = 0;
}
xen_host_metrics_set_free(xen_met_set);
} else {
- xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR, "Couldn't get host metrics");
+ xenapiSessionErrorHandler(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Couldn't get host metrics"));
}
return freeMem;
}
@@ -1657,7 +1691,7 @@ xenapiNodeGetCellsFreeMemory (virConnectPtr conn, unsigned long long *freeMems,
int startCell, int maxCells)
{
if (maxCells > 1 && startCell > 0) {
- xenapiSessionErrorHandler(conn, VIR_ERR_NO_SUPPORT, "");
+ xenapiSessionErrorHandler(conn, VIR_ERR_NO_SUPPORT, NULL);
return -1;
} else {
freeMems[0] = xenapiNodeGetFreeMemory(conn);
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index 697ad39..60e3c8d 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -119,7 +119,7 @@ xenapiUtil_ParseQuery(virConnectPtr conn, xmlURIPtr uri, int *noVerify)
if (virStrToLong_i(queryParam->value, NULL, 10, noVerify) < 0 ||
(*noVerify != 0 && *noVerify != 1)) {
xenapiSessionErrorHandler(conn, VIR_ERR_INVALID_ARG,
- "Query parameter 'no_verify' has unexpected value (should be 0 or 1)");
+ _("Query parameter 'no_verify' has unexpected value (should be 0 or 1)"));
goto failure;
}
}
--
1.7.0.3.513.gc8ed0
2
1
[libvirt] [PATCH v2] Blank out invalid interface names with escaped letters etc.
by Stefan Berger 31 Mar '10
by Stefan Berger 31 Mar '10
31 Mar '10
Check that interface names only contain valid characters. Blank them out
otherwise.
Valid characters in this code are currently a-z,A-Z,0-9, '-' and '_'.
Signed-off-by: Stefan Berger <stefanb(a)us.ibm.com>
---
src/conf/domain_conf.c | 9 ++++++++-
src/conf/domain_conf.h | 3 +++
2 files changed, 11 insertions(+), 1 deletion(-)
Index: libvirt-acl/src/conf/domain_conf.c
===================================================================
--- libvirt-acl.orig/src/conf/domain_conf.c
+++ libvirt-acl/src/conf/domain_conf.c
@@ -1776,6 +1776,11 @@ cleanup:
}
+static bool
+isValidIfname(const char *ifname) {
+ return strspn(ifname, VALID_IFNAME_CHARS) == strlen(ifname);
+}
+
/* Parse the XML definition for a network interface
* @param node XML nodeset to parse for net definition
@@ -1859,8 +1864,10 @@ virDomainNetDefParseXML(virCapsPtr caps,
xmlStrEqual(cur->name, BAD_CAST "target")) {
ifname = virXMLPropString(cur, "dev");
if ((ifname != NULL) &&
- (STRPREFIX((const char*)ifname, "vnet"))) {
+ ((STRPREFIX((const char*)ifname, "vnet")) ||
+ (!isValidIfname(ifname)))) {
/* An auto-generated target name, blank it out */
+ /* blank out invalid interface names */
VIR_FREE(ifname);
}
} else if ((script == NULL) &&
Index: libvirt-acl/src/conf/domain_conf.h
===================================================================
--- libvirt-acl.orig/src/conf/domain_conf.h
+++ libvirt-acl/src/conf/domain_conf.h
@@ -297,6 +297,9 @@ struct _virDomainNetDef {
virNWFilterHashTablePtr filterparams;
};
+#define VALID_IFNAME_CHARS \
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
+
enum virDomainChrTargetType {
VIR_DOMAIN_CHR_TARGET_TYPE_NULL = 0,
VIR_DOMAIN_CHR_TARGET_TYPE_MONITOR,
1
0
[libvirt] [PATCH] Keep track of guest paused state after disk IO / watchdog events
by Daniel P. Berrange 31 Mar '10
by Daniel P. Berrange 31 Mar '10
31 Mar '10
When a watchdog/IO error occurs, one of the possible actions that
QEMU might take is to pause the guest. In this scenario libvirt
needs to update its internal state for the VM, and emit a
lifecycle event:
VIR_DOMAIN_EVENT_SUSPENDED
with a detail being one of:
VIR_DOMAIN_EVENT_SUSPENDED_IOERROR
VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG
To future proof against possible QEMU support for multiple monitor
consoles, this patch also hooks into the 'STOPPED' event in QEMU
and emits a generic VIR_DOMAIN_EVENT_SUSPENDED_PAUSED event
* include/libvirt/libvirt.h.in: Add VIR_DOMAIN_EVENT_SUSPENDED_IOERROR
* src/qemu/qemu_driver.c: Update VM state to paused when IO error
or watchdog events occurrs
* src/qemu/qemu_monitor_json.c: Fix typo in disk IO event name
---
include/libvirt/libvirt.h.in | 2 +
src/qemu/qemu_driver.c | 83 ++++++++++++++++++++++++++++++++++++++----
src/qemu/qemu_monitor_json.c | 2 +-
3 files changed, 78 insertions(+), 9 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 6d8552f..7cb483e 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1384,6 +1384,8 @@ typedef enum {
typedef enum {
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED = 0, /* Normal suspend due to admin pause */
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED = 1, /* Suspended for offline migration */
+ VIR_DOMAIN_EVENT_SUSPENDED_IOERROR = 2, /* Suspended due to a disk I/O error */
+ VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG = 3, /* Suspended due to a watchdog firing */
} virDomainEventSuspendedDetailType;
/**
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9ee5da7..4291bc7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -909,6 +909,38 @@ qemuHandleDomainReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
static int
+qemuHandleDomainStop(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
+ virDomainObjPtr vm)
+{
+ struct qemud_driver *driver = qemu_driver;
+ virDomainEventPtr event = NULL;
+
+ virDomainObjLock(vm);
+ if (vm->state == VIR_DOMAIN_RUNNING) {
+ VIR_DEBUG("Transitioned guest %s to paused state due to unknown event", vm->def->name);
+
+ vm->state = VIR_DOMAIN_PAUSED;
+ event = virDomainEventNewFromObj(vm,
+ VIR_DOMAIN_EVENT_SUSPENDED,
+ VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
+
+ if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
+ VIR_WARN("Unable to save status on vm %s after IO error", vm->def->name);
+ }
+ virDomainObjUnlock(vm);
+
+ if (event) {
+ qemuDriverLock(driver);
+ if (event)
+ qemuDomainEventQueue(driver, event);
+ qemuDriverUnlock(driver);
+ }
+
+ return 0;
+}
+
+
+static int
qemuHandleDomainRTCChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
long long offset)
@@ -943,15 +975,32 @@ qemuHandleDomainWatchdog(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
int action)
{
struct qemud_driver *driver = qemu_driver;
- virDomainEventPtr event;
+ virDomainEventPtr watchdogEvent = NULL;
+ virDomainEventPtr lifecycleEvent = NULL;
virDomainObjLock(vm);
- event = virDomainEventWatchdogNewFromObj(vm, action);
+ watchdogEvent = virDomainEventWatchdogNewFromObj(vm, action);
+
+ if (action == VIR_DOMAIN_EVENT_WATCHDOG_PAUSE &&
+ vm->state == VIR_DOMAIN_RUNNING) {
+ VIR_DEBUG("Transitioned guest %s to paused state due to watchdog", vm->def->name);
+
+ vm->state = VIR_DOMAIN_PAUSED;
+ lifecycleEvent = virDomainEventNewFromObj(vm,
+ VIR_DOMAIN_EVENT_SUSPENDED,
+ VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG);
+
+ if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
+ VIR_WARN("Unable to save status on vm %s after IO error", vm->def->name);
+ }
virDomainObjUnlock(vm);
- if (event) {
+ if (watchdogEvent || lifecycleEvent) {
qemuDriverLock(driver);
- qemuDomainEventQueue(driver, event);
+ if (watchdogEvent)
+ qemuDomainEventQueue(driver, watchdogEvent);
+ if (lifecycleEvent)
+ qemuDomainEventQueue(driver, lifecycleEvent);
qemuDriverUnlock(driver);
}
@@ -966,7 +1015,8 @@ qemuHandleDomainIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
int action)
{
struct qemud_driver *driver = qemu_driver;
- virDomainEventPtr event;
+ virDomainEventPtr ioErrorEvent = NULL;
+ virDomainEventPtr lifecycleEvent = NULL;
const char *srcPath;
const char *devAlias;
virDomainDiskDefPtr disk;
@@ -982,12 +1032,28 @@ qemuHandleDomainIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
devAlias = "";
}
- event = virDomainEventIOErrorNewFromObj(vm, srcPath, devAlias, action);
+ ioErrorEvent = virDomainEventIOErrorNewFromObj(vm, srcPath, devAlias, action);
+
+ if (action == VIR_DOMAIN_EVENT_IO_ERROR_PAUSE &&
+ vm->state == VIR_DOMAIN_RUNNING) {
+ VIR_DEBUG("Transitioned guest %s to paused state due to IO error", vm->def->name);
+
+ vm->state = VIR_DOMAIN_PAUSED;
+ lifecycleEvent = virDomainEventNewFromObj(vm,
+ VIR_DOMAIN_EVENT_SUSPENDED,
+ VIR_DOMAIN_EVENT_SUSPENDED_IOERROR);
+
+ if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
+ VIR_WARN("Unable to save status on vm %s after IO error", vm->def->name);
+ }
virDomainObjUnlock(vm);
- if (event) {
+ if (ioErrorEvent || lifecycleEvent) {
qemuDriverLock(driver);
- qemuDomainEventQueue(driver, event);
+ if (ioErrorEvent)
+ qemuDomainEventQueue(driver, ioErrorEvent);
+ if (lifecycleEvent)
+ qemuDomainEventQueue(driver, lifecycleEvent);
qemuDriverUnlock(driver);
}
@@ -1090,6 +1156,7 @@ no_memory:
static qemuMonitorCallbacks monitorCallbacks = {
.eofNotify = qemuHandleMonitorEOF,
.diskSecretLookup = findVolumeQcowPassphrase,
+ .domainStop = qemuHandleDomainStop,
.domainReset = qemuHandleDomainReset,
.domainRTCChange = qemuHandleDomainRTCChange,
.domainWatchdog = qemuHandleDomainWatchdog,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 3901d46..eac3aca 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -66,7 +66,7 @@ struct {
{ "STOP", qemuMonitorJSONHandleStop, },
{ "RTC_CHANGE", qemuMonitorJSONHandleRTCChange, },
{ "WATCHDOG", qemuMonitorJSONHandleWatchdog, },
- { "DISK_IO_ERROR", qemuMonitorJSONHandleIOError, },
+ { "BLOCK_IO_ERROR", qemuMonitorJSONHandleIOError, },
{ "VNC_CONNECTED", qemuMonitorJSONHandleVNCConnect, },
{ "VNC_INITIALIZED", qemuMonitorJSONHandleVNCInitialize, },
{ "VNC_DISCONNECTED", qemuMonitorJSONHandleVNCDisconnect, },
--
1.6.2.5
2
2
Adds $(AM_V_GEN) to many more manual makefile.am rules that
were generating files
---
daemon/Makefile.am | 28 ++++++++++++++--------------
src/Makefile.am | 18 +++++++++---------
tools/Makefile.am | 40 ++++++++++++++++++++--------------------
3 files changed, 43 insertions(+), 43 deletions(-)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index e117b97..a82e9a9 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -172,16 +172,16 @@ remote.c: remote_dispatch_prototypes.h \
REMOTE_PROTOCOL = $(top_srcdir)/src/remote/remote_protocol.x
remote_dispatch_prototypes.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL)
- perl -w $(srcdir)/remote_generate_stubs.pl -p $(REMOTE_PROTOCOL) > $@
+ $(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -p $(REMOTE_PROTOCOL) > $@
remote_dispatch_table.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL)
- perl -w $(srcdir)/remote_generate_stubs.pl -t $(REMOTE_PROTOCOL) > $@
+ $(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -t $(REMOTE_PROTOCOL) > $@
remote_dispatch_args.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL)
- perl -w $(srcdir)/remote_generate_stubs.pl -a $(REMOTE_PROTOCOL) > $@
+ $(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -a $(REMOTE_PROTOCOL) > $@
remote_dispatch_ret.h: $(srcdir)/remote_generate_stubs.pl $(REMOTE_PROTOCOL)
- perl -w $(srcdir)/remote_generate_stubs.pl -r $(REMOTE_PROTOCOL) > $@
+ $(AM_V_GEN)perl -w $(srcdir)/remote_generate_stubs.pl -r $(REMOTE_PROTOCOL) > $@
LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
libvirtd.uml.logrotate
@@ -195,16 +195,16 @@ libvirtd.qemu.logrotate: libvirtd.qemu.logrotate.in
mv $@-t $@
libvirtd.lxc.logrotate: libvirtd.lxc.logrotate.in
- sed \
+ $(AM_V_GEN)sed \
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
- < $< > $@-t
- mv $@-t $@
+ < $< > $@-t && \
+ mv $@-t $@
libvirtd.uml.logrotate: libvirtd.uml.logrotate.in
- sed \
+ $(AM_V_GEN)sed \
-e 's![@]localstatedir[@]!$(localstatedir)!g' \
- < $< > $@-t
- mv $@-t $@
+ < $< > $@-t && \
+ mv $@-t $@
install-logrotate: $(LOGROTATE_CONFS)
mkdir -p $(DESTDIR)$(localstatedir)/log/libvirt/qemu/
@@ -231,13 +231,13 @@ uninstall-init:
BUILT_SOURCES += libvirtd.init
libvirtd.init: libvirtd.init.in
- sed \
+ $(AM_V_GEN)sed \
-e s!\@localstatedir\@!@localstatedir@!g \
-e s!\@sbindir\@!@sbindir@!g \
-e s!\@sysconfdir\@!@sysconfdir@!g \
- < $< > $@-t
- chmod a+x $@-t
- mv $@-t $@
+ < $< > $@-t && \
+ chmod a+x $@-t && \
+ mv $@-t $@
check-local:
test -x '$(AUGPARSE)' \
diff --git a/src/Makefile.am b/src/Makefile.am
index c661a5c..cc0a7d6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -870,17 +870,17 @@ EXTRA_DIST += \
BUILT_SOURCES = libvirt.syms
libvirt.syms: libvirt_public.syms $(USED_SYM_FILES)
- rm -f $@-tmp $@
- printf '# WARNING: generated from the following:\n# $^\n\n' >$@-tmp
- cat $(srcdir)/libvirt_public.syms >>$@-tmp
- printf '\n\n# Private symbols\n\n' >>$@-tmp
- printf 'LIBVIRT_PRIVATE_$(VERSION) {\n\n' >>$@-tmp
- printf 'global:\n\n' >>$@-tmp
+ $(AM_V_GEN)rm -f $@-tmp $@ ; \
+ printf '# WARNING: generated from the following:\n# $^\n\n' >$@-tmp && \
+ cat $(srcdir)/libvirt_public.syms >>$@-tmp && \
+ printf '\n\n# Private symbols\n\n' >>$@-tmp && \
+ printf 'LIBVIRT_PRIVATE_$(VERSION) {\n\n' >>$@-tmp && \
+ printf 'global:\n\n' >>$@-tmp && \
for file in $(USED_SYM_FILES); do \
cat $(srcdir)/$$file >>$@-tmp; \
- done
- printf '\n\nlocal:\n*;\n\n};' >>$@-tmp
- chmod a-w $@-tmp
+ done && \
+ printf '\n\nlocal:\n*;\n\n};' >>$@-tmp && \
+ chmod a-w $@-tmp && \
mv $@-tmp libvirt.syms
# Empty source list - it merely links a bunch of convenience libs together
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 46107f6..33a3216 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -17,18 +17,18 @@ man1_MANS = virt-xml-validate.1 virt-pki-validate.1 virsh.1
virt-xml-validate: virt-xml-validate.in Makefile
- sed -e 's,@SCHEMADIR@,$(pkgdatadir)/schemas,' < $< > $@ || (rm $@ && exit 1)
- chmod +x $@
+ $(AM_V_GEN)sed -e 's,@SCHEMADIR@,$(pkgdatadir)/schemas,' < $< > $@ \
+ || (rm $@ && exit 1) && chmod +x $@
virt-xml-validate.1: virt-xml-validate
- $(POD2MAN) $< $@
+ $(AM_V_GEN)$(POD2MAN) $< $@
virt-pki-validate: virt-pki-validate.in Makefile
- sed -e 's,@SYSCONFDIR@,$(sysconfdir),' < $< > $@ || (rm $@ && exit 1)
- chmod +x $@
+ $(AM_V_GEN)sed -e 's,@SYSCONFDIR@,$(sysconfdir),' < $< > $@ \
+ || (rm $@ && exit 1) && chmod +x $@
virt-pki-validate.1: virt-pki-validate
- $(POD2MAN) $< $@
+ $(AM_V_GEN)$(POD2MAN) $< $@
virsh_SOURCES = \
console.c console.h \
@@ -55,24 +55,24 @@ virsh_CFLAGS = \
BUILT_SOURCES = virsh-net-edit.c virsh-pool-edit.c
virsh-net-edit.c: virsh.c Makefile.am
- rm -f $@-tmp
- echo '/* Automatically generated from: $^ */' > $@-tmp
- echo 'static int' >> $@-tmp
+ $(AM_V_GEN)rm -f $@-tmp && \
+ echo '/* Automatically generated from: $^ */' > $@-tmp && \
+ echo 'static int' >> $@-tmp && \
awk '/^cmdEdit/, /^}/' $< \
| sed -e 's/domain/network/g' \
-e 's/Domain/Network/g' \
-e 's/cmdEdit/cmdNetworkEdit/g' \
-e 's/dom/network/g' \
-e 's/int flags.*/int flags = 0;/g' \
- >> $@-tmp
- chmod a-w $@-tmp
- rm -f $@
+ >> $@-tmp && \
+ chmod a-w $@-tmp && \
+ rm -f $@ && \
mv $@-tmp $@
virsh-pool-edit.c: virsh.c Makefile.am
- rm -f $@-tmp
- echo '/* Automatically generated from: $^ */' > $@-tmp
- echo 'static int' >> $@-tmp
+ $(AM_V_GEN)rm -f $@-tmp && \
+ echo '/* Automatically generated from: $^ */' > $@-tmp && \
+ echo 'static int' >> $@-tmp && \
awk '/^cmdEdit/, /^}/' $< \
| sed -e 's/domain/pool/g' \
-e 's/vshCommandOptDomain/vshCommandOptPool/g' \
@@ -83,9 +83,9 @@ virsh-pool-edit.c: virsh.c Makefile.am
-e 's/\(virStoragePoolDefineXML.*\));/\1, 0);/' \
-e 's/dom/pool/g' \
-e 's/int flags.*/int flags = 0;/g' \
- >> $@-tmp
- chmod a-w $@-tmp
- rm -f $@
+ >> $@-tmp && \
+ chmod a-w $@-tmp && \
+ rm -f $@ && \
mv $@-tmp $@
@@ -110,13 +110,13 @@ virsh_LDADD += virsh_win_icon.$(OBJEXT)
# information is needed in this area.
virsh_win_icon.$(OBJEXT): virsh_win_icon.rc
- $(WINDRES) \
+ $(AM_V_GEN)$(WINDRES) \
--input-format rc --input $< \
--output-format coff --output $@
endif
virsh.1: virsh.pod
- $(POD2MAN) $< $@
+ $(AM_V_GEN)$(POD2MAN) $< $@
CLEANFILES = $(bin_SCRIPTS) $(man1_MANS)
--
1.6.2.5
2
1