private void processManagementServerList(final List<String> msList, final String lbAlgorithm, final Long lbCheckInterval) { if (CollectionUtils.isNotEmpty(msList) && !Strings.isNullOrEmpty(lbAlgorithm)) { try { final String newMSHosts = String.format("%s%s%s", StringUtils.toCSVList(msList), IAgentShell.hostLbAlgorithmSeparator, lbAlgorithm); _shell.setPersistentProperty(null, "host", newMSHosts); _shell.setHosts(newMSHosts); _shell.resetHostCounter(); s_logger.info("Processed new management server list: " + newMSHosts); } catch (final Exception e) { throw new CloudRuntimeException("Could not persist received management servers list", e); } } if ("shuffle".equals(lbAlgorithm)) { scheduleHostLBCheckerTask(0); } else { scheduleHostLBCheckerTask(_shell.getLbCheckerInterval(lbCheckInterval)); } }
@Test public void testToCSVList() { String input = "one,two,three,four,five,six,seven,eight,nine,ten"; String output = StringUtils.toCSVList(Arrays.asList(input.split(","))); assertTrue(input.equals(output)); } }
buf.append(" host=").append(StringUtils.toCSVList(indirectAgentLB.getManagementServerList(dest.getHost().getId(), dest.getDataCenter().getId(), null))); buf.append(" port=").append(_mgmtPort); buf.append(" name=").append(profile.getVirtualMachine().getHostName());
String parameters = " -m " + StringUtils.toCSVList(indirectAgentLB.getManagementServerList(null, dcId, null)) + " -z " + dcId + " -p " + podId + " -c " + clusterId + " -g " + guid + " -a -s ";