Search in sources :

Example 21 with HostRestRep

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

the class Hosts method itemDetails.

public static void itemDetails(String id) {
    HostRestRep host = HostUtils.getHost(uri(id));
    ClusterRestRep cluster = ClusterUtils.getCluster(ResourceUtils.id(host.getCluster()));
    VcenterDataCenterRestRep dataCenter = VCenterUtils.getDataCenter(ResourceUtils.id(host.getvCenterDataCenter()));
    VcenterRestRep vcenter = VCenterUtils.getVCenter(dataCenter);
    render(host, cluster, dataCenter, vcenter);
}
Also used : ClusterRestRep(com.emc.storageos.model.host.cluster.ClusterRestRep) HostRestRep(com.emc.storageos.model.host.HostRestRep) VcenterRestRep(com.emc.storageos.model.host.vcenter.VcenterRestRep) VcenterDataCenterRestRep(com.emc.storageos.model.host.vcenter.VcenterDataCenterRestRep)

Example 22 with HostRestRep

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

the class Hosts method edit.

@FlashException("list")
public static void edit(String id) {
    HostRestRep dbHost = HostUtils.getHost(uri(id));
    if (dbHost != null) {
        addReferenceData();
        HostForm host = new HostForm(dbHost);
        List<InitiatorRestRep> initiators = HostUtils.getInitiators(dbHost.getId());
        List<IpInterfaceRestRep> ipInterfaces = HostUtils.getIpInterfaces(dbHost.getId());
        render(host, dbHost, initiators, ipInterfaces);
    } else {
        flash.error(MessagesUtils.get(UNKNOWN, id));
        list();
    }
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep) IpInterfaceRestRep(com.emc.storageos.model.host.IpInterfaceRestRep) FlashException(controllers.util.FlashException)

Example 23 with HostRestRep

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

the class BlockExportGroups method availableHostsJson.

public static void availableHostsJson(String exportGroupId) {
    List<HostRestRep> availableHosts = Lists.newArrayList();
    ExportGroupRestRep exportGroup = getViprClient().blockExports().get(uri(exportGroupId));
    final List<URI> exportGroupHosts = ResourceUtils.ids(exportGroup.getHosts());
    List<URI> hostIds = getValidHosts(exportGroup);
    if (!hostIds.isEmpty()) {
        availableHosts = getViprClient().hosts().getByIds(hostIds, new DefaultResourceFilter<HostRestRep>() {

            @Override
            public boolean accept(HostRestRep item) {
                return !exportGroupHosts.contains(item.getId());
            }
        });
    }
    renderJSON(DataTablesSupport.createJSON(availableHosts, params));
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) DefaultResourceFilter(com.emc.vipr.client.core.filters.DefaultResourceFilter) URI(java.net.URI)

Example 24 with HostRestRep

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

the class HostInitiators method list.

public static void list(String hostId) {
    HostRestRep host = HostUtils.getHost(uri(hostId));
    if (host == null) {
        flash.error(Messages.get(Hosts.UNKNOWN, hostId));
        Hosts.list();
    }
    boolean initiatorsEditable = host.getDiscoverable() == null ? false : !host.getDiscoverable();
    InitiatorForm initiator = new InitiatorForm();
    renderArgs.put("dataTable", new HostInitiatorDataTable());
    if (!initiatorsEditable) {
        flash.put("warning", MessagesUtils.get("initiators.notEditable"));
    }
    render(host, initiator, initiatorsEditable);
}
Also used : HostInitiatorDataTable(models.datatable.HostInitiatorDataTable) HostRestRep(com.emc.storageos.model.host.HostRestRep)

Example 25 with HostRestRep

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

the class BlockExports method findByHostOrCluster.

/**
 * Finds the exports associated with a host (or that host's cluster) that are for the given project. If a virtual
 * array ID is specified, only exports associated with that virtual array are returned.
 *
 * @param hostId
 *            the ID of the host.
 * @param projectId
 *            the ID of the project.
 * @param virtualArrayId
 *            the ID of the virtual array to restrict the exports to, or null for no restriction.
 * @return the list of export groups associated with the host or any host in the same cluster.
 * @deprecated This method was only used in one test class {@code ViPRClientApp} which doesn't use this method anymore.
 */
@Deprecated
public List<ExportGroupRestRep> findByHostOrCluster(URI hostId, URI projectId, URI virtualArrayId) {
    HostRestRep host = parent.hosts().get(hostId);
    URI clusterId = (host != null) ? id(host.getCluster()) : null;
    ResourceFilter<ExportGroupRestRep> filter;
    if (virtualArrayId == null) {
        filter = new ExportHostOrClusterFilter(hostId, clusterId);
    } else {
        filter = new ExportHostOrClusterFilter(hostId, clusterId).and(new ExportVirtualArrayFilter(virtualArrayId));
    }
    return findByProject(projectId, filter);
}
Also used : HostRestRep(com.emc.storageos.model.host.HostRestRep) ExportVirtualArrayFilter(com.emc.vipr.client.core.filters.ExportVirtualArrayFilter) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ExportHostOrClusterFilter(com.emc.vipr.client.core.filters.ExportHostOrClusterFilter) URI(java.net.URI)

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