private boolean isNotHAManagementSpace() throws IOException, DSLException { if (cloudFileName != null && !cloudFileName.trim().isEmpty()) { File cloudFile = new File(cloudFileName); final Cloud cloud = ServiceReader.readCloud(cloudFile); if (cloud != null) { if (cloud.getProvider() != null) { final int numberOfManagementMachines = cloud.getProvider().getNumberOfManagementMachines(); return numberOfManagementMachines < 2; } } } return true; }
private MachineDetails[] locateManagementMachines() throws CLIStatusException { if (provisioning instanceof ManagementLocator) { final ManagementLocator locator = (ManagementLocator) provisioning; MachineDetails[] mds; try { mds = locator.getExistingManagementServers(); } catch (final CloudProvisioningException e) { throw new CLIStatusException( e, CloudifyErrorMessages.MANAGEMENT_SERVERS_FAILED_TO_READ.getName(), e.getMessage()); } if (mds.length == 0) { throw new CLIStatusException( CloudifyErrorMessages.MANAGEMENT_SERVERS_NOT_LOCATED.getName()); } if (mds.length != this.cloud.getProvider().getNumberOfManagementMachines()) { throw new CLIStatusException( CloudifyErrorMessages.MANAGEMENT_SERVERS_NUMBER_NOT_MATCH.getName(), cloud.getProvider().getNumberOfManagementMachines(), mds.length); } return mds; } else { throw new CLIStatusException( CloudifyErrorMessages.MANAGEMENT_LOCATOR_NOT_SUPPORTED.getName(), this.cloud.getName()); } }
private MachineDetails[] startManagememntProcesses( final MachineDetails[] machines, final String securityProfile, final String keystorePassword, final long endTime) throws InterruptedException, TimeoutException, InstallerException, IOException { final AgentlessInstaller installer = new AgentlessInstaller(); installer.addListener(new CliAgentlessInstallerListener(this.verbose)); // Update the logging level of jsch used by the AgentlessInstaller Logger.getLogger(AgentlessInstaller.SSH_LOGGER_NAME) .setLevel(Level.parse(cloud.getProvider().getSshLoggingLevel())); final ComputeTemplate template = cloud .getCloudCompute() .getTemplates() .get(cloud.getConfiguration().getManagementMachineTemplate()); // fixConfigRelativePaths(cloud, template); final int numOfManagementMachines = machines.length; final InstallationDetails[] installations = createInstallationDetails( numOfManagementMachines, machines, template, securityProfile, keystorePassword); // only one machine should try and deploy the WebUI and Rest Admin unless // noWebServices is true int i = isNoWebServices() ? 0 : 1; for (; i < installations.length; i++) { installations[i].setNoWebServices(true); } final String lookup = createLocatorsString(installations); for (final InstallationDetails detail : installations) { detail.setLocator(lookup); } // executes the agentless installer on all of the machines, // asynchronously installOnMachines(endTime, installer, numOfManagementMachines, installations); return machines; }
private MachineDetails[] locateManagementMachinesFromFile() throws CLIStatusException { if (provisioning instanceof ManagementLocator) { ObjectMapper mapper = new ObjectMapper(); ControllerDetails[] controllers = null; try { controllers = mapper.readValue( this.existingManagersFile, TypeFactory.arrayType(ControllerDetails.class)); } catch (IOException e) { throw new IllegalArgumentException( "Failed to read managers file: " + this.existingManagersFile.getAbsolutePath() + ". Error was: " + e.getMessage(), e); } final ManagementLocator locator = (ManagementLocator) provisioning; MachineDetails[] mds; try { mds = locator.getExistingManagementServers(controllers); } catch (final CloudProvisioningException e) { throw new CLIStatusException( e, CloudifyErrorMessages.MANAGEMENT_SERVERS_FAILED_TO_READ.getName(), e.getMessage()); } if (mds.length == 0) { throw new CLIStatusException( CloudifyErrorMessages.MANAGEMENT_SERVERS_NOT_LOCATED.getName()); } if (mds.length != this.cloud.getProvider().getNumberOfManagementMachines()) { throw new CLIStatusException( CloudifyErrorMessages.MANAGEMENT_SERVERS_NUMBER_NOT_MATCH.getName(), cloud.getProvider().getNumberOfManagementMachines(), mds.length); } return mds; } else { throw new CLIStatusException( CloudifyErrorMessages.MANAGEMENT_LOCATOR_NOT_SUPPORTED.getName(), this.cloud.getName()); } }