use of com.emc.storageos.model.application.VolumeGroupRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getRemoveMobilityGroupResources.
@Asset("removeMobilityGroupResource")
@AssetDependencies("mobilityGroup")
public List<AssetOption> getRemoveMobilityGroupResources(AssetOptionsContext ctx, URI mobilityGroupId) {
final ViPRCoreClient client = api(ctx);
VolumeGroupRestRep mobilityGroup = client.application().get(mobilityGroupId);
if (mobilityGroup.getMigrationGroupBy().equals(VolumeGroup.MigrationGroupBy.VOLUMES.name())) {
return createNamedResourceOptions(client.application().listVolumes(mobilityGroupId));
} else if (mobilityGroup.getMigrationGroupBy().equals(VolumeGroup.MigrationGroupBy.HOSTS.name())) {
return createNamedResourceOptions(client.application().getHosts(mobilityGroupId));
} else if (mobilityGroup.getMigrationGroupBy().equals(VolumeGroup.MigrationGroupBy.CLUSTERS.name())) {
return createNamedResourceOptions(client.application().getClusters(mobilityGroupId));
} else {
return Lists.newArrayList();
}
}
use of com.emc.storageos.model.application.VolumeGroupRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getApplications.
@Asset("application")
public List<AssetOption> getApplications(AssetOptionsContext ctx) {
final ViPRCoreClient client = api(ctx);
List<VolumeGroupRestRep> volumeGroups = client.application().getApplications(new DefaultResourceFilter<VolumeGroupRestRep>() {
@Override
public boolean accept(VolumeGroupRestRep volumeGroup) {
if (volumeGroup.getRoles() != null && volumeGroup.getRoles().contains(VolumeGroup.VolumeGroupRole.COPY.name())) {
return true;
} else {
return false;
}
}
});
return createBaseResourceOptions(volumeGroups);
}
use of com.emc.storageos.model.application.VolumeGroupRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getApplicationSourceVolumes.
@Asset("sourceBlockVolumeForAddToApplication")
@AssetDependencies({ "consistencyGroupAll" })
public List<AssetOption> getApplicationSourceVolumes(AssetOptionsContext ctx, URI cg) {
final ViPRCoreClient client = api(ctx);
VolumeGroupList applications = client.application().getApplications();
List<URI> applicationIds = new ArrayList<URI>();
for (NamedRelatedResourceRep volumeGroup : applications.getVolumeGroups()) {
VolumeGroupRestRep vg = client.application().getApplication(volumeGroup.getId());
if (vg.getRoles().contains("COPY")) {
applicationIds.add(volumeGroup.getId());
}
}
ResourceFilter<VolumeRestRep> cgFilter = new BlockVolumeConsistencyGroupFilter(cg, false);
List<ProjectRestRep> projects = api(ctx).projects().getByTenant(ctx.getTenant());
List<VolumeRestRep> volumes = new ArrayList<VolumeRestRep>();
for (ProjectRestRep project : projects) {
volumes.addAll(listSourceVolumes(api(ctx), project.getId(), cgFilter));
}
List<VolumeRestRep> volumesNotInApplication = new ArrayList<VolumeRestRep>();
for (VolumeRestRep volume : volumes) {
if (volume.getVolumeGroups() != null && !volume.getVolumeGroups().isEmpty()) {
boolean volumeIsInApplication = false;
for (RelatedResourceRep rep : volume.getVolumeGroups()) {
if (applicationIds.contains(rep.getId())) {
volumeIsInApplication = true;
break;
}
}
if (!volumeIsInApplication) {
volumesNotInApplication.add(volume);
}
} else {
volumesNotInApplication.add(volume);
}
}
return createVolumeOptions(null, volumesNotInApplication);
}
use of com.emc.storageos.model.application.VolumeGroupRestRep in project coprhd-controller by CoprHD.
the class BlockProviderUtils method getApplicationReplicationGroupNames.
/**
* returns the list of application sub groups for an application
*
* @param viprClient
* @param applicationId
* @return
*/
public static Set<String> getApplicationReplicationGroupNames(ViPRCoreClient viprClient, URI applicationId) {
VolumeGroupRestRep application = viprClient.application().getApplication(applicationId);
Set<String> visibleGroups = new HashSet<String>();
Set<String> groupNames = application.getReplicationGroupNames();
for (String grp : groupNames) {
if (!isRPTargetReplicationGroup(grp)) {
visibleGroups.add(grp);
}
}
return visibleGroups;
}
use of com.emc.storageos.model.application.VolumeGroupRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getMobilityGroups.
@Asset("mobilityGroup")
public List<AssetOption> getMobilityGroups(AssetOptionsContext ctx) {
final ViPRCoreClient client = api(ctx);
List<VolumeGroupRestRep> volumeGroups = client.application().getApplications(new DefaultResourceFilter<VolumeGroupRestRep>() {
@Override
public boolean accept(VolumeGroupRestRep volumeGroup) {
if (volumeGroup.getRoles() != null && volumeGroup.getRoles().contains(VolumeGroup.VolumeGroupRole.MOBILITY.name())) {
return true;
} else {
return false;
}
}
});
return createBaseResourceOptions(volumeGroups);
}
Aggregations