use of com.emc.storageos.model.systems.StorageSystemRestRep in project coprhd-controller by CoprHD.
the class StorageSystemService method getStorageSystem.
/**
* Get information about the registered storage system with the passed id.
*
* @param id the URN of a ViPR storage system.
*
* @brief Show storage system
* @return A reference to a StorageSystemRestRep
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}")
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.SYSTEM_MONITOR })
public StorageSystemRestRep getStorageSystem(@PathParam("id") URI id) {
ArgValidator.checkFieldUriType(id, StorageSystem.class, "id");
StorageSystem system = queryResource(id);
StorageSystemRestRep restRep = map(system);
restRep.setNumResources(getNumResources(system, _dbClient));
return restRep;
}
use of com.emc.storageos.model.systems.StorageSystemRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getApplicationSnapshotVirtualArrays.
@Asset("applicationSnapshotVirtualArray")
@AssetDependencies("application")
public List<AssetOption> getApplicationSnapshotVirtualArrays(AssetOptionsContext ctx, URI applicationId) {
final ViPRCoreClient client = api(ctx);
List<NamedRelatedResourceRep> volList = client.application().listVolumes(applicationId);
List<AssetOption> options = new ArrayList<AssetOption>();
boolean isVplex = false;
boolean isRP = false;
URI sourceVarrayId = null;
List<VolumeRestRep> allRPSourceVols = null;
if (volList != null && !volList.isEmpty()) {
VolumeRestRep vol = client.blockVolumes().get(volList.get(0));
StorageSystemRestRep sys = client.storageSystems().get(vol.getStorageController());
if (sys.getSystemType().equals("vplex")) {
isVplex = true;
sourceVarrayId = vol.getVirtualArray().getId();
}
if (BlockProviderUtils.isVolumeRP(vol)) {
isRP = true;
allRPSourceVols = client.blockVolumes().getByRefs(volList, RecoverPointPersonalityFilter.SOURCE);
if (allRPSourceVols != null && !allRPSourceVols.isEmpty()) {
VolumeRestRep rpvol = allRPSourceVols.get(0);
sourceVarrayId = rpvol.getVirtualArray().getId();
}
}
} else {
return options;
}
// if it's neither RP nor vplex, it's just a simple block volume application; site is not needed
if (!isVplex && !isRP) {
options.add(newAssetOption(URI.create("none"), "None"));
}
// if the volumes are vplex or RP display source as an option
if (isVplex || isRP) {
options.add(newAssetOption(sourceVarrayId, "protection.site.type.source"));
}
// if the volumes are RP (vplex or not) add the RP targets as options
if (isRP) {
Set<URI> targetVarrayIds = new HashSet<URI>();
List<AssetOption> targetOptions = new ArrayList<AssetOption>();
List<VolumeRestRep> allRPTargetVols = client.blockVolumes().getByRefs(volList, RecoverPointPersonalityFilter.TARGET);
for (VolumeRestRep targetVol : allRPTargetVols) {
targetVarrayIds.add(targetVol.getVirtualArray().getId());
}
List<VirtualArrayRestRep> targetVarrays = client.varrays().getByIds(targetVarrayIds);
for (VirtualArrayRestRep targetVarray : targetVarrays) {
targetOptions.add(newAssetOption(String.format("tgt:%s", targetVarray.getId().toString()), "protection.site.type.target", targetVarray.getName()));
}
// sort the targets
AssetOptionsUtils.sortOptionsByLabel(targetOptions);
options.addAll(targetOptions);
}
return options;
}
use of com.emc.storageos.model.systems.StorageSystemRestRep in project coprhd-controller by CoprHD.
the class DiscoverUnmanagedVolumesService method execute.
@Override
public void execute() throws Exception {
List<URI> uris = uris(storageSystems);
List<StorageSystemRestRep> systemRestReps = execute(new GetStorageSystems(uris));
// remove any VPLEX systems and add them back at the end of the systems list
List<StorageSystemRestRep> vplexSystems = new ArrayList<StorageSystemRestRep>();
Iterator<StorageSystemRestRep> it = systemRestReps.iterator();
while (it.hasNext()) {
StorageSystemRestRep system = it.next();
if (BlockProviderUtils.isVplex(system)) {
vplexSystems.add(system);
it.remove();
}
}
systemRestReps.addAll(vplexSystems);
for (StorageSystemRestRep storageSystem : systemRestReps) {
logInfo("discover.unmanaged.volume.service.discovering", storageSystem.getName());
execute(new DiscoverUnmanagedVolumes(storageSystem.getId().toString()));
int postCount = countUnmanagedVolumes(storageSystem.getId().toString());
logInfo("discover.unmanaged.volume.service.discovered", postCount, storageSystem.getName());
}
List<ProtectionSystemRestRep> protectionSystemRestReps = execute(new GetProtectionSystems());
for (ProtectionSystemRestRep protectionSystem : protectionSystemRestReps) {
logInfo("discover.unmanaged.volume.service.discoveringcgs", protectionSystem.getName());
execute(new DiscoverUnmanagedCGs(protectionSystem.getId().toString(), DiscoverUnmanagedCGs.UnmanagedNamespace.UNMANAGED_CGS));
logInfo("discover.unmanaged.volume.service.discoveredcgs", protectionSystem.getName());
}
}
use of com.emc.storageos.model.systems.StorageSystemRestRep in project coprhd-controller by CoprHD.
the class BlockVirtualPools method createAllFlash.
public static void createAllFlash() {
// This method should only list available storage type discovered
Set<String> typesList = new HashSet<String>();
JsonObject dataObject = getCookieAsJson(GUIDE_DATA);
JsonArray storage_systems = dataObject.getAsJsonArray(STORAGE_SYSTEMS);
if (storage_systems != null) {
for (Object storageobject : storage_systems) {
JsonObject storage = (JsonObject) storageobject;
String storageid = storage.get("id").getAsString();
StorageSystemRestRep storagesys = StorageSystemUtils.getStorageSystem(storageid);
if (storagesys != null && !storagesys.getRegistrationStatus().equals("UNREGISTERED")) {
typesList.add(storagesys.getSystemType());
}
}
}
renderArgs.put("types", typesList);
render();
}
use of com.emc.storageos.model.systems.StorageSystemRestRep in project coprhd-controller by CoprHD.
the class StorageSystems method edit.
@FlashException("list")
public static void edit(String id) {
addReferenceData();
StorageSystemRestRep storageSystem = StorageSystemUtils.getStorageSystem(id);
if (storageSystem != null) {
StorageSystemForm storageArray = new StorageSystemForm(storageSystem);
if (storageArray.type.equals(SCALEIO)) {
renderArgs.put("storageArrayTypeList", StorageProviderTypes.getProviderOption());
}
if (storageArray.type.equals("xtremio")) {
renderArgs.put("storageArrayTypeList", StorageProviderTypes.getProviderOption());
}
if (storageArray.unregistered) {
flash.put("warning", MessagesUtils.get(NOT_REGISTERED, storageArray.name));
}
if (storageArray.type.equals(VMAX)) {
@SuppressWarnings("unchecked") List<StringOption> options = (List<StringOption>) renderArgs.get("storageArrayTypeList");
options.add(new StringOption(VMAX, MessagesUtils.get(SMIS_VMAX)));
@SuppressWarnings("unchecked") List<StringOption> smisOptions = (List<StringOption>) renderArgs.get("smisStorageSystemTypeList");
smisOptions.add(new StringOption(VMAX, MessagesUtils.get(SMIS_VMAX)));
}
render(storageArray);
} else {
flash.error(MessagesUtils.get(UNKNOWN, id));
list();
}
}
Aggregations