2009-07-23 20:21:08 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* esx_vi.h: client for the VMware VI API 2.5 to manage ESX hosts
|
|
|
|
*
|
2010-03-06 16:56:28 +00:00
|
|
|
* Copyright (C) 2009-2010 Matthias Bolte <matthias.bolte@googlemail.com>
|
2009-07-23 20:21:08 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ESX_VI_H__
|
2010-03-09 18:22:22 +00:00
|
|
|
# define __ESX_VI_H__
|
2009-07-23 20:21:08 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include <libxml/tree.h>
|
|
|
|
# include <libxml/xpath.h>
|
|
|
|
# include <curl/curl.h>
|
2009-07-23 20:21:08 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "internal.h"
|
2010-04-02 19:34:31 +00:00
|
|
|
# include "virterror_internal.h"
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "datatypes.h"
|
|
|
|
# include "esx_vi_types.h"
|
2010-06-03 21:09:12 +00:00
|
|
|
# include "esx_util.h"
|
2009-07-23 20:21:08 +00:00
|
|
|
|
2010-04-02 19:34:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
# define ESX_VI_ERROR(code, ...) \
|
2011-04-16 08:30:22 +00:00
|
|
|
virReportErrorHelper(VIR_FROM_ESX, code, __FILE__, __FUNCTION__, \
|
2010-04-02 19:34:31 +00:00
|
|
|
__LINE__, __VA_ARGS__)
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-04-21 15:54:10 +00:00
|
|
|
# define ESX_VI__SOAP__REQUEST_HEADER \
|
2010-04-18 17:58:58 +00:00
|
|
|
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
|
|
|
|
"<soapenv:Envelope\n" \
|
|
|
|
" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n" \
|
|
|
|
" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n" \
|
|
|
|
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" \
|
|
|
|
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" \
|
|
|
|
"<soapenv:Body>\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-04-21 15:54:10 +00:00
|
|
|
# define ESX_VI__SOAP__REQUEST_FOOTER \
|
2010-04-18 17:58:58 +00:00
|
|
|
"</soapenv:Body>\n" \
|
|
|
|
"</soapenv:Envelope>"
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-04-21 15:54:10 +00:00
|
|
|
# define ESV_VI__XML_TAG__OPEN(_buffer, _element, _type) \
|
2010-04-18 17:58:58 +00:00
|
|
|
do { \
|
|
|
|
virBufferAddLit(_buffer, "<"); \
|
|
|
|
virBufferAdd(_buffer, _element, -1); \
|
|
|
|
virBufferAddLit(_buffer, " xmlns=\"urn:vim25\" xsi:type=\""); \
|
|
|
|
virBufferAdd(_buffer, _type, -1); \
|
|
|
|
virBufferAddLit(_buffer, "\">"); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-04-21 15:54:10 +00:00
|
|
|
# define ESV_VI__XML_TAG__CLOSE(_buffer, _element) \
|
2010-04-18 17:58:58 +00:00
|
|
|
do { \
|
|
|
|
virBufferAddLit(_buffer, "</"); \
|
|
|
|
virBufferAdd(_buffer, _element, -1); \
|
|
|
|
virBufferAddLit(_buffer, ">"); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-05 08:23:59 +00:00
|
|
|
typedef enum _esxVI_APIVersion esxVI_APIVersion;
|
|
|
|
typedef enum _esxVI_ProductVersion esxVI_ProductVersion;
|
2009-11-22 20:18:45 +00:00
|
|
|
typedef enum _esxVI_Occurrence esxVI_Occurrence;
|
2010-04-13 22:03:12 +00:00
|
|
|
typedef struct _esxVI_ParsedHostCpuIdInfo esxVI_ParsedHostCpuIdInfo;
|
2011-02-19 13:34:25 +00:00
|
|
|
typedef struct _esxVI_CURL esxVI_CURL;
|
2011-02-19 14:27:16 +00:00
|
|
|
typedef struct _esxVI_SharedCURL esxVI_SharedCURL;
|
2009-07-23 20:21:08 +00:00
|
|
|
typedef struct _esxVI_Context esxVI_Context;
|
2009-09-04 16:24:25 +00:00
|
|
|
typedef struct _esxVI_Response esxVI_Response;
|
2009-07-23 20:21:08 +00:00
|
|
|
typedef struct _esxVI_Enumeration esxVI_Enumeration;
|
|
|
|
typedef struct _esxVI_EnumerationValue esxVI_EnumerationValue;
|
|
|
|
typedef struct _esxVI_List esxVI_List;
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-05 08:23:59 +00:00
|
|
|
enum _esxVI_APIVersion {
|
|
|
|
esxVI_APIVersion_Undefined = 0,
|
|
|
|
esxVI_APIVersion_Unknown,
|
|
|
|
esxVI_APIVersion_25,
|
2010-07-21 23:19:04 +00:00
|
|
|
esxVI_APIVersion_40,
|
|
|
|
esxVI_APIVersion_41,
|
|
|
|
esxVI_APIVersion_4x /* > 4.1 */
|
2009-08-05 08:23:59 +00:00
|
|
|
};
|
|
|
|
|
2010-05-18 16:11:59 +00:00
|
|
|
/*
|
|
|
|
* AAAABBBB: where AAAA0000 is the product and BBBB the version. this format
|
|
|
|
* allows simple bitmask testing for a product independent of the version
|
|
|
|
*/
|
2009-08-05 08:23:59 +00:00
|
|
|
enum _esxVI_ProductVersion {
|
|
|
|
esxVI_ProductVersion_Undefined = 0,
|
2010-05-18 16:11:59 +00:00
|
|
|
|
|
|
|
esxVI_ProductVersion_GSX = (1 << 0) << 16,
|
|
|
|
esxVI_ProductVersion_GSX20 = esxVI_ProductVersion_GSX | 1,
|
|
|
|
|
|
|
|
esxVI_ProductVersion_ESX = (1 << 1) << 16,
|
|
|
|
esxVI_ProductVersion_ESX35 = esxVI_ProductVersion_ESX | 1,
|
|
|
|
esxVI_ProductVersion_ESX40 = esxVI_ProductVersion_ESX | 2,
|
2010-07-21 23:19:04 +00:00
|
|
|
esxVI_ProductVersion_ESX41 = esxVI_ProductVersion_ESX | 3,
|
|
|
|
esxVI_ProductVersion_ESX4x = esxVI_ProductVersion_ESX | 4, /* > 4.1 */
|
2010-05-18 16:11:59 +00:00
|
|
|
|
|
|
|
esxVI_ProductVersion_VPX = (1 << 2) << 16,
|
|
|
|
esxVI_ProductVersion_VPX25 = esxVI_ProductVersion_VPX | 1,
|
2010-07-21 23:19:04 +00:00
|
|
|
esxVI_ProductVersion_VPX40 = esxVI_ProductVersion_VPX | 2,
|
|
|
|
esxVI_ProductVersion_VPX41 = esxVI_ProductVersion_VPX | 3,
|
|
|
|
esxVI_ProductVersion_VPX4x = esxVI_ProductVersion_VPX | 4 /* > 4.1 */
|
2009-08-05 08:23:59 +00:00
|
|
|
};
|
|
|
|
|
2009-11-22 20:18:45 +00:00
|
|
|
enum _esxVI_Occurrence {
|
|
|
|
esxVI_Occurrence_Undefined = 0,
|
|
|
|
esxVI_Occurrence_RequiredItem,
|
2010-03-06 16:56:28 +00:00
|
|
|
esxVI_Occurrence_RequiredList,
|
2009-11-22 20:18:45 +00:00
|
|
|
esxVI_Occurrence_OptionalItem,
|
2010-03-06 16:56:28 +00:00
|
|
|
esxVI_Occurrence_OptionalList,
|
2009-11-22 20:32:23 +00:00
|
|
|
esxVI_Occurrence_None
|
2009-09-23 12:40:41 +00:00
|
|
|
};
|
|
|
|
|
2010-04-13 22:03:12 +00:00
|
|
|
struct _esxVI_ParsedHostCpuIdInfo {
|
|
|
|
int level;
|
|
|
|
char eax[32];
|
|
|
|
char ebx[32];
|
|
|
|
char ecx[32];
|
|
|
|
char edx[32];
|
|
|
|
};
|
|
|
|
|
2009-08-05 08:23:59 +00:00
|
|
|
|
|
|
|
|
2011-02-19 13:34:25 +00:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* CURL
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct _esxVI_CURL {
|
|
|
|
CURL *handle;
|
|
|
|
virMutex lock;
|
|
|
|
struct curl_slist *headers;
|
|
|
|
char error[CURL_ERROR_SIZE];
|
2011-02-19 14:27:16 +00:00
|
|
|
esxVI_SharedCURL *shared;
|
2011-02-19 13:34:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int esxVI_CURL_Alloc(esxVI_CURL **curl);
|
|
|
|
void esxVI_CURL_Free(esxVI_CURL **curl);
|
|
|
|
int esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri);
|
|
|
|
int esxVI_CURL_Download(esxVI_CURL *curl, const char *url, char **content);
|
|
|
|
int esxVI_CURL_Upload(esxVI_CURL *curl, const char *url, const char *content);
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-02-19 14:27:16 +00:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* SharedCURL
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct _esxVI_SharedCURL {
|
|
|
|
CURLSH *handle;
|
|
|
|
virMutex locks[3]; /* share, cookie, dns */
|
|
|
|
size_t count;
|
|
|
|
};
|
|
|
|
|
|
|
|
int esxVI_SharedCURL_Alloc(esxVI_SharedCURL **shared);
|
|
|
|
void esxVI_SharedCURL_Free(esxVI_SharedCURL **shared);
|
|
|
|
int esxVI_SharedCURL_Add(esxVI_SharedCURL *shared, esxVI_CURL *curl);
|
|
|
|
int esxVI_SharedCURL_Remove(esxVI_SharedCURL *shared, esxVI_CURL *curl);
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-23 20:21:08 +00:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* Context
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct _esxVI_Context {
|
2011-05-01 19:57:43 +00:00
|
|
|
/* All members are used read-only after esxVI_Context_Connect ... */
|
2011-02-19 13:34:25 +00:00
|
|
|
esxVI_CURL *curl;
|
2009-07-23 20:21:08 +00:00
|
|
|
char *url;
|
2009-09-23 12:09:44 +00:00
|
|
|
char *ipAddress;
|
2009-07-23 20:21:08 +00:00
|
|
|
char *username;
|
|
|
|
char *password;
|
|
|
|
esxVI_ServiceContent *service;
|
2009-08-05 08:23:59 +00:00
|
|
|
esxVI_APIVersion apiVersion;
|
|
|
|
esxVI_ProductVersion productVersion;
|
2011-05-01 19:57:43 +00:00
|
|
|
esxVI_UserSession *session; /* ... except the session ... */
|
|
|
|
virMutexPtr sessionLock; /* ... that is protected by this mutex */
|
2010-07-31 21:57:42 +00:00
|
|
|
esxVI_Datacenter *datacenter;
|
|
|
|
esxVI_ComputeResource *computeResource;
|
|
|
|
esxVI_HostSystem *hostSystem;
|
2010-08-21 16:49:18 +00:00
|
|
|
esxVI_SelectionSpec *selectSet_folderToChildEntity;
|
|
|
|
esxVI_SelectionSpec *selectSet_hostSystemToParent;
|
|
|
|
esxVI_SelectionSpec *selectSet_hostSystemToVm;
|
|
|
|
esxVI_SelectionSpec *selectSet_hostSystemToDatastore;
|
|
|
|
esxVI_SelectionSpec *selectSet_computeResourceToHost;
|
|
|
|
esxVI_SelectionSpec *selectSet_computeResourceToParentToParent;
|
2010-09-03 23:30:04 +00:00
|
|
|
bool hasQueryVirtualDiskUuid;
|
2010-09-05 14:53:10 +00:00
|
|
|
bool hasSessionIsActive;
|
2009-07-23 20:21:08 +00:00
|
|
|
};
|
|
|
|
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_Context_Alloc(esxVI_Context **ctx);
|
2009-07-23 20:21:08 +00:00
|
|
|
void esxVI_Context_Free(esxVI_Context **ctx);
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_Context_Connect(esxVI_Context *ctx, const char *ipAddress,
|
|
|
|
const char *url, const char *username,
|
2010-07-30 20:08:35 +00:00
|
|
|
const char *password, esxUtil_ParsedUri *parsedUri);
|
2010-07-31 21:57:42 +00:00
|
|
|
int esxVI_Context_LookupObjectsByPath(esxVI_Context *ctx,
|
|
|
|
esxUtil_ParsedUri *parsedUri);
|
|
|
|
int esxVI_Context_LookupObjectsByHostSystemIp(esxVI_Context *ctx,
|
|
|
|
const char *hostSystemIpAddress);
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
|
|
|
|
const char *request, esxVI_Response **response,
|
|
|
|
esxVI_Occurrence occurrence);
|
2009-07-23 20:21:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2009-09-04 16:24:25 +00:00
|
|
|
* Response
|
2009-07-23 20:21:08 +00:00
|
|
|
*/
|
|
|
|
|
2009-09-04 16:24:25 +00:00
|
|
|
struct _esxVI_Response {
|
2009-10-21 18:25:22 +00:00
|
|
|
int responseCode; /* required */
|
2009-09-04 16:24:25 +00:00
|
|
|
char *content; /* required */
|
2009-07-23 20:21:08 +00:00
|
|
|
xmlDocPtr document; /* optional */
|
2009-09-04 16:08:52 +00:00
|
|
|
xmlNodePtr node; /* optional, list */
|
2009-07-23 20:21:08 +00:00
|
|
|
};
|
|
|
|
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_Response_Alloc(esxVI_Response **response);
|
2009-09-04 16:24:25 +00:00
|
|
|
void esxVI_Response_Free(esxVI_Response **response);
|
2009-07-23 20:21:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* Enumeration
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct _esxVI_EnumerationValue {
|
|
|
|
const char *name;
|
|
|
|
int value;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _esxVI_Enumeration {
|
2010-03-06 16:56:28 +00:00
|
|
|
esxVI_Type type;
|
2009-07-23 20:21:08 +00:00
|
|
|
esxVI_EnumerationValue values[10];
|
|
|
|
};
|
|
|
|
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,
|
2009-12-23 03:02:26 +00:00
|
|
|
esxVI_AnyType *anyType, int *value);
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration,
|
2009-07-23 20:21:08 +00:00
|
|
|
int value, const char *element,
|
2010-02-23 00:06:58 +00:00
|
|
|
virBufferPtr output);
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration,
|
2009-07-23 20:21:08 +00:00
|
|
|
xmlNodePtr node, int *value);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* List
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct _esxVI_List {
|
|
|
|
esxVI_List *_next;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef int (*esxVI_List_FreeFunc) (esxVI_List **item);
|
2010-01-15 22:05:26 +00:00
|
|
|
typedef int (*esxVI_List_DeepCopyFunc) (esxVI_List **dest, esxVI_List *src);
|
|
|
|
typedef int (*esxVI_List_CastFromAnyTypeFunc) (esxVI_AnyType *anyType,
|
2009-09-23 12:29:39 +00:00
|
|
|
esxVI_List **item);
|
2010-01-15 22:05:26 +00:00
|
|
|
typedef int (*esxVI_List_SerializeFunc) (esxVI_List *item, const char *element,
|
2010-02-23 00:06:58 +00:00
|
|
|
virBufferPtr output);
|
2010-01-15 22:05:26 +00:00
|
|
|
typedef int (*esxVI_List_DeserializeFunc) (xmlNodePtr node, esxVI_List **item);
|
2009-07-23 20:21:08 +00:00
|
|
|
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_List_Append(esxVI_List **list, esxVI_List *item);
|
|
|
|
int esxVI_List_DeepCopy(esxVI_List **destList, esxVI_List *srcList,
|
2009-07-23 20:21:08 +00:00
|
|
|
esxVI_List_DeepCopyFunc deepCopyFunc,
|
|
|
|
esxVI_List_FreeFunc freeFunc);
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List **list,
|
2009-09-23 12:29:39 +00:00
|
|
|
esxVI_List_CastFromAnyTypeFunc castFromAnyTypeFunc,
|
|
|
|
esxVI_List_FreeFunc freeFunc);
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_List_Serialize(esxVI_List *list, const char *element,
|
2010-02-23 00:06:58 +00:00
|
|
|
virBufferPtr output,
|
2009-07-23 20:21:08 +00:00
|
|
|
esxVI_List_SerializeFunc serializeFunc);
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list,
|
2009-07-23 20:21:08 +00:00
|
|
|
esxVI_List_DeserializeFunc deserializeFunc,
|
|
|
|
esxVI_List_FreeFunc freeFunc);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* Utility and Convenience Functions
|
2009-10-18 19:31:46 +00:00
|
|
|
*
|
|
|
|
* Function naming scheme:
|
|
|
|
* - 'lookup' functions query the ESX or vCenter for information
|
|
|
|
* - 'get' functions get information from a local object
|
2009-07-23 20:21:08 +00:00
|
|
|
*/
|
|
|
|
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_Alloc(void **ptrptr, size_t size);
|
2009-07-23 20:21:08 +00:00
|
|
|
|
2010-08-21 16:49:18 +00:00
|
|
|
int esxVI_BuildSelectSet
|
|
|
|
(esxVI_SelectionSpec **selectSet, const char *name,
|
2010-01-15 22:05:26 +00:00
|
|
|
const char *type, const char *path, const char *selectSetNames);
|
2009-10-18 19:31:46 +00:00
|
|
|
|
2010-08-21 16:49:18 +00:00
|
|
|
int esxVI_BuildSelectSetCollection(esxVI_Context *ctx);
|
2009-07-23 20:21:08 +00:00
|
|
|
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_EnsureSession(esxVI_Context *ctx);
|
2009-07-23 20:21:08 +00:00
|
|
|
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_LookupObjectContentByType(esxVI_Context *ctx,
|
2009-10-18 19:31:46 +00:00
|
|
|
esxVI_ManagedObjectReference *root,
|
|
|
|
const char *type,
|
|
|
|
esxVI_String *propertyNameList,
|
2010-12-30 12:30:44 +00:00
|
|
|
esxVI_ObjectContent **objectContentList,
|
|
|
|
esxVI_Occurrence occurrence);
|
2009-07-23 20:21:08 +00:00
|
|
|
|
2009-09-04 16:03:22 +00:00
|
|
|
int esxVI_GetManagedEntityStatus
|
2010-01-15 22:05:26 +00:00
|
|
|
(esxVI_ObjectContent *objectContent, const char *propertyName,
|
2009-09-04 16:03:22 +00:00
|
|
|
esxVI_ManagedEntityStatus *managedEntityStatus);
|
|
|
|
|
2009-07-23 20:21:08 +00:00
|
|
|
int esxVI_GetVirtualMachinePowerState
|
2010-01-15 22:05:26 +00:00
|
|
|
(esxVI_ObjectContent *virtualMachine,
|
2009-07-23 20:21:08 +00:00
|
|
|
esxVI_VirtualMachinePowerState *powerState);
|
|
|
|
|
2009-11-15 21:22:47 +00:00
|
|
|
int esxVI_GetVirtualMachineQuestionInfo
|
2010-01-15 22:05:26 +00:00
|
|
|
(esxVI_ObjectContent *virtualMachine,
|
2009-11-15 21:22:47 +00:00
|
|
|
esxVI_VirtualMachineQuestionInfo **questionInfo);
|
|
|
|
|
2010-05-18 16:11:59 +00:00
|
|
|
int esxVI_GetBoolean(esxVI_ObjectContent *objectContent,
|
|
|
|
const char *propertyName,
|
2010-12-30 11:54:20 +00:00
|
|
|
esxVI_Boolean *value, esxVI_Occurrence occurrence);
|
2010-05-18 16:11:59 +00:00
|
|
|
|
2010-11-06 17:53:39 +00:00
|
|
|
int esxVI_GetLong(esxVI_ObjectContent *objectContent, const char *propertyName,
|
2010-12-30 11:54:20 +00:00
|
|
|
esxVI_Long **value, esxVI_Occurrence occurrence);
|
2010-11-06 17:53:39 +00:00
|
|
|
|
2010-05-18 16:11:59 +00:00
|
|
|
int esxVI_GetStringValue(esxVI_ObjectContent *objectContent,
|
|
|
|
const char *propertyName,
|
2010-12-30 11:54:20 +00:00
|
|
|
char **value, esxVI_Occurrence occurrence);
|
2010-05-18 16:11:59 +00:00
|
|
|
|
|
|
|
int esxVI_GetManagedObjectReference(esxVI_ObjectContent *objectContent,
|
|
|
|
const char *propertyName,
|
|
|
|
esxVI_ManagedObjectReference **value,
|
2010-12-30 11:54:20 +00:00
|
|
|
esxVI_Occurrence occurrence);
|
2010-05-18 16:11:59 +00:00
|
|
|
|
2009-10-18 19:31:46 +00:00
|
|
|
int esxVI_LookupNumberOfDomainsByPowerState
|
2010-01-15 22:05:26 +00:00
|
|
|
(esxVI_Context *ctx, esxVI_VirtualMachinePowerState powerState,
|
2011-05-01 19:57:45 +00:00
|
|
|
bool inverse);
|
2009-07-23 20:21:08 +00:00
|
|
|
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
|
2009-07-23 20:21:08 +00:00
|
|
|
int *id, char **name, unsigned char *uuid);
|
|
|
|
|
2010-04-07 09:23:53 +00:00
|
|
|
int esxVI_GetNumberOfSnapshotTrees
|
|
|
|
(esxVI_VirtualMachineSnapshotTree *snapshotTreeList);
|
|
|
|
|
|
|
|
int esxVI_GetSnapshotTreeNames
|
|
|
|
(esxVI_VirtualMachineSnapshotTree *snapshotTreeList, char **names,
|
|
|
|
int nameslen);
|
|
|
|
|
|
|
|
int esxVI_GetSnapshotTreeByName
|
|
|
|
(esxVI_VirtualMachineSnapshotTree *snapshotTreeList, const char *name,
|
|
|
|
esxVI_VirtualMachineSnapshotTree **snapshotTree,
|
|
|
|
esxVI_VirtualMachineSnapshotTree **snapshotTreeParent,
|
|
|
|
esxVI_Occurrence occurrence);
|
|
|
|
|
|
|
|
int esxVI_GetSnapshotTreeBySnapshot
|
|
|
|
(esxVI_VirtualMachineSnapshotTree *snapshotTreeList,
|
|
|
|
esxVI_ManagedObjectReference *snapshot,
|
|
|
|
esxVI_VirtualMachineSnapshotTree **snapshotTree);
|
|
|
|
|
2010-07-31 21:57:42 +00:00
|
|
|
int esxVI_LookupHostSystemProperties(esxVI_Context *ctx,
|
|
|
|
esxVI_String *propertyNameList,
|
|
|
|
esxVI_ObjectContent **hostSystem);
|
2009-09-23 12:09:44 +00:00
|
|
|
|
2010-07-31 21:57:42 +00:00
|
|
|
int esxVI_LookupVirtualMachineList(esxVI_Context *ctx,
|
|
|
|
esxVI_String *propertyNameList,
|
|
|
|
esxVI_ObjectContent **virtualMachineList);
|
2009-07-23 20:21:08 +00:00
|
|
|
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx,
|
2009-07-23 20:21:08 +00:00
|
|
|
const unsigned char *uuid,
|
|
|
|
esxVI_String *propertyNameList,
|
2009-09-23 12:40:41 +00:00
|
|
|
esxVI_ObjectContent **virtualMachine,
|
2009-11-22 20:18:45 +00:00
|
|
|
esxVI_Occurrence occurrence);
|
2009-07-23 20:21:08 +00:00
|
|
|
|
2010-03-02 23:57:57 +00:00
|
|
|
int esxVI_LookupVirtualMachineByName(esxVI_Context *ctx, const char *name,
|
|
|
|
esxVI_String *propertyNameList,
|
|
|
|
esxVI_ObjectContent **virtualMachine,
|
|
|
|
esxVI_Occurrence occurrence);
|
|
|
|
|
2009-11-15 21:22:47 +00:00
|
|
|
int esxVI_LookupVirtualMachineByUuidAndPrepareForTask
|
2010-01-15 22:05:26 +00:00
|
|
|
(esxVI_Context *ctx, const unsigned char *uuid,
|
2009-11-15 21:22:47 +00:00
|
|
|
esxVI_String *propertyNameList, esxVI_ObjectContent **virtualMachine,
|
2011-05-01 19:57:44 +00:00
|
|
|
bool autoAnswer);
|
2009-11-15 21:22:47 +00:00
|
|
|
|
2010-07-31 21:57:42 +00:00
|
|
|
int esxVI_LookupDatastoreList(esxVI_Context *ctx, esxVI_String *propertyNameList,
|
|
|
|
esxVI_ObjectContent **datastoreList);
|
|
|
|
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
|
2009-09-23 12:52:36 +00:00
|
|
|
esxVI_String *propertyNameList,
|
|
|
|
esxVI_ObjectContent **datastore,
|
2009-11-22 20:18:45 +00:00
|
|
|
esxVI_Occurrence occurrence);
|
2009-09-23 12:52:36 +00:00
|
|
|
|
2010-08-01 17:53:00 +00:00
|
|
|
int esxVI_LookupDatastoreByAbsolutePath(esxVI_Context *ctx,
|
|
|
|
const char *absolutePath,
|
|
|
|
esxVI_String *propertyNameList,
|
|
|
|
esxVI_ObjectContent **datastore,
|
|
|
|
esxVI_Occurrence occurrence);
|
|
|
|
|
2010-08-01 20:11:38 +00:00
|
|
|
int esxVI_LookupDatastoreHostMount(esxVI_Context *ctx,
|
|
|
|
esxVI_ManagedObjectReference *datastore,
|
|
|
|
esxVI_DatastoreHostMount **hostMount);
|
|
|
|
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_LookupTaskInfoByTask(esxVI_Context *ctx,
|
2009-11-15 21:22:47 +00:00
|
|
|
esxVI_ManagedObjectReference *task,
|
|
|
|
esxVI_TaskInfo **taskInfo);
|
|
|
|
|
|
|
|
int esxVI_LookupPendingTaskInfoListByVirtualMachine
|
2010-01-15 22:05:26 +00:00
|
|
|
(esxVI_Context *ctx, esxVI_ObjectContent *virtualMachine,
|
2009-11-15 21:22:47 +00:00
|
|
|
esxVI_TaskInfo **pendingTaskInfoList);
|
|
|
|
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_LookupAndHandleVirtualMachineQuestion(esxVI_Context *ctx,
|
2009-11-15 21:22:47 +00:00
|
|
|
const unsigned char *uuid,
|
2010-07-25 15:45:19 +00:00
|
|
|
esxVI_Occurrence occurrence,
|
2011-05-01 19:57:45 +00:00
|
|
|
bool autoAnswer, bool *blocked);
|
2009-11-15 21:22:47 +00:00
|
|
|
|
2010-04-07 09:23:53 +00:00
|
|
|
int esxVI_LookupRootSnapshotTreeList
|
|
|
|
(esxVI_Context *ctx, const unsigned char *virtualMachineUuid,
|
|
|
|
esxVI_VirtualMachineSnapshotTree **rootSnapshotTreeList);
|
|
|
|
|
|
|
|
int esxVI_LookupCurrentSnapshotTree
|
|
|
|
(esxVI_Context *ctx, const unsigned char *virtualMachineUuid,
|
|
|
|
esxVI_VirtualMachineSnapshotTree **currentSnapshotTree,
|
|
|
|
esxVI_Occurrence occurrence);
|
|
|
|
|
2010-08-07 22:24:29 +00:00
|
|
|
int esxVI_LookupFileInfoByDatastorePath(esxVI_Context *ctx,
|
|
|
|
const char *datastorePath,
|
2010-08-28 19:49:07 +00:00
|
|
|
bool lookupFolder,
|
2010-08-07 22:24:29 +00:00
|
|
|
esxVI_FileInfo **fileInfo,
|
|
|
|
esxVI_Occurrence occurrence);
|
|
|
|
|
|
|
|
int esxVI_LookupDatastoreContentByDatastoreName
|
|
|
|
(esxVI_Context *ctx, const char *datastoreName,
|
|
|
|
esxVI_HostDatastoreBrowserSearchResults **searchResultsList);
|
|
|
|
|
2010-08-29 17:33:49 +00:00
|
|
|
int esxVI_LookupStorageVolumeKeyByDatastorePath(esxVI_Context *ctx,
|
|
|
|
const char *datastorePath,
|
|
|
|
char **key);
|
|
|
|
|
2010-12-30 00:36:31 +00:00
|
|
|
int esxVI_LookupAutoStartDefaults(esxVI_Context *ctx,
|
|
|
|
esxVI_AutoStartDefaults **defaults);
|
|
|
|
|
|
|
|
int esxVI_LookupAutoStartPowerInfoList(esxVI_Context *ctx,
|
|
|
|
esxVI_AutoStartPowerInfo **powerInfoList);
|
|
|
|
|
2009-11-15 21:22:47 +00:00
|
|
|
int esxVI_HandleVirtualMachineQuestion
|
2011-05-01 19:57:45 +00:00
|
|
|
(esxVI_Context *ctx, esxVI_ManagedObjectReference *virtualMachine,
|
|
|
|
esxVI_VirtualMachineQuestionInfo *questionInfo, bool autoAnswer,
|
|
|
|
bool *blocked);
|
2009-11-15 21:22:47 +00:00
|
|
|
|
2010-01-15 22:05:26 +00:00
|
|
|
int esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
|
2009-07-23 20:21:08 +00:00
|
|
|
esxVI_ManagedObjectReference *task,
|
2009-11-15 21:22:47 +00:00
|
|
|
const unsigned char *virtualMachineUuid,
|
2010-07-25 15:45:19 +00:00
|
|
|
esxVI_Occurrence virtualMachineOccurrence,
|
2011-05-01 19:57:44 +00:00
|
|
|
bool autoAnswer,
|
2010-12-06 12:53:36 +00:00
|
|
|
esxVI_TaskInfoState *finalState,
|
|
|
|
char **errorMessage);
|
2009-07-23 20:21:08 +00:00
|
|
|
|
2010-04-13 22:03:12 +00:00
|
|
|
int esxVI_ParseHostCpuIdInfo(esxVI_ParsedHostCpuIdInfo *parsedHostCpuIdInfo,
|
|
|
|
esxVI_HostCpuIdInfo *hostCpuIdInfo);
|
|
|
|
|
2010-12-21 21:39:55 +00:00
|
|
|
int esxVI_ProductVersionToDefaultVirtualHWVersion(esxVI_ProductVersion productVersion);
|
|
|
|
|
2011-04-10 11:27:56 +00:00
|
|
|
# include "esx_vi.generated.h"
|
|
|
|
|
2009-07-23 20:21:08 +00:00
|
|
|
#endif /* __ESX_VI_H__ */
|