sureshanaparti commented on a change in pull request #4385:
URL: https://github.com/apache/cloudstack/pull/4385#discussion_r528885775



##########
File path: 
vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
##########
@@ -2207,4 +2207,36 @@ public static void 
createBaseFolderInDatastore(DatastoreMO dsMo, VmwareHyperviso
             dsMo.makeDirectory(hiddenFolderPath, 
hyperHost.getHyperHostDatacenter());
         }
     }
+
+    public static Integer getHostHardwareVersion(VmwareHypervisorHost host) {
+        Integer version = null;
+        HostMO hostMo = new HostMO(host.getContext(), host.getMor());
+        String hostApiVersion = "";
+        try {
+            hostApiVersion = hostMo.getHostAboutInfo().getApiVersion();
+        } catch (Exception ignored) {}
+        if (hostApiVersion == null) {
+            hostApiVersion = "";
+        }
+        if (hostApiVersion.equalsIgnoreCase("7.0")) {
+            version = 17;
+        } else if (hostApiVersion.equalsIgnoreCase("6.7")) {
+            version = 14;
+        } else if (hostApiVersion.equalsIgnoreCase("6.5")) {
+            version = 13;
+        } else if (hostApiVersion.equalsIgnoreCase("6.0")) {
+            version = 11;
+        } else if (hostApiVersion.equalsIgnoreCase("5.5")) {
+            version = 10;
+        } else if (hostApiVersion.equalsIgnoreCase("5.1")) {
+            version = 9;
+        } else if (hostApiVersion.equalsIgnoreCase("5.0")) {
+            version = 8;
+        } else if (hostApiVersion.startsWith("4.")) {
+            version = 7;
+        } else if (hostApiVersion.equalsIgnoreCase("3.5")) {
+            version = 4;
+        }
+        return version;

Review comment:
       @shwstppr is it possible move this to a static map with hypervisor 
version & its hardware version, in VMware helper class ? so that it will be 
easy to maintain and access these versions across the VMware resource. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to