Search in sources :

Example 1 with BlockVirtualPoolRestRep

use of com.emc.storageos.model.vpool.BlockVirtualPoolRestRep in project coprhd-controller by CoprHD.

the class BlockVirtualPoolService method getVirtualPool.

/**
 * Get info for block store virtual pool
 *
 * @prereq none
 * @param id the URN of a ViPR VirtualPool
 * @brief Show block store virtual pool
 * @return VirtualPool details
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR }, acls = { ACL.USE })
public BlockVirtualPoolRestRep getVirtualPool(@PathParam("id") URI id) {
    VirtualPool vpool = getVirtualPool(VirtualPool.Type.block, id);
    BlockVirtualPoolRestRep restRep = getBlockVirtualPoolWithProtection(vpool);
    restRep.setNumResources(getNumResources(vpool, _dbClient));
    return restRep;
}
Also used : VirtualPoolMapper.toBlockVirtualPool(com.emc.storageos.api.mapper.VirtualPoolMapper.toBlockVirtualPool) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 2 with BlockVirtualPoolRestRep

use of com.emc.storageos.model.vpool.BlockVirtualPoolRestRep in project coprhd-controller by CoprHD.

the class BlockVirtualPoolForm method doSave.

protected BlockVirtualPoolRestRep doSave() {
    BlockVirtualPoolRestRep virtualPool;
    if (isNew()) {
        BlockVirtualPoolBuilder builder = apply(new BlockVirtualPoolBuilder());
        virtualPool = VirtualPoolUtils.create(builder.getVirtualPool());
        this.id = ResourceUtils.stringId(virtualPool);
    } else {
        BlockVirtualPoolRestRep oldVirtualPool = VirtualPoolUtils.getBlockVirtualPool(id);
        BlockVirtualPoolUpdateBuilder builder = apply(new BlockVirtualPoolUpdateBuilder(oldVirtualPool));
        virtualPool = VirtualPoolUtils.update(id, builder.getVirtualPoolUpdate());
        List<NamedRelatedResourceRep> matchingPools = VirtualPoolUtils.refreshMatchingPools(virtualPool);
        Logger.info("Refreshed Block Virtual Pool '%s' matching pools: %d", virtualPool.getName(), matchingPools.size());
    }
    virtualPool = saveStoragePools(virtualPool);
    return virtualPool;
}
Also used : BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) BlockVirtualPoolUpdateBuilder(util.builders.BlockVirtualPoolUpdateBuilder) BlockVirtualPoolBuilder(util.builders.BlockVirtualPoolBuilder)

Example 3 with BlockVirtualPoolRestRep

use of com.emc.storageos.model.vpool.BlockVirtualPoolRestRep in project coprhd-controller by CoprHD.

the class BlockVirtualPoolForm method save.

@Override
public BlockVirtualPoolRestRep save() {
    BlockVirtualPoolRestRep virtualPool = doSave();
    BlockVirtualPools vpools = getViprClient().blockVpools();
    saveQuota(vpools);
    saveTenantACLs(vpools);
    return virtualPool;
}
Also used : BlockVirtualPools(com.emc.vipr.client.core.BlockVirtualPools) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep)

Example 4 with BlockVirtualPoolRestRep

use of com.emc.storageos.model.vpool.BlockVirtualPoolRestRep in project coprhd-controller by CoprHD.

the class BlockVirtualPools method edit.

public static void edit(String id) {
    BlockVirtualPoolRestRep virtualPool = VirtualPoolUtils.getBlockVirtualPool(id);
    if (virtualPool == null) {
        flash.error(MessagesUtils.get(UNKNOWN, id));
        backToReferrer();
    }
    BlockVirtualPoolForm vpool = new BlockVirtualPoolForm();
    vpool.load(virtualPool);
    edit(vpool);
}
Also used : BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) BlockVirtualPoolForm(models.virtualpool.BlockVirtualPoolForm)

Example 5 with BlockVirtualPoolRestRep

use of com.emc.storageos.model.vpool.BlockVirtualPoolRestRep in project coprhd-controller by CoprHD.

the class BlockVirtualPools method checkDisconnectedStoragePools.

public static void checkDisconnectedStoragePools(@As(",") String[] ids) {
    List<BlockVirtualPoolRestRep> virtualpools = VirtualPoolUtils.getBlockVirtualPools();
    Set<String> connectedstoragepools = new HashSet<String>();
    List<String> failedArrays = new ArrayList<String>();
    for (BlockVirtualPoolRestRep virtualpool : virtualpools) {
        if (virtualpool.getUseMatchedPools()) {
            for (RelatedResourceRep pool : virtualpool.getMatchedStoragePools()) {
                connectedstoragepools.add(pool.getId().toString());
            }
        } else {
            for (RelatedResourceRep pool : virtualpool.getAssignedStoragePools()) {
                connectedstoragepools.add(pool.getId().toString());
            }
        }
    }
    for (String id : ids) {
        StorageSystemRestRep storageSystem = StorageSystemUtils.getStorageSystem(id);
        if (storageSystem != null && !storageSystem.getRegistrationStatus().equals("UNREGISTERED")) {
            boolean found = false;
            List<StoragePoolRestRep> storagepools = StoragePoolUtils.getStoragePools(id);
            for (StoragePoolRestRep storagepool : storagepools) {
                if (connectedstoragepools.contains(storagepool.getId().toString())) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                failedArrays.add(storageSystem.getName());
            }
        }
    }
    renderJSON(failedArrays);
}
Also used : RelatedResourceRep(com.emc.storageos.model.RelatedResourceRep) StorageSystemRestRep(com.emc.storageos.model.systems.StorageSystemRestRep) ArrayList(java.util.ArrayList) BlockVirtualPoolRestRep(com.emc.storageos.model.vpool.BlockVirtualPoolRestRep) StoragePoolRestRep(com.emc.storageos.model.pools.StoragePoolRestRep) HashSet(java.util.HashSet)

Aggregations

BlockVirtualPoolRestRep (com.emc.storageos.model.vpool.BlockVirtualPoolRestRep)26 URI (java.net.URI)10 Asset (com.emc.sa.asset.annotation.Asset)6 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)5 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)5 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)4 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)4 AssetOption (com.emc.vipr.model.catalog.AssetOption)4 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 BlockVirtualPoolForm (models.virtualpool.BlockVirtualPoolForm)4 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)3 StoragePoolRestRep (com.emc.storageos.model.pools.StoragePoolRestRep)3 Map (java.util.Map)3 StringSet (com.emc.storageos.db.client.model.StringSet)2 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)2 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)2 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)2 ProjectRestRep (com.emc.storageos.model.project.ProjectRestRep)2 BlockVirtualPoolParam (com.emc.storageos.model.vpool.BlockVirtualPoolParam)2