Generate almost all SOAP method mapping code.
Update the driver code to use the complete paramater list of some methods
that had parameters skipped before.
Improve the ESX_VI__METHOD marco to do automatic output deserialization
based on output occurrence. Also incorporate automatic _this binding and
output pointer check.
---
src/esx/esx_driver.c | 26 +-
src/esx/esx_vi.c | 7 +-
src/esx/esx_vi_generator.input | 191 +++++++++-
src/esx/esx_vi_generator.py | 489 ++++++++++++++++++------
src/esx/esx_vi_methods.c | 854 ++++++----------------------------------
src/esx/esx_vi_methods.h | 132 +------
6 files changed, 723 insertions(+), 976 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 4ed9890..e3340c9 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -1333,7 +1333,8 @@ esxDomainResume(virDomainPtr domain)
goto failure;
}
- if (esxVI_PowerOnVM_Task(priv->host, virtualMachine->obj, &task) < 0 ||
+ if (esxVI_PowerOnVM_Task(priv->host, virtualMachine->obj, NULL,
+ &task) < 0 ||
esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
priv->autoAnswer, &taskInfoState) < 0) {
goto failure;
@@ -1710,8 +1711,9 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
esxVI_PerfCounterInfo *perfCounterInfo = NULL;
esxVI_PerfCounterInfo *perfCounterInfoList = NULL;
esxVI_PerfQuerySpec *querySpec = NULL;
+ esxVI_PerfEntityMetricBase *perfEntityMetricBase = NULL;
+ esxVI_PerfEntityMetricBase *perfEntityMetricBaseList = NULL;
esxVI_PerfEntityMetric *perfEntityMetric = NULL;
- esxVI_PerfEntityMetric *perfEntityMetricList = NULL;
esxVI_PerfMetricIntSeries *perfMetricIntSeries = NULL;
esxVI_Long *value = NULL;
@@ -1883,17 +1885,26 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
querySpec->metricId->instance = (char *)"";
querySpec->format = (char *)"normal";
- if (esxVI_QueryPerf(priv->host, querySpec, &perfEntityMetricList) < 0)
{
+ if (esxVI_QueryPerf(priv->host, querySpec,
+ &perfEntityMetricBaseList) < 0) {
querySpec->entity = NULL;
querySpec->metricId->instance = NULL;
querySpec->format = NULL;
goto failure;
}
- for (perfEntityMetric = perfEntityMetricList; perfEntityMetric != NULL;
- perfEntityMetric = perfEntityMetric->_next) {
+ for (perfEntityMetricBase = perfEntityMetricBaseList;
+ perfEntityMetricBase != NULL;
+ perfEntityMetricBase = perfEntityMetricBase->_next) {
VIR_DEBUG0("perfEntityMetric ...");
+ perfEntityMetric =
+ esxVI_PerfEntityMetric_DynamicCast(perfEntityMetricBase);
+
+ if (perfMetricIntSeries == NULL) {
+ VIR_ERROR0("QueryPerf returned object with unexpected type");
+ }
+
perfMetricIntSeries =
esxVI_PerfMetricIntSeries_DynamicCast(perfEntityMetric->value);
@@ -1927,7 +1938,7 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
esxVI_Int_Free(&counterIdList);
esxVI_PerfCounterInfo_Free(&perfCounterInfoList);
esxVI_PerfQuerySpec_Free(&querySpec);
- esxVI_PerfEntityMetric_Free(&perfEntityMetricList);
+ esxVI_PerfEntityMetricBase_Free(&perfEntityMetricBaseList);
return result;
@@ -2367,7 +2378,8 @@ esxDomainCreate(virDomainPtr domain)
goto failure;
}
- if (esxVI_PowerOnVM_Task(priv->host, virtualMachine->obj, &task) < 0 ||
+ if (esxVI_PowerOnVM_Task(priv->host, virtualMachine->obj, NULL,
+ &task) < 0 ||
esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
priv->autoAnswer, &taskInfoState) < 0) {
goto failure;
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 1a71558..4318ff1 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -444,7 +444,7 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
goto failure;
}
- if (esxVI_Login(ctx, username, password, &ctx->session) < 0) {
+ if (esxVI_Login(ctx, username, password, NULL, &ctx->session) < 0) {
goto failure;
}
@@ -1344,7 +1344,7 @@ esxVI_EnsureSession(esxVI_Context *ctx)
if (active != esxVI_Boolean_True) {
esxVI_UserSession_Free(&ctx->session);
- if (esxVI_Login(ctx, ctx->username, ctx->password,
+ if (esxVI_Login(ctx, ctx->username, ctx->password, NULL,
&ctx->session) < 0) {
return -1;
}
@@ -1378,7 +1378,8 @@ esxVI_EnsureSession(esxVI_Context *ctx)
if (currentSession == NULL) {
esxVI_UserSession_Free(&ctx->session);
- if (esxVI_Login(ctx, ctx->username, ctx->password, &ctx->session)
< 0) {
+ if (esxVI_Login(ctx, ctx->username, ctx->password, NULL,
+ &ctx->session) < 0) {
goto failure;
}
} else if (STRNEQ(ctx->session->key, currentSession->key)) {
diff --git a/src/esx/esx_vi_generator.input b/src/esx/esx_vi_generator.input
index 9c545eb..a016c63 100644
--- a/src/esx/esx_vi_generator.input
+++ b/src/esx/esx_vi_generator.input
@@ -28,7 +28,22 @@
# - ol for an optional list
# - i for an ignored item or list
#
-# Object member sequence has to match the WSDL sequence
+# Object member sequence has to match the WSDL sequence.
+#
+#
+# Method definition:
+#
+# method <name> [returns <type> <occurrence>]
+# <type> <name> <occurrence>
+# ...
+# end
+#
+# The _this paramater can have a type attached to it:
+#
+# _this:<type>
+#
+# The <type> refers to one of the ServiceContent members. This make the
+# generator auto-bind _this to the corresponding ServiceContent member.
#
@@ -436,3 +451,177 @@ object VirtualMachineSnapshotTree
Boolean quiesced r
VirtualMachineSnapshotTree childSnapshotList ol
end
+
+
+# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+# Methods
+#
+
+method AnswerVM
+ ManagedObjectReference _this r
+ String questionId r
+ String answerChoice r
+end
+
+
+method CancelTask
+ ManagedObjectReference _this r
+end
+
+
+method CreateFilter returns ManagedObjectReference r
+ ManagedObjectReference _this:PropertyCollector r
+ PropertyFilterSpec spec r
+ Boolean partialUpdates r
+end
+
+
+method CreateSnapshot_Task returns ManagedObjectReference r
+ ManagedObjectReference _this r
+ String name r
+ String description o
+ Boolean memory r
+ Boolean quiesce r
+end
+
+
+method DestroyPropertyFilter
+ ManagedObjectReference _this r
+end
+
+
+method FindByIp returns ManagedObjectReference o
+ ManagedObjectReference _this:SearchIndex r
+ ManagedObjectReference datacenter o
+ String ip r
+ Boolean vmSearch r
+end
+
+
+method FindByUuid returns ManagedObjectReference o
+ ManagedObjectReference _this:SearchIndex r
+ ManagedObjectReference datacenter o
+ String uuid r
+ Boolean vmSearch r
+end
+
+
+method Login returns UserSession r
+ ManagedObjectReference _this:SessionManager r
+ String userName r
+ String password r
+ String locale o
+end
+
+
+method Logout
+ ManagedObjectReference _this:SessionManager r
+end
+
+
+method MigrateVM_Task returns ManagedObjectReference r
+ ManagedObjectReference _this r
+ ManagedObjectReference pool o
+ ManagedObjectReference host o
+ VirtualMachineMovePriority priority r
+ VirtualMachinePowerState state o
+end
+
+
+method PowerOffVM_Task returns ManagedObjectReference r
+ ManagedObjectReference _this r
+end
+
+
+method PowerOnVM_Task returns ManagedObjectReference r
+ ManagedObjectReference _this r
+ ManagedObjectReference host o
+end
+
+
+method QueryAvailablePerfMetric returns PerfMetricId ol
+ ManagedObjectReference _this:PerformanceManager r
+ ManagedObjectReference entity r
+ DateTime beginTime o
+ DateTime endTime o
+ Int intervalId o
+end
+
+
+method QueryPerf returns PerfEntityMetricBase ol
+ ManagedObjectReference _this:PerformanceManager r
+ PerfQuerySpec querySpec rl
+end
+
+
+method QueryPerfCounter returns PerfCounterInfo ol
+ ManagedObjectReference _this:PerformanceManager r
+ Int counterId rl
+end
+
+
+method RebootGuest
+ ManagedObjectReference _this r
+end
+
+
+method ReconfigVM_Task returns ManagedObjectReference r
+ ManagedObjectReference _this r
+ VirtualMachineConfigSpec spec r
+end
+
+
+method RegisterVM_Task returns ManagedObjectReference r
+ ManagedObjectReference _this r
+ String path r
+ String name o
+ Boolean asTemplate r
+ ManagedObjectReference pool o
+ ManagedObjectReference host o
+end
+
+
+method RemoveSnapshot_Task returns ManagedObjectReference r
+ ManagedObjectReference _this r
+ Boolean removeChildren r
+end
+
+
+method RetrieveProperties returns ObjectContent ol
+ ManagedObjectReference _this:PropertyCollector r
+ PropertyFilterSpec specSet rl
+end
+
+
+method RevertToSnapshot_Task returns ManagedObjectReference r
+ ManagedObjectReference _this r
+ ManagedObjectReference host o
+end
+
+
+method SessionIsActive returns Boolean r
+ ManagedObjectReference _this:SessionManager r
+ String sessionID r
+ String userName r
+end
+
+
+method ShutdownGuest
+ ManagedObjectReference _this r
+end
+
+
+method SuspendVM_Task returns ManagedObjectReference r
+ ManagedObjectReference _this r
+end
+
+
+method UnregisterVM
+ ManagedObjectReference _this r
+end
+
+
+method WaitForUpdates returns UpdateSet r
+ ManagedObjectReference _this:PropertyCollector r
+ String version o
+end
diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
index b933d5b..272b219 100755
--- a/src/esx/esx_vi_generator.py
+++ b/src/esx/esx_vi_generator.py
@@ -27,34 +27,247 @@ import os.path
+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]
-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]
+
+
+
+
+
+class Parameter:
+ autobind_map = { "PerformanceManager" : "perfManager",
+ "PropertyCollector" : "propertyCollector",
+ "SearchIndex" : "searchIndex",
+ "SessionManager" : "sessionManager" }
def __init__(self, type, name, occurrence):
self.type = type
+ self.occurrence = occurrence
+
+ if ':' in name and name.startswith("_this"):
+ self.name, self.autobind_type = name.split(":")
+ else:
+ self.name = name
+ self.autobind_type = None
+
+
+ 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_paramater(self, is_last = False, is_header = True, offset = 0):
+ if self.occurrence == OCCURRENCE__IGNORED:
+ raise ValueError("invalid function parameter occurrence value
'%s'" % self.occurrence)
+ elif self.autobind_type is not None:
+ return ""
+ else:
+ string = " "
+ string += " " * offset
+ string += "%s%s" % (self.get_type_string(), self.name)
+
+ if is_last:
+ if is_header:
+ string += "); "
+ else:
+ string += "), "
+ else:
+ string += ", "
+
+ while len(string) < 59:
+ string += " "
+
+ return string + self.get_occurrence_comment() + "\n"
+
+
+ def generate_return(self, offset = 0, end_of_line = ";"):
+ if self.occurrence == OCCURRENCE__IGNORED:
+ raise ValueError("invalid function parameteroccurrence value
'%s'" % self.occurrence)
+ else:
+ string = " "
+ string += " " * offset
+ string += "%s*%s)%s" % (self.get_type_string(), self.name,
end_of_line)
+
+ while len(string) < 59:
+ string += " "
+
+ return string + self.get_occurrence_comment() + "\n"
+
+
+ def generate_require_code(self):
+ if self.occurrence in [OCCURRENCE__REQUIRED_ITEM,
+ OCCURRENCE__REQUIRED_LIST]:
+ return " ESX_VI__METHOD__PARAMETER__REQUIRE(%s)\n" % self.name
+ else:
+ return ""
+
+
+ def generate_serialize_code(self):
+ if self.occurrence in [OCCURRENCE__REQUIRED_LIST,
+ OCCURRENCE__OPTIONAL_LIST]:
+ return " ESX_VI__METHOD__PARAMETER__SERIALIZE_LIST(%s, %s)\n" %
(self.type, self.name)
+ elif self.type == "String":
+ return " ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String,
%s)\n" % self.name
+ else:
+ return " ESX_VI__METHOD__PARAMETER__SERIALIZE(%s, %s)\n" %
(self.type, self.name)
+
+
+ def get_type_string(self):
+ if self.type == "String" and \
+ self.occurrence not in [OCCURRENCE__REQUIRED_LIST,
+ OCCURRENCE__OPTIONAL_LIST]:
+ return "const char *"
+ elif self.is_enum():
+ return "esxVI_%s " % self.type
+ else:
+ return "esxVI_%s *" % self.type
+
+
+ def get_occurrence_comment(self):
+ if self.occurrence == OCCURRENCE__REQUIRED_ITEM:
+ return "/* required */"
+ elif self.occurrence == OCCURRENCE__REQUIRED_LIST:
+ return "/* required, list */"
+ elif self.occurrence == OCCURRENCE__OPTIONAL_ITEM:
+ return "/* optional */"
+ elif self.occurrence == OCCURRENCE__OPTIONAL_LIST:
+ return "/* optional, list */"
+
+ raise ValueError("unknown occurrence value '%s'" %
self.occurrence)
+
+
+ def get_occurrence_short_enum(self):
+ if self.occurrence == OCCURRENCE__REQUIRED_ITEM:
+ return "RequiredItem"
+ elif self.occurrence == OCCURRENCE__REQUIRED_LIST:
+ return "RequiredList"
+ elif self.occurrence == OCCURRENCE__OPTIONAL_ITEM:
+ return "OptionalItem"
+ elif self.occurrence == OCCURRENCE__OPTIONAL_LIST:
+ return "OptionalList"
+
+ raise ValueError("unknown occurrence value '%s'" %
self.occurrence)
+
+
+
+class Method:
+ def __init__(self, name, parameters, returns):
+ self.name = name
+ self.parameters = []
+ self.autobind_parameter = None
+ self.returns = returns
+
+ for parameter in parameters:
+ if parameter.autobind_type is None:
+ self.parameters.append(parameter)
+ else:
+ self.autobind_parameter = parameter
+
+
+ def generate_header(self):
+ header = "int esxVI_%s\n" % self.name
+ header += " (esxVI_Context *ctx"
+
+ if len(self.parameters) > 0 or self.returns is not None:
+ header += ",\n"
+
+ for parameter in self.parameters[:-1]:
+ header += parameter.generate_paramater()
+
+ if self.returns is None:
+ header += self.parameters[-1].generate_paramater(is_last = True)
+ else:
+ header += self.parameters[-1].generate_paramater()
+ header += self.returns.generate_return()
+ else:
+ header += ");\n"
+
+ header += "\n"
+
+ return header
+
+
+ def generate_source(self):
+ source = "/* esxVI_%s */\n" % self.name
+ source += "ESX_VI__METHOD(%s," % self.name
+
+ if self.autobind_parameter is not None:
+ source += " %s,\n" %
Parameter.autobind_map[self.autobind_parameter.autobind_type]
+ else:
+ source += " /* explicit _this */,\n"
+
+ source += " (esxVI_Context *ctx"
+
+ if len(self.parameters) > 0 or self.returns is not None:
+ source += ",\n"
+
+ for parameter in self.parameters[:-1]:
+ source += parameter.generate_paramater(is_header = False, offset = 9)
+
+ if self.returns is None:
+ source += self.parameters[-1].generate_paramater(is_last = True,
is_header = False, offset = 9)
+ else:
+ source += self.parameters[-1].generate_paramater(is_header = False,
offset = 9)
+ source += self.returns.generate_return(offset = 9, end_of_line =
",")
+ else:
+ source += "),\n"
+
+ if self.returns is None:
+ source += " void, None,\n"
+ else:
+ source += " %s, %s,\n" % (self.returns.type,
self.returns.get_occurrence_short_enum())
+
+ source += "{\n"
+
+ if self.autobind_parameter is not None:
+ source += self.autobind_parameter.generate_require_code()
+
+ for parameter in self.parameters:
+ source += parameter.generate_require_code()
+
+ source += "},\n"
+ source += "{\n"
+
+ if self.autobind_parameter is not None:
+ source += self.autobind_parameter.generate_serialize_code()
+
+ for parameter in self.parameters:
+ source += parameter.generate_serialize_code()
+
+ source += "})\n\n\n\n"
+
+ return source
+
+
+
+class Property:
+ 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:
+ if self.occurrence == OCCURRENCE__IGNORED:
return " /* FIXME: %s is currently ignored */\n" % self.name
else:
string = " %s%s; " % (self.get_type_string(), self.name)
@@ -62,36 +275,39 @@ class Property:
while len(string) < 59:
string += " "
- return string + "/* %s */\n" % self.get_occurrence_string()
+ return string + self.get_occurrence_comment() + "\n"
+
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]:
+ self.occurrence not in [OCCURRENCE__REQUIRED_LIST,
+ OCCURRENCE__OPTIONAL_LIST,
+ OCCURRENCE__IGNORED]:
return " VIR_FREE(item->%s);\n" % self.name
elif self.is_enum():
return ""
else:
- if self.occurrence == Property.OCCURRENCE__IGNORED:
+ if self.occurrence == 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]:
+ if self.occurrence in [OCCURRENCE__REQUIRED_ITEM,
+ OCCURRENCE__REQUIRED_LIST]:
return " ESX_VI__TEMPLATE__PROPERTY__REQUIRE(%s)\n" % self.name
- elif self.occurrence == Property.OCCURRENCE__IGNORED:
+ elif self.occurrence == 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:
+ if self.occurrence == OCCURRENCE__IGNORED:
return " /* FIXME: %s is currently ignored */\n" % self.name
- elif self.occurrence in [Property.OCCURRENCE__REQUIRED_LIST,
- Property.OCCURRENCE__OPTIONAL_LIST]:
+ elif self.occurrence in [OCCURRENCE__REQUIRED_LIST,
+ 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
@@ -100,54 +316,53 @@ class Property:
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:
+ if self.occurrence == OCCURRENCE__IGNORED:
return " /* FIXME: %s is currently ignored */\n" % self.name
- elif self.occurrence in [Property.OCCURRENCE__REQUIRED_LIST,
- Property.OCCURRENCE__OPTIONAL_LIST]:
+ elif self.occurrence in [OCCURRENCE__REQUIRED_LIST,
+ 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:
+ if self.occurrence == 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]:
+ elif self.occurrence in [OCCURRENCE__REQUIRED_LIST,
+ 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]:
+ self.occurrence not in [OCCURRENCE__REQUIRED_LIST,
+ 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)
-
-
-
+ def get_occurrence_comment(self):
+ if self.occurrence == OCCURRENCE__REQUIRED_ITEM:
+ return "/* required */"
+ elif self.occurrence == OCCURRENCE__REQUIRED_LIST:
+ return "/* required, list */"
+ elif self.occurrence == OCCURRENCE__OPTIONAL_ITEM:
+ return "/* optional */"
+ elif self.occurrence == OCCURRENCE__OPTIONAL_LIST:
+ return "/* optional, list */"
+ raise ValueError("unknown occurrence value '%s'" %
self.occurrence)
@@ -159,6 +374,7 @@ class Object:
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
@@ -166,10 +382,6 @@ class Object:
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
@@ -201,6 +413,7 @@ class Object:
return members
+
def generate_free_code(self, add_banner = False):
global objects_by_name
source = ""
@@ -226,6 +439,7 @@ class Object:
return source
+
def generate_validate_code(self, add_banner = False):
global objects_by_name
source = ""
@@ -251,6 +465,7 @@ class Object:
return source
+
def generate_dynamic_cast_code(self):
global objects_by_name
source = ""
@@ -266,6 +481,7 @@ class Object:
return source
+
def generate_deep_copy_code(self, add_banner = False):
global objects_by_name
source = ""
@@ -291,6 +507,7 @@ class Object:
return source
+
def generate_serialize_code(self, add_banner = False):
global objects_by_name
source = ""
@@ -309,6 +526,7 @@ class Object:
return source
+
def generate_deserialize_code(self, add_banner = False):
global objects_by_name
source = ""
@@ -327,18 +545,22 @@ class Object:
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
@@ -346,6 +568,7 @@ class Object:
return string
+
def generate_header(self):
header = "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * *\n"
header += " * VI Type: %s\n" % self.name
@@ -424,6 +647,7 @@ class Object:
return header
+
def generate_source(self):
source = "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * *\n"
source += " * VI Type: %s\n" % self.name
@@ -601,11 +825,6 @@ class Object:
-
-
-
-
-
class Enum:
FEATURE__ANY_TYPE = (1 << 1)
FEATURE__SERIALIZE = (1 << 2)
@@ -617,18 +836,22 @@ class Enum:
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
@@ -636,6 +859,7 @@ class Enum:
return string
+
def generate_header(self):
header = "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * *\n"
header += " * VI Enum: %s\n" % self.name
@@ -664,6 +888,7 @@ class Enum:
return header
+
def generate_source(self):
source = "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * *\n"
source += " * VI Enum: %s\n" % self.name
@@ -698,20 +923,12 @@ class Enum:
-
-
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:]
@@ -744,7 +961,7 @@ def parse_object(block):
if len(items) != 3:
report_error("line %d: invalid property" % line[0])
- if items[2] not in Property.valid_occurrences:
+ if items[2] not in valid_occurrences:
report_error("line %d: invalid occurrence" % line[0])
properties.append(Property(type = items[0], name = items[1],
@@ -775,6 +992,44 @@ def parse_enum(block):
+def parse_method(block):
+ # expected format: method <name> [returns <type> <occurrence>]
+ header_items = block[0][1].split()
+
+ if len(header_items) < 2:
+ report_error("line %d: invalid block header" % (number))
+
+ assert header_items[0] == "method"
+
+ name = header_items[1]
+ returns = None
+
+ if len(header_items) > 2:
+ if header_items[2] != "returns":
+ report_error("line %d: invalid block header" % (number))
+ else:
+ returns = Parameter(type = header_items[3], name = "output",
+ occurrence = header_items[4])
+
+ parameters = []
+
+ 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 valid_occurrences:
+ report_error("line %d: invalid occurrence" % line[0])
+
+ parameters.append(Parameter(type = items[0], name = items[1],
+ occurrence = items[2]))
+
+ return Method(name = name, parameters = parameters, returns = returns)
+
+
+
def inherit_features(obj):
if obj.extended_by is not None:
for extended_by in obj.extended_by:
@@ -834,7 +1089,7 @@ additional_object_features = { "Event"
: Object.FEATURE__LI
"ManagedObjectReference" :
Object.FEATURE__ANY_TYPE,
"ObjectContent" :
Object.FEATURE__DEEP_COPY | Object.FEATURE__LIST,
"PerfCounterInfo" :
Object.FEATURE__LIST,
- "PerfEntityMetric" :
Object.FEATURE__LIST,
+ "PerfEntityMetric" :
Object.FEATURE__LIST | Object.FEATURE__DYNAMIC_CAST,
"PerfQuerySpec" :
Object.FEATURE__LIST,
"PerfMetricIntSeries" :
Object.FEATURE__DYNAMIC_CAST,
"PropertyFilterSpec" :
Object.FEATURE__LIST,
@@ -859,7 +1114,6 @@ removed_object_features = { "DynamicProperty" :
Object.FEATURE__SERIA
-
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")
@@ -869,18 +1123,21 @@ else:
-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"))
+types_typedef = open_and_print(os.path.join(output_dirname,
"esx_vi_types.generated.typedef"))
+types_typeenum = open_and_print(os.path.join(output_dirname,
"esx_vi_types.generated.typeenum"))
+types_typetostring = open_and_print(os.path.join(output_dirname,
"esx_vi_types.generated.typetostring"))
+types_typefromstring = open_and_print(os.path.join(output_dirname,
"esx_vi_types.generated.typefromstring"))
+types_header = open_and_print(os.path.join(output_dirname,
"esx_vi_types.generated.h"))
+types_source = open_and_print(os.path.join(output_dirname,
"esx_vi_types.generated.c"))
+methods_header = open_and_print(os.path.join(output_dirname,
"esx_vi_methods.generated.h"))
+methods_source = open_and_print(os.path.join(output_dirname,
"esx_vi_methods.generated.c"))
number = 0
objects_by_name = {}
enums_by_name = {}
+methods_by_name = {}
block = None
@@ -896,7 +1153,7 @@ for line in file(input_filename, "rb").readlines():
if len(line) < 1:
continue
- if line.startswith("object") or line.startswith("enum"):
+ if line.startswith("object") or line.startswith("enum") or
line.startswith("method"):
if block is not None:
report_error("line %d: nested block found" % (number))
else:
@@ -907,9 +1164,12 @@ for line in file(input_filename, "rb").readlines():
if block[0][1].startswith("object"):
obj = parse_object(block)
objects_by_name[obj.name] = obj
- else:
+ elif block[0][1].startswith("enum"):
enum = parse_enum(block)
enums_by_name[enum.name] = enum
+ else:
+ method = parse_method(block)
+ methods_by_name[method.name] = method
block = None
else:
@@ -926,7 +1186,7 @@ for enum in enums_by_name.values():
for obj in objects_by_name.values():
for property in obj.properties:
- if property.occurrence != Property.OCCURRENCE__IGNORED and \
+ if property.occurrence != OCCURRENCE__IGNORED and \
not is_known_type(property.type):
report_error("object '%s' contains unknown property type
'%s'" % (obj.name, property.type))
@@ -936,8 +1196,8 @@ for obj in objects_by_name.values():
# detect list usage
for property in obj.properties:
- if (property.occurrence == Property.OCCURRENCE__REQUIRED_LIST or \
- property.occurrence == Property.OCCURRENCE__OPTIONAL_LIST) and \
+ if (property.occurrence == OCCURRENCE__REQUIRED_LIST or \
+ property.occurrence == OCCURRENCE__OPTIONAL_LIST) and \
property.type not in predefined_objects:
objects_by_name[property.type].features |= Object.FEATURE__LIST
@@ -951,7 +1211,7 @@ for obj in objects_by_name.values():
# spread deep copy onto properties
if obj.features & Object.FEATURE__DEEP_COPY:
for property in obj.properties:
- if property.occurrence != Property.OCCURRENCE__IGNORED and \
+ if property.occurrence != OCCURRENCE__IGNORED and \
property.type not in predefined_objects and \
property.type in objects_by_name:
objects_by_name[property.type].features |= Object.FEATURE__DEEP_COPY
@@ -976,55 +1236,62 @@ for obj in objects_by_name.values():
-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")
+types_typedef.write("/* Generated by esx_vi_generator.py */\n\n\n\n")
+types_typeenum.write("/* Generated by esx_vi_generator.py */\n\n")
+types_typetostring.write("/* Generated by esx_vi_generator.py */\n\n")
+types_typefromstring.write("/* Generated by esx_vi_generator.py */\n\n")
+types_header.write("/* Generated by esx_vi_generator.py */\n\n\n\n")
+types_source.write("/* Generated by esx_vi_generator.py */\n\n\n\n")
+methods_header.write("/* Generated by esx_vi_generator.py */\n\n\n\n")
+methods_source.write("/* Generated by esx_vi_generator.py */\n\n\n\n")
+# output enums
+types_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())
+ types_typedef.write(enums_by_name[name].generate_typedef())
+ types_typeenum.write(enums_by_name[name].generate_typeenum())
+ types_typetostring.write(enums_by_name[name].generate_typetostring())
+ types_typefromstring.write(enums_by_name[name].generate_typefromstring())
+ types_header.write(enums_by_name[name].generate_header())
+ types_source.write(enums_by_name[name].generate_source())
-typedef.write("\n\n\n" +
- "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * *\n" +
- " * VI Types\n" +
- " */\n\n")
+# output objects
+types_typedef.write("\n\n\n" +
+ "/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * *\n" +
+ " * VI Types\n" +
+ " */\n\n")
+types_typeenum.write("\n")
+types_typetostring.write("\n")
+types_typefromstring.write("\n")
-typeenum.write("\n")
-typetostring.write("\n")
-typefromstring.write("\n")
+names = objects_by_name.keys()
+names.sort()
+for name in names:
+ types_typedef.write(objects_by_name[name].generate_typedef())
+ types_typeenum.write(objects_by_name[name].generate_typeenum())
+ types_typetostring.write(objects_by_name[name].generate_typetostring())
+ types_typefromstring.write(objects_by_name[name].generate_typefromstring())
+ types_header.write(objects_by_name[name].generate_header())
+ types_source.write(objects_by_name[name].generate_source())
-names = objects_by_name.keys()
-names.sort()
+# output methods
+names = methods_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())
+ methods_header.write(methods_by_name[name].generate_header())
+ methods_source.write(methods_by_name[name].generate_source())
diff --git a/src/esx/esx_vi_methods.c b/src/esx/esx_vi_methods.c
index b2b3e8d..5c52167 100644
--- a/src/esx/esx_vi_methods.c
+++ b/src/esx/esx_vi_methods.c
@@ -51,18 +51,88 @@
-#define ESX_VI__METHOD(_name, _parameters, _occurrence, _prolog, _validate, \
- _serialize, _deserialize) \
+#define ESX_VI__METHOD__CHECK_OUTPUT__None \
+ /* nothing */
+
+
+
+#define ESX_VI__METHOD__CHECK_OUTPUT__NotNone \
+ if (output == NULL || *output != 0) { \
+ ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument")); \
+ return -1; \
+ }
+
+
+
+#define ESX_VI__METHOD__CHECK_OUTPUT__RequiredItem \
+ ESX_VI__METHOD__CHECK_OUTPUT__NotNone
+
+
+
+#define ESX_VI__METHOD__CHECK_OUTPUT__RequiredList \
+ ESX_VI__METHOD__CHECK_OUTPUT__NotNone
+
+
+
+#define ESX_VI__METHOD__CHECK_OUTPUT__OptionalItem \
+ ESX_VI__METHOD__CHECK_OUTPUT__NotNone
+
+
+
+#define ESX_VI__METHOD__CHECK_OUTPUT__OptionalList \
+ ESX_VI__METHOD__CHECK_OUTPUT__NotNone
+
+
+
+#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__None(_type) \
+ /* nothing */
+
+
+
+#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__RequiredItem(_type) \
+ if (esxVI_##_type##_Deserialize(response->node, output) < 0) { \
+ goto failure; \
+ }
+
+
+
+#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__RequiredList(_type) \
+ if (esxVI_##_type##_DeserializeList(response->node, output) < 0) { \
+ goto failure; \
+ }
+
+
+
+#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__OptionalItem(_type) \
+ if (response->node != NULL &&
\
+ esxVI_##_type##_Deserialize(response->node, output) < 0) { \
+ goto failure; \
+ }
+
+
+
+#define ESX_VI__METHOD__DESERIALIZE_OUTPUT__OptionalList(_type) \
+ if (response->node != NULL &&
\
+ esxVI_##_type##_DeserializeList(response->node, output) < 0) { \
+ goto failure; \
+ }
+
+
+
+#define ESX_VI__METHOD(_name, _this_from_service, _parameters, _output_type, \
+ _occurrence, _validate, _serialize) \
int \
esxVI_##_name _parameters \
{ \
int result = 0; \
- const char* method_name = #_name; \
+ const char *methodName = #_name; \
virBuffer buffer = VIR_BUFFER_INITIALIZER; \
char *request = NULL; \
esxVI_Response *response = NULL; \
\
- _prolog \
+ ESX_VI__METHOD__PARAMETER__THIS__##_this_from_service \
+ \
+ ESX_VI__METHOD__CHECK_OUTPUT__##_occurrence \
\
_validate \
\
@@ -81,14 +151,12 @@
\
request = virBufferContentAndReset(&buffer); \
\
- if (esxVI_Context_Execute(ctx, #_name, request, &response, \
+ if (esxVI_Context_Execute(ctx, methodName, request, &response, \
esxVI_Occurrence_##_occurrence) < 0) { \
goto failure; \
} \
\
- if (response->node != NULL) { \
- _deserialize \
- } \
+ ESX_VI__METHOD__DESERIALIZE_OUTPUT__##_occurrence(_output_type) \
\
cleanup: \
VIR_FREE(request); \
@@ -106,19 +174,44 @@
-#define ESX_VI__METHOD__CHECK_SERVICE() \
+#define ESX_VI__METHOD__PARAMETER__THIS_FROM_SERVICE(_type, _name) \
+ esxVI_##_type *_this = NULL; \
+ \
if (ctx->service == NULL) { \
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
call")); \
return -1; \
- }
+ } \
+ \
+ _this = ctx->service->_name;
-#define ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(_name) \
- if (_name == NULL || *_name != NULL) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument")); \
- return -1; \
- }
+#define ESX_VI__METHOD__PARAMETER__THIS__/* explicit _this */ \
+ /* nothing */
+
+
+
+#define ESX_VI__METHOD__PARAMETER__THIS__perfManager \
+ ESX_VI__METHOD__PARAMETER__THIS_FROM_SERVICE(ManagedObjectReference, \
+ perfManager)
+
+
+
+#define ESX_VI__METHOD__PARAMETER__THIS__propertyCollector \
+ ESX_VI__METHOD__PARAMETER__THIS_FROM_SERVICE(ManagedObjectReference, \
+ propertyCollector)
+
+
+
+#define ESX_VI__METHOD__PARAMETER__THIS__searchIndex \
+ ESX_VI__METHOD__PARAMETER__THIS_FROM_SERVICE(ManagedObjectReference, \
+ searchIndex)
+
+
+
+#define ESX_VI__METHOD__PARAMETER__THIS__sessionManager \
+ ESX_VI__METHOD__PARAMETER__THIS_FROM_SERVICE(ManagedObjectReference, \
+ sessionManager)
@@ -132,17 +225,7 @@
if (_name == 0) { \
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
"Required parameter '%s' is missing for call to
%s", \
- #_name, method_name); \
- return -1; \
- }
-
-
-
-#define ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(_name) \
- if (_name == 0) { \
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, \
- "Required parameter '_this' is missing for call to
%s", \
- method_name); \
+ #_name, methodName); \
return -1; \
}
@@ -169,13 +252,6 @@
-#define ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(_type, _name) \
- if (esxVI_##_type##_Serialize(_name, "_this", &buffer) < 0) {
\
- goto failure; \
- }
-
-
-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* VI Methods
*/
@@ -220,553 +296,16 @@ esxVI_RetrieveServiceContent(esxVI_Context *ctx,
-/* esxVI_Login */
-ESX_VI__METHOD(Login,
- (esxVI_Context *ctx,
- const char *userName, const char *password,
- esxVI_UserSession **userSession),
- RequiredItem,
-{
- ESX_VI__METHOD__CHECK_SERVICE()
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(userSession)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(ctx->service->sessionManager)
- ESX_VI__METHOD__PARAMETER__REQUIRE(userName)
- ESX_VI__METHOD__PARAMETER__REQUIRE(password)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- ctx->service->sessionManager)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, userName)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, password)
-},
-{
- if (esxVI_UserSession_Deserialize(response->node, userSession) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_Logout */
-ESX_VI__METHOD(Logout, (esxVI_Context *ctx), None,
-{
- ESX_VI__METHOD__CHECK_SERVICE()
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(ctx->service->sessionManager)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- ctx->service->sessionManager)
-},
-{
-})
-
-
-
-/* esxVI_SessionIsActive */
-ESX_VI__METHOD(SessionIsActive,
- (esxVI_Context *ctx, const char *sessionID,
- const char *userName, esxVI_Boolean *active),
- RequiredItem,
-{
- ESX_VI__METHOD__CHECK_SERVICE()
-
- if (active == NULL) {
- ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid
argument"));
- return -1;
- }
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(ctx->service->sessionManager)
- ESX_VI__METHOD__PARAMETER__REQUIRE(sessionID)
- ESX_VI__METHOD__PARAMETER__REQUIRE(userName)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- ctx->service->sessionManager)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, sessionID)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, userName)
-},
-{
- if (esxVI_Boolean_Deserialize(response->node, active) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_RetrieveProperties */
-ESX_VI__METHOD(RetrieveProperties,
- (esxVI_Context *ctx,
- esxVI_PropertyFilterSpec *specSet, /* list */
- esxVI_ObjectContent **objectContentList),
- OptionalList,
-{
- ESX_VI__METHOD__CHECK_SERVICE()
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(objectContentList)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(ctx->service->propertyCollector)
- ESX_VI__METHOD__PARAMETER__REQUIRE(specSet)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- ctx->service->propertyCollector)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_LIST(PropertyFilterSpec, specSet)
-},
-{
- if (esxVI_ObjectContent_DeserializeList(response->node,
- objectContentList) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_PowerOnVM_Task */
-ESX_VI__METHOD(PowerOnVM_Task,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
- esxVI_ManagedObjectReference **task),
- RequiredItem,
-{
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(task)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachine)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- virtualMachine)
-},
-{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_PowerOffVM_Task */
-ESX_VI__METHOD(PowerOffVM_Task,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
- esxVI_ManagedObjectReference **task),
- RequiredItem,
-{
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(task)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachine)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- virtualMachine)
-},
-{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_SuspendVM_Task */
-ESX_VI__METHOD(SuspendVM_Task,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
- esxVI_ManagedObjectReference **task),
- RequiredItem,
-{
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(task)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachine)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- virtualMachine)
-},
-{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_MigrateVM_Task */
-ESX_VI__METHOD(MigrateVM_Task,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
- esxVI_ManagedObjectReference *pool,
- esxVI_ManagedObjectReference *host,
- esxVI_VirtualMachineMovePriority priority,
- esxVI_VirtualMachinePowerState state,
- esxVI_ManagedObjectReference **task),
- RequiredItem,
-{
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(task)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachine)
- ESX_VI__METHOD__PARAMETER__REQUIRE(priority)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- virtualMachine)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(ManagedObjectReference, pool)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(ManagedObjectReference, host)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(VirtualMachineMovePriority, priority)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(VirtualMachinePowerState, state)
-},
-{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_ReconfigVM_Task */
-ESX_VI__METHOD(ReconfigVM_Task,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
- esxVI_VirtualMachineConfigSpec *spec,
- esxVI_ManagedObjectReference **task),
- RequiredItem,
-{
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(task)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachine)
- ESX_VI__METHOD__PARAMETER__REQUIRE(spec)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- virtualMachine)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(VirtualMachineConfigSpec, spec)
-},
-{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_RegisterVM_Task */
-ESX_VI__METHOD(RegisterVM_Task,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *folder,
- const char *path, const char *name,
- esxVI_Boolean asTemplate,
- esxVI_ManagedObjectReference *pool,
- esxVI_ManagedObjectReference *host,
- esxVI_ManagedObjectReference **task),
- RequiredItem,
-{
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(task)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(folder)
- ESX_VI__METHOD__PARAMETER__REQUIRE(path)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference, folder)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, path)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, name)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(Boolean, asTemplate)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(ManagedObjectReference, pool)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(ManagedObjectReference, host)
-},
-{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_CreateSnapshot_Task */
-ESX_VI__METHOD(CreateSnapshot_Task,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
- const char *name, const char *description,
- esxVI_Boolean memory, esxVI_Boolean quiesce,
- esxVI_ManagedObjectReference **task),
- RequiredItem,
-{
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(task)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachine)
- ESX_VI__METHOD__PARAMETER__REQUIRE(name)
- ESX_VI__METHOD__PARAMETER__REQUIRE(memory)
- ESX_VI__METHOD__PARAMETER__REQUIRE(quiesce)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- virtualMachine)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, name)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, description)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(Boolean, memory)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(Boolean, quiesce)
-},
-{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_RevertToSnapshot_Task */
-ESX_VI__METHOD(RevertToSnapshot_Task,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachineSnapshot,
- esxVI_ManagedObjectReference *host,
- esxVI_ManagedObjectReference **task),
- RequiredItem,
-{
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(task)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachineSnapshot)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- virtualMachineSnapshot)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(ManagedObjectReference, host)
-},
-{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_RemoveSnapshot_Task */
-ESX_VI__METHOD(RemoveSnapshot_Task,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachineSnapshot,
- esxVI_Boolean removeChildren,
- esxVI_ManagedObjectReference **task),
- RequiredItem,
-{
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(task)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachineSnapshot)
- ESX_VI__METHOD__PARAMETER__REQUIRE(removeChildren)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- virtualMachineSnapshot)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(Boolean, removeChildren)
-},
-{
- if (esxVI_ManagedObjectReference_Deserialize(response->node, task) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_CancelTask */
-ESX_VI__METHOD(CancelTask,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *task),
- None,
-{
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(task)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference, task)
-},
-{
-})
-
-
-
-/* esxVI_UnregisterVM */
-ESX_VI__METHOD(UnregisterVM,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine),
- None,
-{
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachine)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- virtualMachine)
-},
-{
-})
-
-
-
-/* esxVI_AnswerVM */
-ESX_VI__METHOD(AnswerVM,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
- const char *questionId,
- const char *answerChoice),
- None,
-{
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachine)
- ESX_VI__METHOD__PARAMETER__REQUIRE(questionId)
- ESX_VI__METHOD__PARAMETER__REQUIRE(answerChoice)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- virtualMachine)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, questionId)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, answerChoice)
-},
-{
-})
-
-
-
-/* esxVI_CreateFilter */
-ESX_VI__METHOD(CreateFilter,
- (esxVI_Context *ctx,
- esxVI_PropertyFilterSpec *spec,
- esxVI_Boolean partialUpdates,
- esxVI_ManagedObjectReference **propertyFilter),
- RequiredItem,
-{
- ESX_VI__METHOD__CHECK_SERVICE()
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(propertyFilter)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(ctx->service->propertyCollector)
- ESX_VI__METHOD__PARAMETER__REQUIRE(spec)
- ESX_VI__METHOD__PARAMETER__REQUIRE(partialUpdates)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- ctx->service->propertyCollector)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(PropertyFilterSpec, spec)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(Boolean, partialUpdates)
-},
-{
- if (esxVI_ManagedObjectReference_Deserialize(response->node,
- propertyFilter) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_DestroyPropertyFilter */
-ESX_VI__METHOD(DestroyPropertyFilter,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *propertyFilter),
- None,
-{
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(propertyFilter)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- propertyFilter)
-},
-{
-})
-
-
-
-/* esxVI_WaitForUpdates */
-ESX_VI__METHOD(WaitForUpdates,
- (esxVI_Context *ctx,
- const char *version,
- esxVI_UpdateSet **updateSet),
- RequiredItem,
-{
- ESX_VI__METHOD__CHECK_SERVICE()
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(updateSet)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(ctx->service->propertyCollector)
- ESX_VI__METHOD__PARAMETER__REQUIRE(version)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- ctx->service->propertyCollector)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, version)
-},
-{
- if (esxVI_UpdateSet_Deserialize(response->node, updateSet) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_RebootGuest */
-ESX_VI__METHOD(RebootGuest,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine),
- None,
-{
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachine)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- virtualMachine)
-},
-{
-})
-
-
-
-/* esxVI_ShutdownGuest */
-ESX_VI__METHOD(ShutdownGuest,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine),
- None,
-{
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(virtualMachine)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- virtualMachine)
-},
-{
-})
-
-
-
/* esxVI_ValidateMigration */
-ESX_VI__METHOD(ValidateMigration,
+ESX_VI__METHOD(ValidateMigration, /* special _this */,
(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *vm, /* list */
- esxVI_VirtualMachinePowerState state,
- esxVI_String *testType, /* list */
- esxVI_ManagedObjectReference *pool,
- esxVI_ManagedObjectReference *host,
- esxVI_Event **eventList),
- OptionalList,
-{
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(eventList)
-},
+ esxVI_ManagedObjectReference *vm, /* required, list */
+ esxVI_VirtualMachinePowerState state, /* optional */
+ esxVI_String *testType, /* optional, list */
+ esxVI_ManagedObjectReference *pool, /* optional */
+ esxVI_ManagedObjectReference *host, /* optional */
+ esxVI_Event **output), /* optional, list */
+ Event, OptionalList,
{
ESX_VI__METHOD__PARAMETER__REQUIRE(vm)
},
@@ -781,165 +320,8 @@ ESX_VI__METHOD(ValidateMigration,
ESX_VI__METHOD__PARAMETER__SERIALIZE_LIST(String, testType)
ESX_VI__METHOD__PARAMETER__SERIALIZE(ManagedObjectReference, pool)
ESX_VI__METHOD__PARAMETER__SERIALIZE(ManagedObjectReference, host)
-},
-{
- if (esxVI_Event_DeserializeList(response->node, eventList) < 0) {
- goto failure;
- }
})
-/* esxVI_FindByIp */
-ESX_VI__METHOD(FindByIp,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *datacenter,
- const char *ip,
- esxVI_Boolean vmSearch,
- esxVI_ManagedObjectReference **managedObjectReference),
- OptionalItem,
-{
- ESX_VI__METHOD__CHECK_SERVICE()
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(managedObjectReference)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(ctx->service->searchIndex)
- ESX_VI__METHOD__PARAMETER__REQUIRE(ip)
- ESX_VI__METHOD__PARAMETER__REQUIRE(vmSearch)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- ctx->service->searchIndex)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(ManagedObjectReference, datacenter)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, ip)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(Boolean, vmSearch)
-},
-{
- if (esxVI_ManagedObjectReference_Deserialize(response->node,
- managedObjectReference) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_FindByUuid */
-ESX_VI__METHOD(FindByUuid,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *datacenter,
- const char *uuid, /* string */
- esxVI_Boolean vmSearch,
- esxVI_ManagedObjectReference **managedObjectReference),
- OptionalItem,
-{
- ESX_VI__METHOD__CHECK_SERVICE()
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(managedObjectReference)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(ctx->service->searchIndex)
- ESX_VI__METHOD__PARAMETER__REQUIRE(uuid)
- ESX_VI__METHOD__PARAMETER__REQUIRE(vmSearch)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- ctx->service->searchIndex)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(ManagedObjectReference, datacenter)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_VALUE(String, uuid)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(Boolean, vmSearch)
-},
-{
- if (esxVI_ManagedObjectReference_Deserialize(response->node,
- managedObjectReference) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_QueryAvailablePerfMetric */
-ESX_VI__METHOD(QueryAvailablePerfMetric,
- (esxVI_Context *ctx,
- esxVI_ManagedObjectReference *entity,
- esxVI_DateTime *beginTime,
- esxVI_DateTime *endTime,
- esxVI_Int *intervalId,
- esxVI_PerfMetricId **perfMetricIdList),
- OptionalList,
-{
- ESX_VI__METHOD__CHECK_SERVICE()
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(perfMetricIdList)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(ctx->service->perfManager)
- ESX_VI__METHOD__PARAMETER__REQUIRE(entity)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- ctx->service->perfManager)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(ManagedObjectReference, entity)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(DateTime, beginTime)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(DateTime, endTime)
- ESX_VI__METHOD__PARAMETER__SERIALIZE(Int, intervalId)
-},
-{
- if (esxVI_PerfMetricId_DeserializeList(response->node,
- perfMetricIdList) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_QueryPerfCounter */
-ESX_VI__METHOD(QueryPerfCounter,
- (esxVI_Context *ctx,
- esxVI_Int *counterId, /* list */
- esxVI_PerfCounterInfo **perfCounterInfoList),
- OptionalList,
-{
- ESX_VI__METHOD__CHECK_SERVICE()
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(perfCounterInfoList)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(ctx->service->perfManager)
- ESX_VI__METHOD__PARAMETER__REQUIRE(counterId)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- ctx->service->perfManager)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_LIST(Int, counterId)
-},
-{
- if (esxVI_PerfCounterInfo_DeserializeList(response->node,
- perfCounterInfoList) < 0) {
- goto failure;
- }
-})
-
-
-
-/* esxVI_QueryPerf */
-ESX_VI__METHOD(QueryPerf,
- (esxVI_Context *ctx,
- esxVI_PerfQuerySpec *querySpec, /* list */
- esxVI_PerfEntityMetric **perfEntityMetricList),
- OptionalList,
-{
- ESX_VI__METHOD__CHECK_SERVICE()
- ESX_VI__METHOD__PARAMETER__CHECK_OUTPUT(perfEntityMetricList)
-},
-{
- ESX_VI__METHOD__PARAMETER__REQUIRE_THIS(ctx->service->perfManager)
- ESX_VI__METHOD__PARAMETER__REQUIRE(querySpec)
-},
-{
- ESX_VI__METHOD__PARAMETER__SERIALIZE_THIS(ManagedObjectReference,
- ctx->service->perfManager)
- ESX_VI__METHOD__PARAMETER__SERIALIZE_LIST(PerfQuerySpec, querySpec)
-},
-{
- if (esxVI_PerfEntityMetric_DeserializeList(response->node,
- perfEntityMetricList) < 0) {
- goto failure;
- }
-})
+#include "esx_vi_methods.generated.c"
diff --git a/src/esx/esx_vi_methods.h b/src/esx/esx_vi_methods.h
index 9ff8b4b..7b6be4e 100644
--- a/src/esx/esx_vi_methods.h
+++ b/src/esx/esx_vi_methods.h
@@ -32,123 +32,19 @@
* VI Methods
*/
-int esxVI_RetrieveServiceContent(esxVI_Context *ctx,
- esxVI_ServiceContent **serviceContent);
-
-int esxVI_Login(esxVI_Context *ctx, const char *userName, const char *password,
- esxVI_UserSession **userSession);
-
-int esxVI_Logout(esxVI_Context *ctx);
-
-int esxVI_SessionIsActive(esxVI_Context *ctx, const char *sessionID,
- const char *userName, esxVI_Boolean *active);
-
-int esxVI_RetrieveProperties(esxVI_Context *ctx,
- esxVI_PropertyFilterSpec *specSet, /* list */
- esxVI_ObjectContent **objectContentList);
-
-int esxVI_PowerOnVM_Task(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
- esxVI_ManagedObjectReference **task);
-
-int esxVI_PowerOffVM_Task(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
- esxVI_ManagedObjectReference **task);
-
-int esxVI_SuspendVM_Task(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
- esxVI_ManagedObjectReference **task);
-
-int esxVI_MigrateVM_Task(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
- esxVI_ManagedObjectReference *pool,
- esxVI_ManagedObjectReference *host,
- esxVI_VirtualMachineMovePriority priority,
- esxVI_VirtualMachinePowerState state,
- esxVI_ManagedObjectReference **task);
-
-int esxVI_ReconfigVM_Task(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
- esxVI_VirtualMachineConfigSpec *spec,
- esxVI_ManagedObjectReference **task);
-
-int esxVI_RegisterVM_Task(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *folder,
- const char *path, const char *name,
- esxVI_Boolean asTemplate,
- esxVI_ManagedObjectReference *pool,
- esxVI_ManagedObjectReference *host,
- esxVI_ManagedObjectReference **task);
-
-int esxVI_CreateSnapshot_Task(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
- const char *name, const char *description,
- esxVI_Boolean memory, esxVI_Boolean quiesce,
- esxVI_ManagedObjectReference **task);
-
-int esxVI_RevertToSnapshot_Task
- (esxVI_Context *ctx, esxVI_ManagedObjectReference *virtualMachineSnapshot,
- esxVI_ManagedObjectReference *host, esxVI_ManagedObjectReference **task);
-
-int esxVI_RemoveSnapshot_Task
- (esxVI_Context *ctx, esxVI_ManagedObjectReference *virtualMachineSnapshot,
- esxVI_Boolean removeChildren, esxVI_ManagedObjectReference **task);
-
-int esxVI_CancelTask(esxVI_Context *ctx, esxVI_ManagedObjectReference *task);
-
-int esxVI_UnregisterVM(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine);
-
-int esxVI_AnswerVM(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine,
- const char *questionId, const char *answerChoice);
-
-int esxVI_CreateFilter(esxVI_Context *ctx,
- esxVI_PropertyFilterSpec *spec,
- esxVI_Boolean partialUpdates,
- esxVI_ManagedObjectReference **propertyFilter);
-
-int esxVI_DestroyPropertyFilter(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *propertyFilter);
-
-int esxVI_WaitForUpdates(esxVI_Context *ctx, const char *version,
- esxVI_UpdateSet **updateSet);
-
-int esxVI_RebootGuest(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine);
-
-int esxVI_ShutdownGuest(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *virtualMachine);
-
-int esxVI_ValidateMigration(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *vm, /* list */
- esxVI_VirtualMachinePowerState state,
- esxVI_String *testType, /* list */ // FIXME: see
ValidateMigrationTestType
- esxVI_ManagedObjectReference *pool,
- esxVI_ManagedObjectReference *host,
- esxVI_Event **eventList);
-
-int esxVI_FindByIp(esxVI_Context *ctx, esxVI_ManagedObjectReference *datacenter,
- const char *ip, esxVI_Boolean vmSearch,
- esxVI_ManagedObjectReference **managedObjectReference);
-
-int esxVI_FindByUuid(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *datacenter,
- const char *uuid, /* string */
- esxVI_Boolean vmSearch,
- esxVI_ManagedObjectReference **managedObjectReference);
-
-int esxVI_QueryAvailablePerfMetric(esxVI_Context *ctx,
- esxVI_ManagedObjectReference *entity,
- esxVI_DateTime *beginTime,
- esxVI_DateTime *endTime,
- esxVI_Int *intervalId,
- esxVI_PerfMetricId **perfMetricIdList);
-
-int esxVI_QueryPerfCounter(esxVI_Context *ctx, esxVI_Int *counterId, /* list */
- esxVI_PerfCounterInfo **perfCounterInfoList);
-
-int esxVI_QueryPerf(esxVI_Context *ctx, esxVI_PerfQuerySpec *querySpecList,
- esxVI_PerfEntityMetric **perfEntityMetricList);
+int esxVI_RetrieveServiceContent
+ (esxVI_Context *ctx,
+ esxVI_ServiceContent **serviceContent); /* required */
+
+int esxVI_ValidateMigration
+ (esxVI_Context *ctx,
+ esxVI_ManagedObjectReference *vm, /* required, list */
+ esxVI_VirtualMachinePowerState state, /* optional */
+ esxVI_String *testType, /* optional, list */
+ esxVI_ManagedObjectReference *pool, /* optional */
+ esxVI_ManagedObjectReference *host, /* optional */
+ esxVI_Event **output); /* optional, list */
+
+#include "esx_vi_methods.generated.h"
#endif /* __ESX_VI_METHODS_H__ */
--
1.6.3.3