Source:
<code>protected void executeCommand() { if (getVds() == null) { return; } log.info("Before Installation host {}, {}", getVds().getId(), getVds().getName()); try { setVdsStatus(VDSStatus.Installing); if (getParameters().getAuthMethod() == AuthenticationMethod.Password) { copyEngineSshId(); } runAnsibleHostDeployPlaybook(); if(getVds().getClusterSupportsGlusterService() && <START> (vdsDao.getAllForCluster(getClusterId()).size() <END> >= 3)) { runAnsibleReconfigureGluster(); } else { if(!getVds().getClusterSupportsGlusterService()) { log.info("Skipping Reconfigure gluster since cluster does not support gluster"); } else if(vdsDao.getAllForCluster(getClusterId()).size()<3) { log.info("Skipping Reconfigure gluster since minimum of three hosts are required in the same cluster"); } } markCurrentCmdlineAsStored(); markVdsReinstalled(); configureManagementNetwork(); if (!getParameters().getActivateHost()) { setVdsStatus(VDSStatus.Maintenance); } else { setVdsStatus(VDSStatus.Initializing); } log.info("After Installation host {}, {}", getVds().getName(), getVds().getVdsType().name()); setSucceeded(true); } catch (VdsInstallException e) { handleError(e, e.getStatus()); } catch (Exception e) { handleError(e, VDSStatus.InstallFailed); } }</code><technical_language>fetch vdsDao.getAllForCluster(getClusterId()) fetch in runAnsibleReconfigureGluster() (line 304) save a local variable save call. Also, rely host 1 host 2, pass method runAnsibleReconfigureGluster(firstGlusterClusterNode, secondGlusterClusterNode)</technical_language>

Target:
protected void executeCommand() { if (getVds() == null) { return; } log.info("Before Installation host {}, {}", getVds().getId(), getVds().getName()); try { setVdsStatus(VDSStatus.Installing); if (getParameters().getAuthMethod() == AuthenticationMethod.Password) { copyEngineSshId(); } runAnsibleHostDeployPlaybook(); List<VDS> hostlist = vdsDao.getAllForCluster(getClusterId()); if(getVds().getClusterSupportsGlusterService() && (hostlist.size()) >= 3) { String oldGlusterClusterNode = getVds().getName(); String firstGlusterClusterNode = null; String secondGlusterClusterNode = null; VDS vds = getVds(); hostlist.removeIf(hostname -> hostname.getHostName().equals(vds.getHostName())); firstGlusterClusterNode = hostlist.get(0).getName(); secondGlusterClusterNode = hostlist.get(1).getName(); VDS maintanceVds = hostlist.get(0); runAnsibleReconfigureGluster(oldGlusterClusterNode, firstGlusterClusterNode, secondGlusterClusterNode, maintanceVds); } else { if(!getVds().getClusterSupportsGlusterService()) { log.info("Skipping Reconfigure gluster since cluster does not support gluster"); } else if(vdsDao.getAllForCluster(getClusterId()).size()<3) { log.info("Skipping Reconfigure gluster since minimum of three hosts are required in the same cluster"); } } markCurrentCmdlineAsStored(); markVdsReinstalled(); configureManagementNetwork(); if (!getParameters().getActivateHost()) { setVdsStatus(VDSStatus.Maintenance); } else { setVdsStatus(VDSStatus.Initializing); } log.info("After Installation host {}, {}", getVds().getName(), getVds().getVdsType().name()); setSucceeded(true); } catch (VdsInstallException e) { handleError(e, e.getStatus()); } catch (Exception e) { handleError(e, VDSStatus.InstallFailed); } }