mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
esx: Add vpx:// scheme to allow direct connection to a vCenter
Add a pointer to the primary context of a connection and use it in all driver functions that don't dependent on the context type. This includes almost all functions that deal with a virDomianPtr. Therefore, using a vpx:// connection allows you to perform all the usual domain related actions like start, destroy, suspend, resume, dumpxml etc. Some functions that require an explicitly specified ESX server don't work yet. This includes the host UUID, the hostname, the general node info, the max vCPU count and the free memory. Also not working yet are migration and defining new domains.
This commit is contained in:
parent
1b38e92b7a
commit
3827f7f087
@ -4,13 +4,14 @@
|
||||
<p>
|
||||
The libvirt VMware ESX driver can manage VMware ESX/ESXi 3.5/4.0 and
|
||||
VMware GSX 2.0, also called VMware Server 2.0, and possibly later
|
||||
versions.
|
||||
versions. <span class="since">Since 0.8.3</span> the driver can also
|
||||
connect to a VMware vCenter 2.5/4.0 (VPX).
|
||||
</p>
|
||||
|
||||
|
||||
<h2><a name="prereq">Deployment pre-requisites</a></h2>
|
||||
<p>
|
||||
None. Any out-of-the-box installation of ESX/GSX should work. No
|
||||
None. Any out-of-the-box installation of VPX/ESX(i)/GSX should work. No
|
||||
preparations are required on the server side, no libvirtd must be
|
||||
installed on the ESX server. The driver uses version 2.5 of the remote,
|
||||
SOAP based
|
||||
@ -27,10 +28,11 @@
|
||||
Some example remote connection URIs for the driver are:
|
||||
</p>
|
||||
<pre>
|
||||
esx://example.com (ESX over HTTPS)
|
||||
gsx://example.com (GSX over HTTPS)
|
||||
esx://example.com/?transport=http (ESX over HTTP)
|
||||
esx://example.com/?no_verify=1 (ESX over HTTPS, but doesn't verify the server's SSL certificate)
|
||||
vpx://example-vcenter.com (VPX over HTTPS)
|
||||
esx://example-esx.com (ESX over HTTPS)
|
||||
gsx://example-gsx.com (GSX over HTTPS)
|
||||
esx://example-esx.com/?transport=http (ESX over HTTP)
|
||||
esx://example-esx.com/?no_verify=1 (ESX over HTTPS, but doesn't verify the server's SSL certificate)
|
||||
</pre>
|
||||
<p>
|
||||
<strong>Note</strong>: In contrast to other drivers, the ESX driver is
|
||||
@ -43,24 +45,33 @@ esx://example.com/?no_verify=1 (ESX over HTTPS, but doesn't verify the serve
|
||||
|
||||
<h3><a name="uriformat">URI Format</a></h3>
|
||||
<p>
|
||||
URIs have this general form ('[...]' marks an optional part).
|
||||
URIs have this general form (<code>[...]</code> marks an optional part).
|
||||
</p>
|
||||
<pre>
|
||||
type://[username@]hostname[:port]/[?extraparameters]
|
||||
</pre>
|
||||
<p>
|
||||
The <code>type://</code> is either <code>esx://</code> or
|
||||
<code>gsx://</code> and the driver selects the default port depending
|
||||
on it. For ESX the default HTTPS port is 443, for GSX it is 8333. If
|
||||
the port parameter is given, it overrides the default port.
|
||||
<code>gsx://</code> or <code>vpx://</code> <span class="since">since 0.8.3</span>.
|
||||
The driver selects the default port depending on the <code>type://</code>.
|
||||
For <code>esx://</code> and <code>vpx://</code> the default HTTPS port
|
||||
is 443, for <code>gsx://</code> it is 8333.
|
||||
If the port parameter is given, it overrides the default port.
|
||||
</p>
|
||||
|
||||
|
||||
<h4>Extra parameters</h4>
|
||||
<p>
|
||||
Extra parameters can be added to a URI as part of the query string
|
||||
(the part following '?'). The driver understands the extra parameters
|
||||
shown below.
|
||||
(the part following <code>?</code>). A single parameter is formed by a
|
||||
<code>name=value</code> pair. Multiple parameters are separated by
|
||||
<code>&</code>.
|
||||
</p>
|
||||
<pre>
|
||||
?<span style="color: #E50000">no_verify=1</span>&<span style="color: #00B200">auto_answer=1</span>&<span style="color: #0000E5">proxy=socks://example-proxy.com:23456</span>
|
||||
</pre>
|
||||
<p>
|
||||
The driver understands the extra parameters shown below.
|
||||
</p>
|
||||
<table class="top_table">
|
||||
<tr>
|
||||
@ -76,8 +87,9 @@ type://[username@]hostname[:port]/[?extraparameters]
|
||||
<code>http</code> or <code>https</code>
|
||||
</td>
|
||||
<td>
|
||||
Overrides the default HTTPS transport. For ESX the default
|
||||
HTTP port is 80, for GSX it is 8222.
|
||||
Overrides the default HTTPS transport. For <code>esx://</code>
|
||||
and <code>vpx://</code> the default HTTP port is 80, for
|
||||
<code>gsx://</code> it is 8222.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -91,6 +103,7 @@ type://[username@]hostname[:port]/[?extraparameters]
|
||||
In order to perform a migration the driver needs to know the
|
||||
VMware vCenter for the ESX server. If set to <code>*</code>,
|
||||
the driver connects to the vCenter known to the ESX server.
|
||||
This paramater in useful when connecting to an ESX server only.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -217,7 +230,7 @@ type://[username@]hostname[:port]/[?extraparameters]
|
||||
To define a new domain the driver converts the domain XML into a
|
||||
VMware VMX file and uploads it to a datastore known to the ESX server.
|
||||
Because multiple datastores may be known to an ESX server the driver
|
||||
needs to decide to which datastores the VMX file should be uploaded.
|
||||
needs to decide to which datastore the VMX file should be uploaded.
|
||||
The driver deduces this information from the path of the source of the
|
||||
first file-based harddisk listed in the domain XML.
|
||||
</p>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -33,6 +33,7 @@
|
||||
__LINE__, __VA_ARGS__)
|
||||
|
||||
typedef struct _esxPrivate {
|
||||
esxVI_Context *primary; /* points to host or vCenter */
|
||||
esxVI_Context *host;
|
||||
esxVI_Context *vCenter;
|
||||
virCapsPtr caps;
|
||||
|
@ -74,11 +74,11 @@ esxNumberOfStoragePools(virConnectPtr conn)
|
||||
esxVI_ObjectContent *datastoreList = NULL;
|
||||
esxVI_ObjectContent *datastore = NULL;
|
||||
|
||||
if (esxVI_EnsureSession(priv->host) < 0) {
|
||||
if (esxVI_EnsureSession(priv->primary) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (esxVI_LookupObjectContentByType(priv->host, priv->host->datacenter,
|
||||
if (esxVI_LookupObjectContentByType(priv->primary, priv->primary->datacenter,
|
||||
"Datastore", NULL, esxVI_Boolean_True,
|
||||
&datastoreList) < 0) {
|
||||
return -1;
|
||||
@ -117,13 +117,13 @@ esxListStoragePools(virConnectPtr conn, char **const names, int maxnames)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (esxVI_EnsureSession(priv->host) < 0) {
|
||||
if (esxVI_EnsureSession(priv->primary) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (esxVI_String_AppendValueToList(&propertyNameList,
|
||||
"summary.name") < 0 ||
|
||||
esxVI_LookupObjectContentByType(priv->host, priv->host->datacenter,
|
||||
esxVI_LookupObjectContentByType(priv->primary, priv->primary->datacenter,
|
||||
"Datastore", propertyNameList,
|
||||
esxVI_Boolean_True,
|
||||
&datastoreList) < 0) {
|
||||
@ -209,7 +209,7 @@ esxStoragePoolLookupByName(virConnectPtr conn, const char *name)
|
||||
char *realName = NULL;
|
||||
virStoragePoolPtr pool = NULL;
|
||||
|
||||
if (esxVI_EnsureSession(priv->host) < 0) {
|
||||
if (esxVI_EnsureSession(priv->primary) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ esxStoragePoolLookupByName(virConnectPtr conn, const char *name)
|
||||
"summary.accessible\0"
|
||||
"summary.name\0"
|
||||
"summary.url\0") < 0 ||
|
||||
esxVI_LookupDatastoreByName(priv->host, name,
|
||||
esxVI_LookupDatastoreByName(priv->primary, name,
|
||||
propertyNameList, &datastore,
|
||||
esxVI_Occurrence_RequiredItem) < 0 ||
|
||||
esxVI_GetBoolean(datastore, "summary.accessible",
|
||||
@ -242,7 +242,8 @@ esxStoragePoolLookupByName(virConnectPtr conn, const char *name)
|
||||
*
|
||||
* The 'summary.url' property of an inaccessible datastore is invalid.
|
||||
*/
|
||||
if (accessible == esxVI_Boolean_True &&
|
||||
/* FIXME: Need to handle this for a vpx:// connection */
|
||||
if (accessible == esxVI_Boolean_True && priv->host != NULL &&
|
||||
priv->host->productVersion & esxVI_ProductVersion_ESX) {
|
||||
if (esxVI_GetStringValue(datastore, "summary.url", &summaryUrl,
|
||||
esxVI_Occurrence_RequiredItem) < 0) {
|
||||
@ -307,7 +308,9 @@ esxStoragePoolLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
|
||||
char *name = NULL;
|
||||
virStoragePoolPtr pool = NULL;
|
||||
|
||||
if (! (priv->host->productVersion & esxVI_ProductVersion_ESX)) {
|
||||
/* FIXME: Need to handle this for a vpx:// connection */
|
||||
if (priv->host == NULL ||
|
||||
! (priv->host->productVersion & esxVI_ProductVersion_ESX)) {
|
||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Lookup by UUID is supported on ESX only"));
|
||||
return NULL;
|
||||
@ -389,13 +392,13 @@ esxStoragePoolRefresh(virStoragePoolPtr pool, unsigned int flags)
|
||||
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
if (esxVI_EnsureSession(priv->host) < 0) {
|
||||
if (esxVI_EnsureSession(priv->primary) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (esxVI_LookupDatastoreByName(priv->host, pool->name, NULL, &datastore,
|
||||
if (esxVI_LookupDatastoreByName(priv->primary, pool->name, NULL, &datastore,
|
||||
esxVI_Occurrence_RequiredItem) < 0 ||
|
||||
esxVI_RefreshDatastore(priv->host, datastore->obj) < 0) {
|
||||
esxVI_RefreshDatastore(priv->primary, datastore->obj) < 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -421,7 +424,7 @@ esxStoragePoolGetInfo(virStoragePoolPtr pool, virStoragePoolInfoPtr info)
|
||||
|
||||
memset(info, 0, sizeof (*info));
|
||||
|
||||
if (esxVI_EnsureSession(priv->host) < 0) {
|
||||
if (esxVI_EnsureSession(priv->primary) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -429,7 +432,7 @@ esxStoragePoolGetInfo(virStoragePoolPtr pool, virStoragePoolInfoPtr info)
|
||||
"summary.accessible\0"
|
||||
"summary.capacity\0"
|
||||
"summary.freeSpace\0") < 0 ||
|
||||
esxVI_LookupDatastoreByName(priv->host, pool->name,
|
||||
esxVI_LookupDatastoreByName(priv->primary, pool->name,
|
||||
propertyNameList, &datastore,
|
||||
esxVI_Occurrence_RequiredItem) < 0 ||
|
||||
esxVI_GetBoolean(datastore, "summary.accessible",
|
||||
@ -494,7 +497,7 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
|
||||
|
||||
memset(&def, 0, sizeof (def));
|
||||
|
||||
if (esxVI_EnsureSession(priv->host) < 0) {
|
||||
if (esxVI_EnsureSession(priv->primary) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -503,7 +506,7 @@ esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
|
||||
"summary.capacity\0"
|
||||
"summary.freeSpace\0"
|
||||
"info\0") < 0 ||
|
||||
esxVI_LookupDatastoreByName(priv->host, pool->name,
|
||||
esxVI_LookupDatastoreByName(priv->primary, pool->name,
|
||||
propertyNameList, &datastore,
|
||||
esxVI_Occurrence_RequiredItem) < 0 ||
|
||||
esxVI_GetBoolean(datastore, "summary.accessible",
|
||||
|
@ -1188,6 +1188,7 @@ esxVMX_ParseConfig(esxVI_Context *ctx, virCapsPtr caps, const char *vmx,
|
||||
*/
|
||||
switch (productVersion) {
|
||||
case esxVI_ProductVersion_ESX35:
|
||||
case esxVI_ProductVersion_VPX25:
|
||||
if (virtualHW_version != 4) {
|
||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Expecting VMX entry 'virtualHW.version' to be 4 "
|
||||
@ -1200,6 +1201,7 @@ esxVMX_ParseConfig(esxVI_Context *ctx, virCapsPtr caps, const char *vmx,
|
||||
|
||||
case esxVI_ProductVersion_GSX20:
|
||||
case esxVI_ProductVersion_ESX40:
|
||||
case esxVI_ProductVersion_VPX40:
|
||||
if (virtualHW_version != 4 && virtualHW_version != 7) {
|
||||
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Expecting VMX entry 'virtualHW.version' to be 4 or 7 "
|
||||
|
@ -1224,6 +1224,7 @@ do_open (const char *name,
|
||||
STRCASEEQ(ret->uri->scheme, "phyp") ||
|
||||
#endif
|
||||
#ifndef WITH_ESX
|
||||
STRCASEEQ(ret->uri->scheme, "vpx") ||
|
||||
STRCASEEQ(ret->uri->scheme, "esx") ||
|
||||
STRCASEEQ(ret->uri->scheme, "gsx") ||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user