Search in sources :

Example 1 with ObjectVirtualPoolRestRep

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

the class ObjectVirtualPools method edit.

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

Example 2 with ObjectVirtualPoolRestRep

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

the class ObjectVirtualPools method duplicate.

public static void duplicate(String ids) {
    ObjectVirtualPoolRestRep targetVPool = VirtualPoolUtils.getObjectVirtualPool(ids);
    if (targetVPool == null) {
        flash.error(MessagesUtils.get(UNKNOWN, ids));
        backToReferrer();
    }
    ObjectVirtualPoolForm copy = new ObjectVirtualPoolForm();
    copy.load(targetVPool);
    copy.id = null;
    copy.name = Messages.get("virtualPools.duplicate.name", copy.name);
    // Target VPool could have resources, set resources to 0 on the new Copy VPool so user can modify form
    copy.numResources = 0;
    edit(copy);
}
Also used : ObjectVirtualPoolForm(models.virtualpool.ObjectVirtualPoolForm) ObjectVirtualPoolRestRep(com.emc.storageos.model.vpool.ObjectVirtualPoolRestRep)

Example 3 with ObjectVirtualPoolRestRep

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

the class ObjectVirtualPoolForm method save.

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

Example 4 with ObjectVirtualPoolRestRep

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

the class VirtualArrayProvider method getObjectVirtualArrays.

@Asset("objectVirtualArray")
public List<AssetOption> getObjectVirtualArrays(AssetOptionsContext context) {
    ViPRCoreClient client = api(context);
    // Get the set of virtual arrays that are associated with object vpools
    Set<URI> varrayIds = new HashSet<>();
    for (ObjectVirtualPoolRestRep vpool : client.objectVpools().getByTenant(context.getTenant())) {
        varrayIds.addAll(ResourceUtils.refIds(vpool.getVirtualArrays()));
    }
    filterByContextTenant(varrayIds, client.varrays().getByTenant(context.getTenant()));
    return createBaseResourceOptions(client.varrays().getByIds(varrayIds));
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ObjectVirtualPoolRestRep(com.emc.storageos.model.vpool.ObjectVirtualPoolRestRep) URI(java.net.URI) HashSet(java.util.HashSet) Asset(com.emc.sa.asset.annotation.Asset)

Example 5 with ObjectVirtualPoolRestRep

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

the class ObjectVirtualPoolForm method doSave.

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

Aggregations

ObjectVirtualPoolRestRep (com.emc.storageos.model.vpool.ObjectVirtualPoolRestRep)8 ObjectVirtualPoolForm (models.virtualpool.ObjectVirtualPoolForm)2 Asset (com.emc.sa.asset.annotation.Asset)1 VirtualPoolMapper.toObjectVirtualPool (com.emc.storageos.api.mapper.VirtualPoolMapper.toObjectVirtualPool)1 MapObjectVirtualPool (com.emc.storageos.api.mapper.functions.MapObjectVirtualPool)1 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)1 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)1 ObjectVirtualPools (com.emc.vipr.client.core.ObjectVirtualPools)1 FlashException (controllers.util.FlashException)1 URI (java.net.URI)1 HashSet (java.util.HashSet)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 VirtualPoolInfo (models.datatable.VirtualPoolDataTable.VirtualPoolInfo)1 ObjectVirtualPoolBuilder (util.builders.ObjectVirtualPoolBuilder)1 ObjectVirtualPoolUpdateBuilder (util.builders.ObjectVirtualPoolUpdateBuilder)1