use of com.emc.vipr.client.exceptions.ServiceErrorException in project coprhd-controller by CoprHD.
the class ApiSystemTestUtil method createVolume.
public List<URI> createVolume(String name, String size, Integer count, URI vpool, URI varray, URI project, URI cg) {
List<URI> volumes = new ArrayList<URI>();
VolumeCreate createParam = new VolumeCreate();
createParam.setName(name);
createParam.setSize(size);
;
createParam.setCount(count);
createParam.setVpool(vpool);
createParam.setVarray(varray);
createParam.setProject(project);
createParam.setConsistencyGroup(cg);
try {
Tasks<VolumeRestRep> tasks = client.blockVolumes().create(createParam);
for (VolumeRestRep volumeRestRep : tasks.get()) {
log.info(String.format("Volume %s (%s) created", volumeRestRep.getName(), volumeRestRep.getNativeId()));
volumes.add(volumeRestRep.getId());
}
return volumes;
} catch (ServiceErrorException ex) {
log.error("Exception creating virtual volumes " + ex.getMessage(), ex);
throw ex;
}
}
use of com.emc.vipr.client.exceptions.ServiceErrorException in project coprhd-controller by CoprHD.
the class CustomConfigs method update.
@FlashException
public static void update(String id, String configType, String scopeType, String scopeValue, String value) {
CustomConfigRestRep customConfig = CustomConfigUtils.getCustomConfig(uri(id));
ScopeParam scope = customConfig.getScope();
try {
if (!scope.getType().equals(scopeType) || !scope.getValue().equals(scopeValue)) {
CustomConfigUtils.deleteCustomConfig(uri(id));
CustomConfigUtils.createCustomConfig(configType, scopeType, scopeValue, value);
} else {
CustomConfigUtils.updateCustomConfig(uri(id), value);
}
} catch (ServiceErrorException ex) {
flash.error(MessagesUtils.get("CustomConfigs.error.update", value, MessagesUtils.get("CustomConfigs.configType." + configType)));
}
}
use of com.emc.vipr.client.exceptions.ServiceErrorException in project coprhd-controller by CoprHD.
the class ComputeVirtualPools method saveTenantACLs.
/**
* Saves tenant ACLs on the virtual compute pool.
*
* @param vpoolId
* the virtual compute pool ID.
* @param tenants
* the tenant ACLs.
* @param enableTenants
* the checked status for "Grant Access to Tenants".
*/
private static void saveTenantACLs(String vpoolId, List<String> tenants, Boolean enableTenants) {
Set<String> tenantIds = Sets.newHashSet();
if (isTrue(enableTenants) && tenants != null) {
tenantIds.addAll(tenants);
}
ACLUpdateBuilder builder = new ACLUpdateBuilder(ComputeVirtualPoolUtils.getComputeACLs(vpoolId));
builder.setTenants(tenantIds);
try {
ComputeVirtualPoolUtils.updateComputeACLs(vpoolId, builder.getACLUpdate());
} catch (ViPRException e) {
Logger.error(e, "Failed to update Compute Virtual Pool ACLs");
String errorDesc = e.getMessage();
if (e instanceof ServiceErrorException) {
errorDesc = ((ServiceErrorException) e).getDetailedMessage();
}
flash.error(MessagesUtils.get("computeVirtualPool.updateComputeVirtualPoolACLs.failed", errorDesc));
}
}
use of com.emc.vipr.client.exceptions.ServiceErrorException in project coprhd-controller by CoprHD.
the class FileSnapshots method addSnapshotAcl.
/**
* This method called when user Adds an access control entry from UI.
*
* @param aclURL
* URL of the snapshot share.
* @param shareACL
* This contains the form data from UI.
*/
public static void addSnapshotAcl(String aclURL, SnapshotShareACLForm shareACL, String formAccessControlList) {
String snapshotId = null;
String shareName = null;
if (StringUtils.isNotBlank(aclURL)) {
String[] parts = aclURL.split("/");
if (parts.length == 7) {
snapshotId = parts[3];
shareName = parts[5];
}
}
if (formAccessControlList == null || "".equals(formAccessControlList)) {
flash.error(MessagesUtils.get("resources.filesystem.share.acl.invalid.settings"), null);
listSnapshotAcl(snapshotId, shareName);
}
SnapshotCifsShareACLUpdateParams input = createSnapshotCifsShareAclParams(formAccessControlList);
ViPRCoreClient client = BourneUtil.getViprClient();
try {
client.fileSnapshots().updateShareACL(uri(snapshotId), shareName, input);
} catch (ServiceErrorException e) {
flash.error(e.getMessage(), null);
listSnapshotAcl(snapshotId, shareName);
}
flash.success(MessagesUtils.get("resources.filesystem.share.acl.added"));
listSnapshotAcl(snapshotId, shareName);
}
use of com.emc.vipr.client.exceptions.ServiceErrorException in project coprhd-controller by CoprHD.
the class FileSystems method addShareAcl.
/**
* This method called when user Adds an access control entry from UI.
*
* @param aclURL
* URL of the file system share.
* @param shareACL
* This contains the form data from UI.
*/
public static void addShareAcl(String aclURL, ShareACLForm shareACL, String formAccessControlList) {
String fileSystem = null;
String shareName = null;
if (StringUtils.isNotBlank(aclURL)) {
String[] parts = aclURL.split("/");
if (parts.length == 7) {
fileSystem = parts[3];
shareName = parts[5];
}
}
if (formAccessControlList == null || "".equals(formAccessControlList)) {
flash.error(MessagesUtils.get("resources.filesystem.share.acl.invalid.name"), null);
listAcl(fileSystem, shareName);
}
FileCifsShareACLUpdateParams input = createCifsShareAclParams(formAccessControlList);
ViPRCoreClient client = BourneUtil.getViprClient();
try {
client.fileSystems().updateShareACL(uri(fileSystem), shareName, input);
} catch (ServiceErrorException e) {
flash.error(e.getMessage(), null);
listAcl(fileSystem, shareName);
}
flash.success(MessagesUtils.get(ADDED));
listAcl(fileSystem, shareName);
}
Aggregations