use of com.emc.storageos.db.client.model.ProtectionSystem in project coprhd-controller by CoprHD.
the class ExportUtilsTestUtils method createProtectionSystem.
public static ProtectionSystem createProtectionSystem(DbClient _dbClient, String type, String label, String cluster1, String cluster2, String cluster3, String protocol, StringSetMap siteInitiators, StringSet associatedStorageSystems, StringSetMap rpVisibleArrays, Long cgCapacity, Long cgCount, StringMap siteVolCap, StringMap siteVolCnt) {
ProtectionSystem proSystem = new ProtectionSystem();
String topology = proSystem.assembleClusterTopology(cluster1, cluster2, protocol);
String topology2 = proSystem.assembleClusterTopology(cluster2, cluster1, protocol);
StringSet cluTopo = new StringSet();
cluTopo.add(topology);
cluTopo.add(topology2);
if (cluster3 != null) {
String topology3 = proSystem.assembleClusterTopology(cluster1, cluster3, protocol);
String topology4 = proSystem.assembleClusterTopology(cluster3, cluster1, protocol);
String topology5 = proSystem.assembleClusterTopology(cluster2, cluster3, protocol);
String topology6 = proSystem.assembleClusterTopology(cluster3, cluster2, protocol);
cluTopo.add(topology3);
cluTopo.add(topology4);
cluTopo.add(topology5);
cluTopo.add(topology6);
}
proSystem.setClusterTopology(cluTopo);
proSystem.setSiteInitiators(siteInitiators);
proSystem.setId(URI.create(label));
proSystem.setLabel(label);
proSystem.setInactive(false);
proSystem.setSystemType(type);
proSystem.setRegistrationStatus(RegistrationStatus.REGISTERED.name());
proSystem.setReachableStatus(true);
proSystem.setAssociatedStorageSystems(associatedStorageSystems);
proSystem.setCgCapacity(cgCapacity);
proSystem.setCgCount(cgCount);
proSystem.setSiteVolumeCapacity(siteVolCap);
proSystem.setSiteVolumeCount(siteVolCnt);
proSystem.setSiteVisibleStorageArrays(rpVisibleArrays);
StringMap siteNames = new StringMap();
siteNames.put(cluster1, cluster1);
siteNames.put(cluster2, cluster2);
if (null != cluster3) {
siteNames.put(cluster3, cluster3);
}
proSystem.setRpSiteNames(siteNames);
_dbClient.createObject(proSystem);
return proSystem;
}
use of com.emc.storageos.db.client.model.ProtectionSystem in project coprhd-controller by CoprHD.
the class PlacementTestUtils method createProtectionSystem.
public static ProtectionSystem createProtectionSystem(DbClient dbClient, String type, String label, String cluster1, String cluster2, String cluster3, String protocol, StringSetMap siteInitiators, StringSet associatedStorageSystems, StringSetMap rpVisibleArrays, Long cgCapacity, Long cgCount, StringMap siteVolCap, StringMap siteVolCnt) {
ProtectionSystem ps = new ProtectionSystem();
String topology = ps.assembleClusterTopology(cluster1, cluster2, protocol);
String topology2 = ps.assembleClusterTopology(cluster2, cluster1, protocol);
StringSet clusterTopology = new StringSet();
clusterTopology.add(topology);
clusterTopology.add(topology2);
if (cluster3 != null) {
String topology3 = ps.assembleClusterTopology(cluster1, cluster3, protocol);
String topology4 = ps.assembleClusterTopology(cluster3, cluster1, protocol);
String topology5 = ps.assembleClusterTopology(cluster2, cluster3, protocol);
String topology6 = ps.assembleClusterTopology(cluster3, cluster2, protocol);
clusterTopology.add(topology3);
clusterTopology.add(topology4);
clusterTopology.add(topology5);
clusterTopology.add(topology6);
}
ps.setClusterTopology(clusterTopology);
ps.setSiteInitiators(siteInitiators);
ps.setId(URI.create(label));
ps.setLabel(label);
ps.setInactive(false);
ps.setSystemType(type);
ps.setRegistrationStatus(RegistrationStatus.REGISTERED.name());
ps.setReachableStatus(true);
ps.setAssociatedStorageSystems(associatedStorageSystems);
ps.setCgCapacity(cgCapacity);
ps.setCgCount(cgCount);
ps.setSiteVolumeCapacity(siteVolCap);
ps.setSiteVolumeCount(siteVolCnt);
ps.setSiteVisibleStorageArrays(rpVisibleArrays);
StringMap siteNames = new StringMap();
siteNames.put(cluster1, cluster1);
siteNames.put(cluster2, cluster2);
if (null != cluster3) {
siteNames.put(cluster3, cluster3);
}
ps.setRpSiteNames(siteNames);
dbClient.createObject(ps);
return ps;
}
use of com.emc.storageos.db.client.model.ProtectionSystem in project coprhd-controller by CoprHD.
the class ProtectionSystemService method discoverProtectionSystemsAll.
/**
* Allows the user to manually discover all protection systems.
*
* @brief Discover all protection systems
*/
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
@Path("/discover")
public TaskList discoverProtectionSystemsAll() {
Iterator<URI> protectionIter = _dbClient.queryByType(ProtectionSystem.class, true).iterator();
ArrayList<AsyncTask> tasks = new ArrayList<AsyncTask>();
while (protectionIter.hasNext()) {
URI protection = protectionIter.next();
String taskId = UUID.randomUUID().toString();
tasks.add(new AsyncTask(ProtectionSystem.class, protection, taskId));
}
ProtectionController controller = getController(RPController.class, ProtectionSystem._RP);
return discoverProtectionSystems(tasks, controller);
}
use of com.emc.storageos.db.client.model.ProtectionSystem in project coprhd-controller by CoprHD.
the class ProtectionSystemService method createProtectionSystem.
/**
* Allow the user to manually create a protection system.
*
* @param param The protection system details.
*
* @brief Create protection system
* @return An asynchronous task corresponding to the discovery job scheduled for the new Protection System.
*
* @throws BadRequestException When the system type is not valid or a
* protection system with the same native guid already exists.
* @throws DatabaseException When an error occurs querying the database.
* @throws ControllerException When an error occurs discovering the protection
* system.
*/
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_ADMIN, Role.RESTRICTED_SYSTEM_ADMIN })
public TaskResourceRep createProtectionSystem(ProtectionSystemRequestParam param) throws Exception {
ProtectionSystem system = null;
ProtectionSystem.Type systemType = ProtectionSystem.Type.valueOf(param.getSystemType());
if (!systemType.equals(ProtectionSystem.Type.rp)) {
throw APIException.badRequests.cannotRegisterSystemWithType(systemType.name());
}
system = new ProtectionSystem();
system.setId(URIUtil.createId(ProtectionSystem.class));
system.setSystemType(systemType.name());
system.setRegistrationStatus(RegistrationStatus.REGISTERED.toString());
system.setIpAddress(param.getIpAddress());
system.setPortNumber(param.getPortNumber());
system.setUsername(param.getUserName());
system.setPassword(param.getPassword());
system.setLabel(param.getLabel());
system.setDiscoveryStatus(DiscoveredDataObject.DataCollectionJobStatus.CREATED.toString());
_dbClient.createObject(system);
auditOp(OperationTypeEnum.CREATE_PROTECTION_SYSTEM, true, null, param.getLabel(), systemType.name(), param.getIpAddress(), param.getPortNumber(), param.getUserName(), system.getId().toString());
startProtectionSystem(system);
ProtectionController controller = getController(RPController.class, ProtectionSystem._RP);
ArrayList<AsyncTask> tasks = new ArrayList<AsyncTask>(1);
String taskId = UUID.randomUUID().toString();
tasks.add(new AsyncTask(ProtectionSystem.class, system.getId(), taskId));
TaskList taskList = discoverProtectionSystems(tasks, controller);
return taskList.getTaskList().listIterator().next();
}
use of com.emc.storageos.db.client.model.ProtectionSystem in project coprhd-controller by CoprHD.
the class RPBlockServiceApiImpl method logVolumeInfo.
/**
* Helper method to display volume attributes as they are prepared.
*
* @param volume
*/
private String logVolumeInfo(Volume volume) {
StringBuilder buf = new StringBuilder();
if (null != volume && !NullColumnValueGetter.isNullURI(volume.getId())) {
VirtualArray varray = _dbClient.queryObject(VirtualArray.class, volume.getVirtualArray());
VirtualPool vpool = _dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
ProtectionSystem ps = _dbClient.queryObject(ProtectionSystem.class, volume.getProtectionController());
BlockConsistencyGroup consistencyGroup = _dbClient.queryObject(BlockConsistencyGroup.class, volume.getConsistencyGroup());
buf.append(String.format("%nPreparing RP %s Volume:%n", volume.getPersonality()));
buf.append(String.format("\t Name : [%s] (%s)%n", volume.getLabel(), volume.getId()));
buf.append(String.format("\t Personality : [%s]%n", volume.getPersonality()));
if (RPHelper.isVPlexVolume(volume, _dbClient) && (null != volume.getAssociatedVolumes())) {
buf.append(String.format("\t VPLEX : [%s] %n", ((volume.getAssociatedVolumes().size() > 1) ? "Distributed" : "Local")));
buf.append(String.format("\t\t====="));
for (String uriString : volume.getAssociatedVolumes()) {
Volume backingVolume = _dbClient.queryObject(Volume.class, URI.create(uriString));
VirtualArray backingVolumeVarray = _dbClient.queryObject(VirtualArray.class, backingVolume.getVirtualArray());
VirtualPool backingVolumeVpool = _dbClient.queryObject(VirtualPool.class, backingVolume.getVirtualPool());
StorageSystem backingVolumeStorageSystem = _dbClient.queryObject(StorageSystem.class, backingVolume.getStorageController());
StoragePool backingVolumePool = _dbClient.queryObject(StoragePool.class, backingVolume.getPool());
buf.append(String.format("%n\t\t Backing Volume Name : [%s] (%s)%n", backingVolume.getLabel(), backingVolume.getId()));
buf.append(String.format("\t\t Backing Volume Virtual Array : [%s] (%s) %n", backingVolumeVarray.getLabel(), backingVolumeVarray.getId()));
buf.append(String.format("\t\t Backing Volume Virtual Pool : [%s] (%s) %n", backingVolumeVpool.getLabel(), backingVolumeVpool.getId()));
buf.append(String.format("\t\t Backing Volume Storage System : [%s] (%s) %n", backingVolumeStorageSystem.getLabel(), backingVolumeStorageSystem.getId()));
buf.append(String.format("\t\t Backing Volume Storage Pool : [%s] (%s) %n", backingVolumePool.getLabel(), backingVolumePool.getId()));
if (NullColumnValueGetter.isNotNullValue(backingVolume.getInternalSiteName())) {
String internalSiteName = ((ps.getRpSiteNames() != null) ? ps.getRpSiteNames().get(backingVolume.getInternalSiteName()) : backingVolume.getInternalSiteName());
buf.append(String.format("\t\t Backing Volume RP Internal Site : [%s %s] %n", internalSiteName, backingVolume.getInternalSiteName()));
buf.append(String.format("\t\t Backing Volume RP Copy Name : [%s] %n", backingVolume.getRpCopyName()));
}
}
buf.append(String.format("\t\t=====%n"));
}
buf.append(String.format("\t Consistency Group : [%s] (%s)%n", consistencyGroup.getLabel(), consistencyGroup.getId()));
buf.append(String.format("\t Virtual Array : [%s] (%s)%n", varray.getLabel(), varray.getId()));
buf.append(String.format("\t Virtual Pool : [%s] (%s)%n", vpool.getLabel(), vpool.getId()));
buf.append(String.format("\t Capacity : [%s] %n", volume.getCapacity()));
if (!NullColumnValueGetter.isNullURI(volume.getStorageController())) {
StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, volume.getStorageController());
buf.append(String.format("\t Storage System : [%s] (%s)%n", storageSystem.getLabel(), storageSystem.getId()));
}
if (!NullColumnValueGetter.isNullURI(volume.getPool())) {
StoragePool pool = _dbClient.queryObject(StoragePool.class, volume.getPool());
buf.append(String.format("\t Storage Pool : [%s] (%s)%n", pool.getLabel(), pool.getId()));
}
if (!NullColumnValueGetter.isNullURI(volume.getAutoTieringPolicyUri())) {
AutoTieringPolicy policy = _dbClient.queryObject(AutoTieringPolicy.class, volume.getAutoTieringPolicyUri());
buf.append(String.format("\t Auto Tier Policy : [%s]%n", policy.getPolicyName()));
}
buf.append(String.format("\t RP Protection System : [%s] (%s)%n", ps.getLabel(), ps.getId()));
buf.append(String.format("\t RP Replication Set : [%s]%n", volume.getRSetName()));
if (Volume.PersonalityTypes.SOURCE.name().equals(volume.getPersonality())) {
buf.append(String.format("\t RP MetroPoint enabled : [%s]%n", (VirtualPool.vPoolSpecifiesMetroPoint(vpool) ? "true" : "false")));
}
if (volume.getRpTargets() != null && !volume.getRpTargets().isEmpty()) {
buf.append(String.format("\t RP Target Volume(s) for Source : ["));
for (String targetVolumeId : volume.getRpTargets()) {
Volume targetVolume = _dbClient.queryObject(Volume.class, URI.create(targetVolumeId));
buf.append(String.format("%s, ", targetVolume.getLabel()));
}
int endIndex = buf.length();
buf.delete(endIndex - 2, endIndex);
buf.append(String.format("]%n"));
}
String internalSiteName = ((ps.getRpSiteNames() != null) ? ps.getRpSiteNames().get(volume.getInternalSiteName()) : volume.getInternalSiteName());
buf.append(String.format("\t RP Internal Site : [%s %s]%n", internalSiteName, volume.getInternalSiteName()));
buf.append(String.format("\t RP Copy Name : [%s]%n", volume.getRpCopyName()));
}
return buf.toString();
}
Aggregations