Search in sources :

Example 1 with FileVirtualPoolRestRep

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

the class VirtualPoolMapper method toFileVirtualPool.

public static FileVirtualPoolRestRep toFileVirtualPool(VirtualPool from) {
    if (from == null) {
        return null;
    }
    FileVirtualPoolRestRep to = new FileVirtualPoolRestRep();
    // Show the feature even if it's disabled
    to.setProtection(new FileVirtualPoolProtectionParam());
    to.getProtection().setSnapshots(new VirtualPoolProtectionSnapshotsParam());
    to.getProtection().getSnapshots().setMaxSnapshots(from.getMaxNativeSnapshots());
    to.getProtection().setReplicationSupported(from.getFileReplicationSupported());
    to.getProtection().setAllowFilePolicyAtProjectLevel(from.getAllowFilePolicyAtProjectLevel());
    to.getProtection().setAllowFilePolicyAtFSLevel(from.getAllowFilePolicyAtFSLevel());
    if (from.getFrRpoType() != null) {
        to.getProtection().setMinRpoType(from.getFrRpoType());
    }
    if (from.getFrRpoValue() != null) {
        to.getProtection().setMinRpoValue(from.getFrRpoValue());
    }
    to.getProtection().setScheduleSnapshots(from.getScheduleSnapshots());
    to.setLongTermRetention(from.getLongTermRetention());
    if (from.getFilePolicies() != null && !from.getFilePolicies().isEmpty()) {
        to.setFileProtectionPolicies(from.getFilePolicies());
    }
    return mapVirtualPoolFields(from, to, null);
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) VirtualPoolProtectionSnapshotsParam(com.emc.storageos.model.vpool.VirtualPoolProtectionSnapshotsParam) FileVirtualPoolProtectionParam(com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam)

Example 2 with FileVirtualPoolRestRep

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

the class FileVirtualPools method save.

@FlashException(keep = true, referrer = { "create", "edit" })
public static void save(FileVirtualPoolForm vpool) {
    if (vpool == null) {
        list();
    }
    vpool.deserialize();
    vpool.validate("vpool");
    if (Validation.hasErrors()) {
        Common.handleError();
    }
    try {
        FileVirtualPoolRestRep result = vpool.save();
        flash.success(MessagesUtils.get(SAVED_SUCCESS, result.getName()));
        backToReferrer();
    } catch (ViPRException e) {
        throwFlashException(vpool, e);
    }
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) ViPRException(com.emc.vipr.client.exceptions.ViPRException) FlashException(controllers.util.FlashException)

Example 3 with FileVirtualPoolRestRep

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

the class FileVirtualPools method edit.

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

Example 4 with FileVirtualPoolRestRep

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

the class FileVirtualPools method listJson.

public static void listJson() {
    List<VirtualPoolInfo> items = Lists.newArrayList();
    for (FileVirtualPoolRestRep virtualPool : VirtualPoolUtils.getFileVirtualPools()) {
        items.add(new VirtualPoolInfo(virtualPool));
    }
    renderJSON(DataTablesSupport.createJSON(items, params));
}
Also used : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) VirtualPoolInfo(models.datatable.VirtualPoolDataTable.VirtualPoolInfo)

Example 5 with FileVirtualPoolRestRep

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

the class FileVirtualPoolForm method doSave.

protected FileVirtualPoolRestRep doSave() {
    FileVirtualPoolRestRep virtualPool;
    if (isNew()) {
        FileVirtualPoolBuilder builder = apply(new FileVirtualPoolBuilder());
        virtualPool = VirtualPoolUtils.create(builder.getVirtualPool());
        this.id = ResourceUtils.stringId(virtualPool);
    } else {
        FileVirtualPoolRestRep oldVirtualPool = VirtualPoolUtils.getFileVirtualPool(id);
        FileVirtualPoolUpdateBuilder builder = apply(new FileVirtualPoolUpdateBuilder(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 : FileVirtualPoolRestRep(com.emc.storageos.model.vpool.FileVirtualPoolRestRep) FileVirtualPoolUpdateBuilder(util.builders.FileVirtualPoolUpdateBuilder) FileVirtualPoolBuilder(util.builders.FileVirtualPoolBuilder) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep)

Aggregations

FileVirtualPoolRestRep (com.emc.storageos.model.vpool.FileVirtualPoolRestRep)21 Asset (com.emc.sa.asset.annotation.Asset)8 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)7 URI (java.net.URI)7 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)6 AssetOption (com.emc.vipr.model.catalog.AssetOption)5 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)3 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)3 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)3 FileVirtualPoolProtectionParam (com.emc.storageos.model.vpool.FileVirtualPoolProtectionParam)3 Map (java.util.Map)3 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)2 FileVirtualPoolForm (models.virtualpool.FileVirtualPoolForm)2 VirtualPoolMapper.toFileVirtualPool (com.emc.storageos.api.mapper.VirtualPoolMapper.toFileVirtualPool)1 MapFileVirtualPool (com.emc.storageos.api.mapper.functions.MapFileVirtualPool)1 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)1 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)1 StoragePoolRestRep (com.emc.storageos.model.pools.StoragePoolRestRep)1 StoragePortRestRep (com.emc.storageos.model.ports.StoragePortRestRep)1 ProjectRestRep (com.emc.storageos.model.project.ProjectRestRep)1