Search in sources :

Example 1 with OsInstallParam

use of com.emc.storageos.model.compute.OsInstallParam in project coprhd-controller by CoprHD.

the class AddHostToClusterService method installOSForHosts.

private void installOSForHosts(Map<String, String> hostToIps, Map<String, URI> hostNameToBootVolumeMap, List<Host> createdHosts) {
    Map<Host, OsInstallParam> osInstallParamMap = new HashMap<Host, OsInstallParam>();
    for (Host host : createdHosts) {
        if ((host != null) && ((host.getType() == null) || host.getType().isEmpty() || host.getType().equals(Host.HostType.No_OS.name()))) {
            OsInstallParam param = new OsInstallParam();
            String hostIp = hostToIps.get(host.getHostName());
            param.setComputeImage(computeImage);
            param.setHostName(host.getHostName());
            param.setDnsServers(dnsServers);
            param.setGateway(gateway);
            param.setNetmask(netmask);
            param.setHostIp(hostIp);
            param.setVolume(hostNameToBootVolumeMap.get(host.getHostName()));
            param.setManagementNetwork(managementNetwork);
            param.setNtpServer(ntpServer);
            param.setRootPassword(rootPassword);
            osInstallParamMap.put(host, param);
        } else {
            osInstallParamMap.put(host, null);
        }
    }
    try {
        // Attempt an OS Install only on the list of hosts that are a part of the order
        // This does check if the hosts already have a OS before attempting the install
        ComputeUtils.installOsOnHosts(osInstallParamMap);
    } catch (Exception e) {
        logError(e.getMessage());
    }
}
Also used : HashMap(java.util.HashMap) Host(com.emc.storageos.db.client.model.Host) OsInstallParam(com.emc.storageos.model.compute.OsInstallParam) ExecutionException(com.emc.sa.engine.ExecutionException)

Example 2 with OsInstallParam

use of com.emc.storageos.model.compute.OsInstallParam in project coprhd-controller by CoprHD.

the class CreateComputeClusterService method installOSForHosts.

private void installOSForHosts(Map<String, String> hostToIps, Map<String, URI> hostNameToBootVolumeMap, List<Host> createdHosts) {
    Map<Host, OsInstallParam> osInstallParamMap = new HashMap<Host, OsInstallParam>();
    for (Host host : createdHosts) {
        if ((host != null) && ((host.getType() == null) || host.getType().isEmpty() || host.getType().equals(Host.HostType.No_OS.name()))) {
            OsInstallParam param = new OsInstallParam();
            String hostIp = hostToIps.get(host.getHostName());
            param.setComputeImage(computeImage);
            param.setHostName(host.getHostName());
            param.setDnsServers(dnsServers);
            param.setGateway(gateway);
            param.setNetmask(netmask);
            param.setHostIp(hostIp);
            param.setVolume(hostNameToBootVolumeMap.get(host.getHostName()));
            param.setManagementNetwork(managementNetwork);
            param.setNtpServer(ntpServer);
            param.setRootPassword(rootPassword);
            osInstallParamMap.put(host, param);
        } else {
            osInstallParamMap.put(host, null);
        }
    }
    try {
        ComputeUtils.installOsOnHosts(osInstallParamMap);
    } catch (Exception e) {
        logError(e.getMessage());
    }
}
Also used : HashMap(java.util.HashMap) Host(com.emc.storageos.db.client.model.Host) OsInstallParam(com.emc.storageos.model.compute.OsInstallParam)

Example 3 with OsInstallParam

use of com.emc.storageos.model.compute.OsInstallParam in project coprhd-controller by CoprHD.

the class InstallOsHelper method installOs.

public void installOs() {
    ExecutionContext context = ExecutionUtils.currentContext();
    List<ViPRTaskMonitor<HostRestRep>> tasks = new ArrayList<>();
    for (HostRestRep host : hostToOsInstall.keySet()) {
        OsInstallParam osInstall = hostToOsInstall.get(host);
        if (osInstall != null) {
            try {
            // tasks.add(ExecutionUtils.startViprTask(new InstallOs(host, osInstall)));
            } catch (ExecutionException e) {
                context.logError("computeutils.installOs.failure", host.getId(), e.getMessage());
            }
        }
    }
    if (!ExecutionUtils.waitForTask(tasks, this)) {
    // TODO: Re-throw the error?
    // ExecutionUtils.checkForError(tasks);
    }
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) ExecutionContext(com.emc.sa.engine.ExecutionContext) ArrayList(java.util.ArrayList) ViPRTaskMonitor(com.emc.sa.engine.ViPRTaskMonitor) OsInstallParam(com.emc.storageos.model.compute.OsInstallParam) ExecutionException(com.emc.sa.engine.ExecutionException)

Aggregations

OsInstallParam (com.emc.storageos.model.compute.OsInstallParam)3 ExecutionException (com.emc.sa.engine.ExecutionException)2 Host (com.emc.storageos.db.client.model.Host)2 HashMap (java.util.HashMap)2 ExecutionContext (com.emc.sa.engine.ExecutionContext)1 ViPRTaskMonitor (com.emc.sa.engine.ViPRTaskMonitor)1 HostRestRep (com.emc.storageos.model.host.HostRestRep)1 ArrayList (java.util.ArrayList)1