nvazquez commented on code in PR #9925:
URL: https://github.com/apache/cloudstack/pull/9925#discussion_r1895624907


##########
plugins/hypervisors/vmware/src/main/java/org/apache/cloudstack/api/command/admin/zone/VmwarRequestReponse.java:
##########
@@ -0,0 +1,33 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.admin.zone;
+
+import org.apache.cloudstack.api.ResponseObject;
+import org.apache.cloudstack.api.response.ListResponse;
+
+public class VmwarRequestReponse <T extends ResponseObject> extends 
ListResponse<T> {

Review Comment:
   Typo on the class name



##########
vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/DatacenterMO.java:
##########
@@ -65,24 +71,7 @@ public DatacenterMO(VmwareContext context, String dcName) 
throws Exception {
 
     @Override
     public String getName() throws Exception {
-        return (String)_context.getVimClient().getDynamicProperty(_mor, 
"name");
-    }
-
-    public void registerTemplate(ManagedObjectReference morHost, String 
datastoreName, String templateName, String templateFileName) throws Exception {

Review Comment:
   Were these removed methods unused?



##########
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java:
##########
@@ -459,7 +466,7 @@ private void prepareHost(HostMO hostMo, String 
privateTrafficLabel) throws Excep
             AboutInfo about = hostMo.getHostAboutInfo();
             if (about != null) {
                 String version = about.getApiVersion();
-                if (version != null && (version.equals("4.0") || 
version.equals("4.1")) && _portsPerDvPortGroup < 
DEFAULT_PORTS_PER_DV_PORT_GROUP_VSPHERE4_x) {
+                if (version != null && (version.equals("4.0") || 
version.equals("4.1")) ) { // && _portsPerDvPortGroup < 
DEFAULT_PORTS_PER_DV_PORT_GROUP_VSPHERE4_x)

Review Comment:
   Why commenting out this condition?



##########
vmware-base/src/main/java/com/cloud/hypervisor/vmware/mo/DatacenterMO.java:
##########
@@ -338,10 +341,22 @@ public List<ObjectContent> 
getVmPropertiesOnDatacenterVmFolder(String[] property
         PropertyFilterSpec pfSpec = new PropertyFilterSpec();
         pfSpec.getPropSet().add(pSpec);
         pfSpec.getObjectSet().add(oSpec);
-        List<PropertyFilterSpec> pfSpecArr = new 
ArrayList<PropertyFilterSpec>();
+        List<PropertyFilterSpec> pfSpecArr = new ArrayList<>();
         pfSpecArr.add(pfSpec);
 
-        return 
_context.getService().retrieveProperties(_context.getPropertyCollector(), 
pfSpecArr);
+        RetrieveOptions ro = new RetrieveOptions();
+        if (maxObjects != null && maxObjects > 0) {
+            ro.setMaxObjects(maxObjects);
+        }
+
+        RetrieveResult result = 
_context.getService().retrievePropertiesEx(_context.getPropertyCollector(), 
pfSpecArr, ro);
+        return createReturnObjectPair(result);
+    }
+
+    private static Pair<String, List<ObjectContent>> 
createReturnObjectPair(RetrieveResult result) {
+        String tokenForRetrievingNewResults = result.getToken();

Review Comment:
   Nice solution, can we also add to the javadocs the meaning of this token 
regarding Vmware SDK? (maybe also a link to the SDK docs): `the token returned 
in the previous RetrieveResult returned on the same session by the same 
PropertyCollector.` 
(https://vdc-download.vmware.com/vmwb-repository/dcr-public/4fcedce4-0e06-49cc-bb39-38732c40995d/c087e649-192b-416c-9aa1-dcbb75e74d17/vmodl.query.PropertyCollector.html
 - maybe this is not the latest URL)



##########
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java:
##########
@@ -984,40 +984,15 @@ public void processHostAdded(long hostId) {
 
     @Override
     public void processConnect(Host host, StartupCommand cmd, boolean 
forRebalance) {
-        if (cmd instanceof StartupCommand) {
+        if (cmd != null) {
             if (host.getHypervisorType() == HypervisorType.VMware) {
                 updateClusterNativeHAState(host, cmd);
-            } else {
-                return;
             }
         }
     }
 
     protected final static int DEFAULT_DOMR_SSHPORT = 3922;
 
-    protected boolean shutdownRouterVM(DomainRouterVO router) {

Review Comment:
   No need for this method anymore?



##########
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java:
##########
@@ -498,31 +505,26 @@ public List<ManagedObjectReference> 
addHostToPodCluster(VmwareContext serviceCon
             throw new CloudRuntimeException("Invalid serviceContext");
         }
         ManagedObjectReference mor = 
serviceContext.getHostMorByPath(hostInventoryPath);
-        String privateTrafficLabel = null;
+        String privateTrafficLabel;
         privateTrafficLabel = 
serviceContext.getStockObject("privateTrafficLabel");
         if (privateTrafficLabel == null) {
             privateTrafficLabel = _privateNetworkVSwitchName;
         }
 
         if (mor != null) {
-            List<ManagedObjectReference> returnedHostList = new 
ArrayList<ManagedObjectReference>();
+            List<ManagedObjectReference> returnedHostList = new ArrayList<>();
 
             if (mor.getType().equals("ComputeResource")) {
                 List<ManagedObjectReference> hosts = 
serviceContext.getVimClient().getDynamicProperty(mor, "host");
-                assert (hosts != null && hosts.size() > 0);
-
-                // For ESX host, we need to enable host firewall to allow VNC 
access
-                HostMO hostMo = new HostMO(serviceContext, hosts.get(0));

Review Comment:
   Why are these lines removed?



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to