You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/11/10 10:40:46 UTC

[GitHub] [cloudstack] rhtyd commented on a change in pull request #4385: [WIP] vmware: vm migration improvements

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



##########
File path: vmware-base/src/main/java/com/cloud/hypervisor/vmware/util/VmwareHelper.java
##########
@@ -744,4 +744,18 @@ public static XMLGregorianCalendar getXMLGregorianCalendar(final Date date, fina
         return DatatypeFactory.newInstance().newXMLGregorianCalendar(gregorianCalendar);
     }
 
+    public static HostMO getHostMOFromHostName(final VmwareContext context, final String hostName) {
+        HostMO host = null;
+        if (com.cloud.utils.StringUtils.isNotBlank(hostName) && hostName.contains("@")) {
+            String hostMorInfo = hostName.split("@")[0];
+            if (hostMorInfo.contains(":")) {
+                ManagedObjectReference morHost = new ManagedObjectReference();
+                morHost.setType(hostMorInfo.split(":")[0]);
+                morHost.setValue(hostMorInfo.split(":")[1]);
+                host = new HostMO(context, morHost);

Review comment:
       check that split has two length




----------------------------------------------------------------
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:
users@infra.apache.org