[PATCH] esx: Support vSphere 4.1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Also accept version > 4.1, but output a warning.
---
 src/esx/esx_driver.c |   12 ++++++++----
 src/esx/esx_vi.c     |   27 ++++++++++++++++++++++++---
 src/esx/esx_vi.h     |   10 ++++++++--
 src/esx/esx_vmx.c    |    9 +++++++++
 4 files changed, 49 insertions(+), 9 deletions(-)

diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 5922cb6..e33976c 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -353,9 +353,11 @@ esxConnectToHost(esxPrivate *priv, virConnectAuthPtr auth,
 
     if (expectedProductVersion == esxVI_ProductVersion_ESX) {
         if (priv->host->productVersion != esxVI_ProductVersion_ESX35 &&
-            priv->host->productVersion != esxVI_ProductVersion_ESX40) {
+            priv->host->productVersion != esxVI_ProductVersion_ESX40 &&
+            priv->host->productVersion != esxVI_ProductVersion_ESX41 &&
+            priv->host->productVersion != esxVI_ProductVersion_ESX4x) {
             ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
-                      _("%s is neither an ESX 3.5 host nor an ESX 4.0 host"),
+                      _("%s is neither an ESX 3.5 host nor an ESX 4.x host"),
                       hostname);
             goto cleanup;
         }
@@ -462,10 +464,12 @@ esxConnectToVCenter(esxPrivate *priv, virConnectAuthPtr auth,
     }
 
     if (priv->vCenter->productVersion != esxVI_ProductVersion_VPX25 &&
-        priv->vCenter->productVersion != esxVI_ProductVersion_VPX40) {
+        priv->vCenter->productVersion != esxVI_ProductVersion_VPX40 &&
+        priv->vCenter->productVersion != esxVI_ProductVersion_VPX41 &&
+        priv->vCenter->productVersion != esxVI_ProductVersion_VPX4x) {
         ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   _("%s is neither a vCenter 2.5 server nor a vCenter "
-                    "4.0 server"), hostname);
+                    "4.x server"), hostname);
         goto cleanup;
     }
 
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 8c43d67..69ba7a9 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -378,9 +378,16 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
             ctx->apiVersion = esxVI_APIVersion_25;
         } else if (STRPREFIX(ctx->service->about->apiVersion, "4.0")) {
             ctx->apiVersion = esxVI_APIVersion_40;
+        } else if (STRPREFIX(ctx->service->about->apiVersion, "4.1")) {
+            ctx->apiVersion = esxVI_APIVersion_41;
+        } else if (STRPREFIX(ctx->service->about->apiVersion, "4.")) {
+            ctx->apiVersion = esxVI_APIVersion_4x;
+
+            VIR_WARN("Found untested VI API major/minor version '%s'",
+                     ctx->service->about->apiVersion);
         } else {
             ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
-                         _("Expecting VI API major/minor version '2.5' or '4.0' "
+                         _("Expecting VI API major/minor version '2.5' or '4.x' "
                            "but found '%s'"), ctx->service->about->apiVersion);
             goto cleanup;
         }
@@ -400,10 +407,17 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
                 ctx->productVersion = esxVI_ProductVersion_ESX35;
             } else if (STRPREFIX(ctx->service->about->version, "4.0")) {
                 ctx->productVersion = esxVI_ProductVersion_ESX40;
+            } else if (STRPREFIX(ctx->service->about->version, "4.1")) {
+                ctx->productVersion = esxVI_ProductVersion_ESX41;
+            } else if (STRPREFIX(ctx->service->about->version, "4.")) {
+                ctx->productVersion = esxVI_ProductVersion_ESX4x;
+
+                VIR_WARN("Found untested ESX major/minor version '%s'",
+                         ctx->service->about->version);
             } else {
                 ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                              _("Expecting ESX major/minor version '3.5' or "
-                               "'4.0' but found '%s'"),
+                               "'4.x' but found '%s'"),
                              ctx->service->about->version);
                 goto cleanup;
             }
@@ -412,9 +426,16 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
                 ctx->productVersion = esxVI_ProductVersion_VPX25;
             } else if (STRPREFIX(ctx->service->about->version, "4.0")) {
                 ctx->productVersion = esxVI_ProductVersion_VPX40;
+            } else if (STRPREFIX(ctx->service->about->version, "4.1")) {
+                ctx->productVersion = esxVI_ProductVersion_VPX41;
+            } else if (STRPREFIX(ctx->service->about->version, "4.")) {
+                ctx->productVersion = esxVI_ProductVersion_VPX4x;
+
+                VIR_WARN("Found untested VPX major/minor version '%s'",
+                         ctx->service->about->version);
             } else {
                 ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
-                             _("Expecting VPX major/minor version '2.5' or '4.0' "
+                             _("Expecting VPX major/minor version '2.5' or '4.x' "
                                "but found '%s'"), ctx->service->about->version);
                 goto cleanup;
             }
diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h
index f5e89e9..9eb5094 100644
--- a/src/esx/esx_vi.h
+++ b/src/esx/esx_vi.h
@@ -94,7 +94,9 @@ enum _esxVI_APIVersion {
     esxVI_APIVersion_Undefined = 0,
     esxVI_APIVersion_Unknown,
     esxVI_APIVersion_25,
-    esxVI_APIVersion_40
+    esxVI_APIVersion_40,
+    esxVI_APIVersion_41,
+    esxVI_APIVersion_4x /* > 4.1 */
 };
 
 /*
@@ -110,10 +112,14 @@ enum _esxVI_ProductVersion {
     esxVI_ProductVersion_ESX   = (1 << 1) << 16,
     esxVI_ProductVersion_ESX35 = esxVI_ProductVersion_ESX | 1,
     esxVI_ProductVersion_ESX40 = esxVI_ProductVersion_ESX | 2,
+    esxVI_ProductVersion_ESX41 = esxVI_ProductVersion_ESX | 3,
+    esxVI_ProductVersion_ESX4x = esxVI_ProductVersion_ESX | 4, /* > 4.1 */
 
     esxVI_ProductVersion_VPX   = (1 << 2) << 16,
     esxVI_ProductVersion_VPX25 = esxVI_ProductVersion_VPX | 1,
-    esxVI_ProductVersion_VPX40 = esxVI_ProductVersion_VPX | 2
+    esxVI_ProductVersion_VPX40 = esxVI_ProductVersion_VPX | 2,
+    esxVI_ProductVersion_VPX41 = esxVI_ProductVersion_VPX | 3,
+    esxVI_ProductVersion_VPX4x = esxVI_ProductVersion_VPX | 4  /* > 4.1 */
 };
 
 enum _esxVI_Occurrence {
diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
index e075149..c63b159 100644
--- a/src/esx/esx_vmx.c
+++ b/src/esx/esx_vmx.c
@@ -1184,6 +1184,7 @@ esxVMX_ParseConfig(esxVI_Context *ctx, virCapsPtr caps, const char *vmx,
      *              4 7    API
      *   ESX 3.5    +      2.5
      *   ESX 4.0    + +    4.0
+     *   ESX 4.1    + +    4.1
      *   GSX 2.0    + +    2.5
      */
     switch (productVersion) {
@@ -1201,7 +1202,9 @@ esxVMX_ParseConfig(esxVI_Context *ctx, virCapsPtr caps, const char *vmx,
 
       case esxVI_ProductVersion_GSX20:
       case esxVI_ProductVersion_ESX40:
+      case esxVI_ProductVersion_ESX41:
       case esxVI_ProductVersion_VPX40:
+      case esxVI_ProductVersion_VPX41:
         if (virtualHW_version != 4 && virtualHW_version != 7) {
             ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       _("Expecting VMX entry 'virtualHW.version' to be 4 or 7 "
@@ -1212,6 +1215,10 @@ esxVMX_ParseConfig(esxVI_Context *ctx, virCapsPtr caps, const char *vmx,
 
         break;
 
+      case esxVI_ProductVersion_ESX4x:
+      case esxVI_ProductVersion_VPX4x:
+        break;
+
       default:
         ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
                   _("Unexpected product version"));
@@ -2702,6 +2709,8 @@ esxVMX_FormatConfig(esxVI_Context *ctx, virCapsPtr caps, virDomainDefPtr def,
 
       case esxVI_ProductVersion_GSX20:
       case esxVI_ProductVersion_ESX40:
+      case esxVI_ProductVersion_ESX41:
+      case esxVI_ProductVersion_ESX4x:
         virBufferAddLit(&buffer, "virtualHW.version = \"7\"\n");
         break;
 
-- 
1.7.0.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]