Search in sources :

Example 11 with HostRestRep

use of com.emc.storageos.model.host.HostRestRep in project coprhd-controller by CoprHD.

the class RemoveHostFromClusterService method validateBootVolumes.

/**
 * Validate the boot volume associated with the hosts we wish to remove.
 *
 * @param hostIdToNameMap
 *            map of host ID to hostname. We are only using the host ID key.
 * @return false if we can reach the host and determine the boot volume is no longer there.
 */
private boolean validateBootVolumes(Map<URI, String> hostIdToNameMap) {
    // the references are fixed.
    if (cluster == null || cluster.getInactive()) {
        logError("computeutils.removebootvolumes.failure.cluster");
        return false;
    }
    // Get all of the hosts for the cluster, create a list of hosts we are interested in removing ONLY.
    List<HostRestRep> allClusterHosts = ComputeUtils.getHostsInCluster(clusterId);
    List<HostRestRep> hostsToValidate = new ArrayList<>();
    for (HostRestRep clusterHost : allClusterHosts) {
        if (hostIdToNameMap.containsKey(clusterHost.getId())) {
            hostsToValidate.add(clusterHost);
        }
    }
    return ComputeUtils.validateBootVolumes(cluster, hostsToValidate);
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) ArrayList(java.util.ArrayList)

Example 12 with HostRestRep

use of com.emc.storageos.model.host.HostRestRep in project coprhd-controller by CoprHD.

the class AddHostToCluster method doExecute.

@Override
public Task<HostRestRep> doExecute() throws Exception {
    HostUpdateParam hostUpdateParam = new HostUpdateParam();
    hostUpdateParam.setCluster(cluster);
    Task<HostRestRep> task = getClient().hosts().update(host, hostUpdateParam);
    return task;
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) HostUpdateParam(com.emc.storageos.model.host.HostUpdateParam)

Example 13 with HostRestRep

use of com.emc.storageos.model.host.HostRestRep in project coprhd-controller by CoprHD.

the class CreateHosts method executeTask.

@Override
public Tasks<HostRestRep> executeTask() throws Exception {
    ProvisionBareMetalHostsParam create = new ProvisionBareMetalHostsParam();
    create.setCluster(cluster);
    create.setComputeVpool(vcp);
    create.setTenant(getOrderTenant());
    create.setVarray(varray);
    for (String hostName : hostNames) {
        if (hostName != null) {
            create.getHostNames().add(hostName);
        }
    }
    Tasks<HostRestRep> tasks = getClient().hosts().provisionBareMetalHosts(create);
    for (Task<HostRestRep> task : tasks.getTasks()) {
        addOrderIdTag(task.getTaskResource().getId());
    }
    return tasks;
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) ProvisionBareMetalHostsParam(com.emc.storageos.model.host.ProvisionBareMetalHostsParam)

Example 14 with HostRestRep

use of com.emc.storageos.model.host.HostRestRep in project coprhd-controller by CoprHD.

the class SetBootVolume method executeTask.

@Override
public Task<HostRestRep> executeTask() throws Exception {
    HostUpdateParam update = new HostUpdateParam();
    update.setBootVolume(volumeId);
    update.setUpdateSanBootTargets(updateSanBootTargets);
    Task<HostRestRep> task = getClient().hosts().updateBootVolume(hostId, update);
    addOrderIdTag(task.getTaskResource().getId());
    return task;
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) HostUpdateParam(com.emc.storageos.model.host.HostUpdateParam)

Example 15 with HostRestRep

use of com.emc.storageos.model.host.HostRestRep in project coprhd-controller by CoprHD.

the class ClusterAutoExportTest method test4.

public void test4() throws Exception {
    // Set auto-export to true on one cluster to trigger synchronization
    List<HostRestRep> cluster1Hosts = getHosts(cluster1);
    List<HostRestRep> cluster2Hosts = getHosts(cluster2);
    setClusterAutoExport(cluster1, true);
    Thread.sleep(LONG_SLEEP);
    for (HostRestRep host : cluster1Hosts) {
        verifyHostInClusterExport(host, export1);
        verifyHostNotInClusterExport(host, export2);
    }
    for (HostRestRep host : cluster2Hosts) {
        verifyHostInClusterExport(host, export2);
        verifyHostNotInClusterExport(host, export1);
    }
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep)

Aggregations

HostRestRep (com.emc.storageos.model.host.HostRestRep)46 URI (java.net.URI)17 ArrayList (java.util.ArrayList)10 ExecutionException (com.emc.sa.engine.ExecutionException)7 Host (com.emc.storageos.db.client.model.Host)6 ClusterRestRep (com.emc.storageos.model.host.cluster.ClusterRestRep)6 DeactivateHost (com.emc.sa.service.vipr.compute.tasks.DeactivateHost)5 DiscoverHost (com.emc.sa.service.vipr.compute.tasks.DiscoverHost)5 GetHost (com.emc.sa.service.vipr.tasks.GetHost)5 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)5 TimeoutException (com.emc.vipr.client.exceptions.TimeoutException)5 ViPRException (com.emc.vipr.client.exceptions.ViPRException)5 HashMap (java.util.HashMap)5 HostUpdateParam (com.emc.storageos.model.host.HostUpdateParam)4 InitiatorRestRep (com.emc.storageos.model.host.InitiatorRestRep)4 Asset (com.emc.sa.asset.annotation.Asset)3 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)3 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)3 VcenterDataCenterRestRep (com.emc.storageos.model.host.vcenter.VcenterDataCenterRestRep)3 Task (com.emc.vipr.client.Task)3