Search in sources :

Example 41 with HostRestRep

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

the class RemoveHostFromCluster method doExecute.

@Override
public Task<HostRestRep> doExecute() throws Exception {
    HostUpdateParam hostUpdateParam = new HostUpdateParam();
    hostUpdateParam.setCluster(uri("null"));
    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 42 with HostRestRep

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

the class DiscoverHost method executeTask.

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

Example 43 with HostRestRep

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

the class ClusterAutoExportTest method test3.

public void test3() throws Exception {
    // Set auto-export to false on both clusters. Exports will not be triggered.
    setClusterAutoExport(cluster1, false);
    HostRestRep host = getHosts(cluster2).get(0);
    moveHost(host, cluster1);
    // wait long enough for export updates to process
    Thread.sleep(SLEEP);
    verifyHostNotInClusterExport(host, export1);
    verifyHostInClusterExport(host, export2);
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep)

Example 44 with HostRestRep

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

the class ClusterAutoExportTest method test2.

public void test2() throws Exception {
    // Set auto-export on one cluster. Move host. Exports should be automatic.
    setClusterAutoExport(cluster2, false);
    HostRestRep host = getHosts(cluster2).get(0);
    moveHost(host, cluster1);
    verifyHostNotInClusterExport(host, export2);
    verifyHostInClusterExport(host, export1);
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep)

Example 45 with HostRestRep

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

the class Hosts method itemsJson.

public static void itemsJson(@As(",") String[] ids) {
    Map<URI, String> clusterMap = ResourceUtils.mapNames(getViprClient().clusters().listByTenant(uri(Models.currentAdminTenant())));
    List<HostInfo> results = Lists.newArrayList();
    if ((ids != null) && (ids.length > 0)) {
        for (String id : ids) {
            if (StringUtils.isBlank(id)) {
                continue;
            }
            HostRestRep host = HostUtils.getHost(uri(id));
            if (host != null) {
                Set<URI> dataCenterIds = HostUtils.getDataCenterIds(Lists.newArrayList(host));
                Map<URI, VcenterDataCenterRestRep> vcenterDataCenters = HostUtils.getVcenterDataCenters(dataCenterIds);
                results.add(new HostInfo(host, clusterMap, vcenterDataCenters));
            }
        }
    }
    renderJSON(results);
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) VcenterDataCenterRestRep(com.emc.storageos.model.host.vcenter.VcenterDataCenterRestRep) URI(java.net.URI) HostInfo(models.datatable.HostDataTable.HostInfo)

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