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);
}
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);
}
}
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);
}
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));
}
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;
}
Aggregations