use of com.emc.storageos.model.pools.StoragePoolRestRep 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);
}
use of com.emc.storageos.model.pools.StoragePoolRestRep in project coprhd-controller by CoprHD.
the class VirtualArrays method storagePoolsJson.
/**
* Renders the list of storage pools for a given virtual array as JSON.
*
* @param id
* the virtual array ID.
*/
public static void storagePoolsJson(String id) {
List<StoragePoolInfo> items = Lists.newArrayList();
CachedResources<StorageSystemRestRep> storageSystems = StorageSystemUtils.createCache();
for (StoragePoolRestRep storagePool : StoragePoolUtils.getStoragePoolsAssignedToVirtualArray(id)) {
StoragePoolInfo item = new StoragePoolInfo(storagePool, storageSystems);
item.assigned = VirtualArrayUtils.isAssigned(storagePool, id);
items.add(item);
}
renderJSON(DataTablesSupport.createJSON(items, params));
}
use of com.emc.storageos.model.pools.StoragePoolRestRep in project coprhd-controller by CoprHD.
the class BlockVirtualPools method createBaseVPool.
private static void createBaseVPool(String vpoolName, String storageType, List<String> virtualarrayIds, String vpdesc, JsonArray vpools) {
BlockVirtualPoolForm vpool = new BlockVirtualPoolForm();
// defaults
vpool.provisioningType = ProvisioningTypes.THIN;
vpool.protocols = Sets.newHashSet(BlockProtocols.FC);
vpool.minPaths = 1;
vpool.maxPaths = 1;
vpool.initiatorPaths = 1;
vpool.expandable = true;
vpool.rpJournalSizeUnit = SizeUnit.x;
vpool.rpJournalSize = RPCopyForm.JOURNAL_DEFAULT_MULTIPLIER;
vpool.rpRpoValue = Long.valueOf(25);
vpool.rpRpoType = RpoType.SECONDS;
vpool.protectSourceSite = true;
vpool.enableAutoCrossConnExport = true;
vpool.poolAssignment = PoolAssignmentTypes.AUTOMATIC;
vpool.maxSnapshots = 10;
vpool.name = vpoolName;
vpool.systemType = storageType;
vpool.virtualArrays = virtualarrayIds;
vpool.description = vpdesc;
vpool.enableCompression = false;
// Check if creating a vmax AFA virtual pool, need to set auto-tiering
if (StringUtils.equals(VMAX, storageType)) {
vpool.uniqueAutoTierPolicyNames = true;
boolean isAutoTier = false;
AutoTierPolicyNamesCall auto_tiering = vpool.autoTierPolicyNames();
List<String> autoPolicyList = auto_tiering.call();
for (String policy : autoPolicyList) {
if (StringUtils.equals(DEFAULT_AUTO_TIER, policy)) {
vpool.autoTierPolicy = policy;
isAutoTier = true;
break;
}
}
if (!isAutoTier) {
// This means we did not find the pattern, set random
for (String policy : autoPolicyList) {
vpool.autoTierPolicy = policy;
break;
}
}
for (String virtualArrayId : virtualarrayIds) {
List<StoragePoolRestRep> spList = StoragePoolUtils.getStoragePoolsAssignedToVirtualArray(virtualArrayId);
for (StoragePoolRestRep sp : spList) {
if (sp.getCompressionEnabled() != null && sp.getCompressionEnabled()) {
vpool.enableCompression = true;
// rename with compression enable
vpool.name = VP_VMAX_DIAMOND_COMPRESSED;
break;
}
}
if (vpool.enableCompression) {
break;
}
}
}
BlockVirtualPoolRestRep vpoolTask = vpool.save();
if (vpoolTask != null) {
buildVpoolCookies(vpoolTask.getId().toString(), vpool.name, vpools);
}
}
use of com.emc.storageos.model.pools.StoragePoolRestRep in project coprhd-controller by CoprHD.
the class BlockVirtualPools method listStoragePoolsbyIdJson.
public static void listStoragePoolsbyIdJson(String id) {
BlockVirtualPoolRestRep virtualPool = VirtualPoolUtils.getBlockVirtualPool(id);
if (virtualPool == null) {
flash.error(MessagesUtils.get(UNKNOWN, id));
backToReferrer();
}
BlockVirtualPoolForm vpool = new BlockVirtualPoolForm();
vpool.load(virtualPool);
List<StoragePoolInfo> items = Lists.newArrayList();
if (vpool != null && vpool.protocols != null && !vpool.protocols.isEmpty()) {
vpool.deserialize();
Map<URI, String> storageSystemNames = StorageSystemUtils.getStorageSystemNames();
List<StoragePoolRestRep> pools = getMatchingStoragePools(vpool);
for (StoragePoolRestRep pool : pools) {
String storageSystemName = storageSystemNames.get(id(pool.getStorageSystem()));
items.add(new StoragePoolInfo(pool, storageSystemName));
}
}
renderJSON(DataTablesSupport.createJSON(items, params));
}
use of com.emc.storageos.model.pools.StoragePoolRestRep in project coprhd-controller by CoprHD.
the class FileSystems method fileSystem.
public static void fileSystem(String fileSystemId) {
ViPRCoreClient client = BourneUtil.getViprClient();
FileShareRestRep fileSystem = null;
try {
fileSystem = client.fileSystems().get(uri(fileSystemId));
} catch (ViPRHttpException e) {
if (e.getHttpCode() == 404 || e.getHttpCode() == 400) {
flash.error(MessagesUtils.get(UNKNOWN, fileSystemId));
fileSystems(null);
}
throw e;
}
if (fileSystem != null) {
if (fileSystem.getVirtualArray() != null) {
VirtualArrayRestRep virtualArray = client.varrays().get(fileSystem.getVirtualArray());
renderArgs.put("virtualArray", virtualArray);
}
if (fileSystem.getVirtualPool() != null) {
FileVirtualPoolRestRep virtualPool = client.fileVpools().get(fileSystem.getVirtualPool());
renderArgs.put("virtualPool", virtualPool);
}
if (Security.isSystemAdminOrRestrictedSystemAdmin()) {
if (fileSystem.getStorageSystem() != null) {
StorageSystemRestRep storageSystem = client.storageSystems().get(fileSystem.getStorageSystem());
renderArgs.put("storageSystem", storageSystem);
}
if (fileSystem.getPool() != null) {
StoragePoolRestRep storagePool = client.storagePools().get(fileSystem.getPool());
renderArgs.put("storagePool", storagePool);
}
if (fileSystem.getStoragePort() != null) {
StoragePortRestRep storagePort = client.storagePorts().get(fileSystem.getStoragePort());
renderArgs.put("storagePort", storagePort);
}
}
Tasks<FileShareRestRep> tasksResponse = client.fileSystems().getTasks(fileSystem.getId());
List<Task<FileShareRestRep>> tasks = tasksResponse.getTasks();
renderArgs.put("tasks", tasks);
} else {
notFound(MessagesUtils.get("resources.filesystems.notfound"));
}
renderArgs.put("permissionTypeOptions", PERMISSION_TYPES);
render(fileSystem);
}
Aggregations