use of com.emc.storageos.model.portgroup.StoragePortGroupRestRepList in project coprhd-controller by CoprHD.
the class BlockProvider method getCurrentExportPortGroups.
@Asset("exportCurrentPortGroup")
@AssetDependencies({ "host", "exportPathExport", "exportPathStorageSystem", "exportPathVirtualArray" })
public List<AssetOption> getCurrentExportPortGroups(AssetOptionsContext ctx, URI hostOrClusterId, URI exportId, URI storageSystemId, URI varrayId) {
final ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
SimpleValueRep value = client.customConfigs().getCustomConfigTypeValue(VMAX_PORT_GROUP_ENABLED, VMAX);
if (value.getValue().equalsIgnoreCase("true")) {
StoragePortGroupRestRepList portGroups = client.varrays().getStoragePortGroups(varrayId, exportId, storageSystemId, null, null, false);
return createPortGroupOptions(portGroups.getStoragePortGroups());
}
return options;
}
use of com.emc.storageos.model.portgroup.StoragePortGroupRestRepList in project coprhd-controller by CoprHD.
the class BlockProvider method getExportPortGroups.
@Asset("exportChangePortGroup")
@AssetDependencies({ "host", "exportPathStorageSystem", "exportPathVirtualArray", "exportCurrentPortGroup" })
public List<AssetOption> getExportPortGroups(AssetOptionsContext ctx, URI hostOrClusterId, URI storageSystemId, URI varrayId, URI exportCurrentPortGroupId) {
final ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
SimpleValueRep value = client.customConfigs().getCustomConfigTypeValue(VMAX_PORT_GROUP_ENABLED, VMAX);
if (value.getValue().equalsIgnoreCase("true")) {
StoragePortGroupRestRepList portGroupsRestRep = client.varrays().getStoragePortGroups(varrayId, null, storageSystemId, null, null, true);
// Get a handle of the actual port group list
List<StoragePortGroupRestRep> portGroups = portGroupsRestRep.getStoragePortGroups();
// Filter out the current port group as we do not want the user to see this an a valid option
ResourceFilter<StoragePortGroupRestRep> filterExistingPG = new DefaultResourceFilter<StoragePortGroupRestRep>() {
@Override
public boolean accept(StoragePortGroupRestRep pg) {
return !pg.getId().equals(exportCurrentPortGroupId);
}
};
ResourceUtils.applyFilter(portGroups, filterExistingPG);
return createPortGroupOptions(portGroups);
}
return options;
}
use of com.emc.storageos.model.portgroup.StoragePortGroupRestRepList in project coprhd-controller by CoprHD.
the class BlockProvider method getExportVolumeForComputePortGroups.
@Asset("exportVolumeForComputePortGroups")
@AssetDependencies({ "blockVirtualArray", "blockVirtualPool", "project" })
public List<AssetOption> getExportVolumeForComputePortGroups(AssetOptionsContext ctx, URI vArrayId, URI vpoolId, URI projectId) {
final ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
SimpleValueRep value = client.customConfigs().getCustomConfigTypeValue(VMAX_PORT_GROUP_ENABLED, VMAX);
if (value.getValue().equalsIgnoreCase("true")) {
StoragePortGroupRestRepList portGroups = client.varrays().getStoragePortGroups(vArrayId, null, null, vpoolId, null, true);
return createPortGroupOptions(portGroups.getStoragePortGroups());
}
return options;
}
use of com.emc.storageos.model.portgroup.StoragePortGroupRestRepList in project coprhd-controller by CoprHD.
the class BlockProvider method getExportPathPorts.
@Asset("exportPathPorts")
@AssetDependencies({ "exportPathVirtualArray", "exportPathStorageSystem", "exportPathExport" })
public List<AssetOption> getExportPathPorts(AssetOptionsContext ctx, URI vArrayId, URI storageSystemId, URI exportId) {
ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
// Get all the PGs for the varray/storage system/EG combo then check to
// see if there are any non-mutable PGs;
// if there are the storage ports displayed to the user would be limited
// to just those ones.
StoragePortGroupRestRepList portGroupsRestRep = client.varrays().getStoragePortGroups(vArrayId, exportId, storageSystemId, null, null, false);
// Keep a list of ports from the non-mutable PGs. This could remain
// empty if there are no PGs or none that are non-mutable.
List<URI> nonMutablePGPortURIs = new ArrayList<URI>();
if (portGroupsRestRep != null) {
// Drill down to get the PG and the storage ports
List<StoragePortGroupRestRep> portGroups = portGroupsRestRep.getStoragePortGroups();
if (!CollectionUtils.isEmpty(portGroups)) {
for (StoragePortGroupRestRep pg : portGroups) {
// Check to see if the PG is non-mutable
if (!pg.getMutable()) {
// Keep track of these storage ports, they will be used
// to filter out
// other storage ports.
StoragePortList pgPortsList = pg.getStoragePorts();
List<NamedRelatedResourceRep> pgPorts = pgPortsList.getPorts();
for (NamedRelatedResourceRep pgPort : pgPorts) {
nonMutablePGPortURIs.add(pgPort.getId());
}
}
}
}
}
List<StoragePortRestRep> ports = client.storagePorts().getByVirtualArray(vArrayId);
for (StoragePortRestRep port : ports) {
// Check to see if this port needs to be filtered out.
boolean filterOutPortBasedOnPG = (!nonMutablePGPortURIs.isEmpty()) ? !nonMutablePGPortURIs.contains(port.getId()) : false;
if (!filterOutPortBasedOnPG) {
if (port.getPortType().equals(StoragePort.PortType.frontend.toString()) && port.getStorageDevice().getId().equals(storageSystemId) && port.getOperationalStatus().equals(StoragePort.OperationalStatus.OK.toString())) {
if (port.getNetwork() != null) {
String portPercentBusy = (port.getPortPercentBusy() != null) ? String.valueOf(Math.round(port.getPortPercentBusy() * 100 / 100)) + "%" : "N/A";
String networkName = client.networks().get(port.getNetwork().getId()).getName();
String label = getMessage("exportPathAdjustment.ports", port.getPortName(), networkName, port.getPortNetworkId(), portPercentBusy);
options.add(new AssetOption(port.getId(), label));
}
}
}
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.portgroup.StoragePortGroupRestRepList in project coprhd-controller by CoprHD.
the class BlockProvider method getExportVolumeForHostPortGroups.
@Asset("exportVolumeForHostPortGroups")
@AssetDependencies({ "virtualArray", "blockVirtualPool", "host", "project" })
public List<AssetOption> getExportVolumeForHostPortGroups(AssetOptionsContext ctx, URI vArrayId, URI vpoolId, URI hostOrClusterId, URI projectId) {
final ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
SimpleValueRep value = client.customConfigs().getCustomConfigTypeValue(VMAX_PORT_GROUP_ENABLED, VMAX);
if (value.getValue().equalsIgnoreCase("true")) {
ExportGroupRestRep export = findExportGroup(hostOrClusterId, projectId, vArrayId, client);
StoragePortGroupRestRepList portGroups = client.varrays().getStoragePortGroups(vArrayId, (export != null ? export.getId() : null), null, vpoolId, null, true);
return createPortGroupOptions(portGroups.getStoragePortGroups());
}
return options;
}
Aggregations