use of com.emc.storageos.db.client.model.NamedURI in project coprhd-controller by CoprHD.
the class PlacementTests method testPlacementRpMetropointCdp.
/*
* MetroPoint placement - 2 local copies, one on each side
*
* NOTE: Force negative MP CDP test by following instructions labeled with "NEGATIVE-TEST"
*/
@Test
public void testPlacementRpMetropointCdp() {
String[] vmax1FE = { "50:FE:FE:FE:FE:FE:FE:00", "50:FE:FE:FE:FE:FE:FE:01" };
String[] vmax1BE = { "50:BE:BE:BE:BE:BE:BE:00", "50:BE:BE:BE:BE:BE:BE:01" };
String[] vmax2FE = { "51:FE:FE:FE:FE:FE:FE:00", "51:FE:FE:FE:FE:FE:FE:01" };
String[] vmax2BE = { "51:BE:BE:BE:BE:BE:BE:00", "51:BE:BE:BE:BE:BE:BE:01" };
String[] vmax3FE = { "52:FE:FE:FE:FE:FE:FE:00", "52:FE:FE:FE:FE:FE:FE:01" };
String[] vmax3BE = { "52:BE:BE:BE:BE:BE:BE:00", "52:BE:BE:BE:BE:BE:BE:01" };
String[] vnx1FE = { "60:FE:FE:FE:FE:FE:FE:00", "60:FE:FE:FE:FE:FE:FE:01" };
String[] vnx1BE = { "60:BE:BE:BE:BE:BE:BE:00", "60:BE:BE:BE:BE:BE:BE:01" };
String[] vnx2FE = { "61:FE:FE:FE:FE:FE:FE:00", "61:FE:FE:FE:FE:FE:FE:01" };
String[] vnx2BE = { "61:BE:BE:BE:BE:BE:BE:00", "62:BE:BE:BE:BE:BE:BE:01" };
String[] vnx3FE = { "62:FE:FE:FE:FE:FE:FE:00", "62:FE:FE:FE:FE:FE:FE:01" };
String[] vnx3BE = { "62:BE:BE:BE:BE:BE:BE:00", "62:BE:BE:BE:BE:BE:BE:01" };
String[] rp1FE = { "53:FE:FE:FE:FE:FE:FE:00", "53:FE:FE:FE:FE:FE:FE:01" };
String[] rp2FE = { "54:FE:FE:FE:FE:FE:FE:00", "54:FE:FE:FE:FE:FE:FE:01" };
String[] rp3FE = { "55:FE:FE:FE:FE:FE:FE:00", "55:FE:FE:FE:FE:FE:FE:01" };
// vplex1 cluster1
String[] vplex11FE = { "FE:FE:FE:FE:FE:FE:FE:00", "FE:FE:FE:FE:FE:FE:FE:01" };
String[] vplex11BE = { "BE:BE:BE:BE:BE:BE:BE:00", "BE:BE:BE:BE:BE:BE:BE:01" };
// vplex1 cluster2
String[] vplex12FE = { "FE:FE:FE:FE:FE:FE:FE:02", "FE:FE:FE:FE:FE:FE:FE:03" };
String[] vplex12BE = { "BE:BE:BE:BE:BE:BE:BE:02", "BE:BE:BE:BE:BE:BE:BE:03" };
// vplex2 cluster1
String[] vplex21FE = { "FE:FE:FE:FE:FE:FE:FE:04", "FE:FE:FE:FE:FE:FE:FE:05" };
String[] vplex21BE = { "BE:BE:BE:BE:BE:BE:BE:04", "BE:BE:BE:BE:BE:BE:BE:05" };
// Create 3 Virtual Arrays
VirtualArray srcVarray = PlacementTestUtils.createVirtualArray(_dbClient, "srcVarray");
VirtualArray haVarray = PlacementTestUtils.createVirtualArray(_dbClient, "haVarray");
VirtualArray activeTgtVarray = PlacementTestUtils.createVirtualArray(_dbClient, "activeTgtVarray");
VirtualArray standbyTgtVarray = PlacementTestUtils.createVirtualArray(_dbClient, "standbyTgtVarray");
// Create Journal Varrays
VirtualArray srcJournalVarray = PlacementTestUtils.createVirtualArray(_dbClient, "srcJournalVarray");
VirtualArray haJournalVarray = PlacementTestUtils.createVirtualArray(_dbClient, "haJournalVarray");
VirtualArray tgtJournalVarray = PlacementTestUtils.createVirtualArray(_dbClient, "tgtJournalVarray");
// Create network for VPLEX source side
StringSet sourceConnectedVa = new StringSet();
sourceConnectedVa.add(srcVarray.getId().toString());
sourceConnectedVa.add(activeTgtVarray.getId().toString());
sourceConnectedVa.add(srcJournalVarray.getId().toString());
// create network for VPLEX HA side
StringSet haConnectedVa = new StringSet();
haConnectedVa.add(haVarray.getId().toString());
haConnectedVa.add(standbyTgtVarray.getId().toString());
haConnectedVa.add(haJournalVarray.getId().toString());
Network sourceNetwork = PlacementTestUtils.createNetwork(_dbClient, vplex11FE, "VSAN", "FC+BROCADE", sourceConnectedVa);
PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vplex11BE);
PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, rp1FE);
PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, rp3FE);
PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vmax1FE);
PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vmax1BE);
PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vmax3FE);
PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vmax3BE);
PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vnx1FE);
PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vnx1BE);
PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vnx3FE);
PlacementTestUtils.addEndpoints(_dbClient, sourceNetwork, vnx3BE);
Network haNetwork = PlacementTestUtils.createNetwork(_dbClient, vplex12FE, "VSAN", "FC+BROCADE", haConnectedVa);
PlacementTestUtils.addEndpoints(_dbClient, haNetwork, vplex12BE);
PlacementTestUtils.addEndpoints(_dbClient, haNetwork, rp2FE);
PlacementTestUtils.addEndpoints(_dbClient, haNetwork, vmax2FE);
PlacementTestUtils.addEndpoints(_dbClient, haNetwork, vmax2BE);
PlacementTestUtils.addEndpoints(_dbClient, haNetwork, vnx2FE);
PlacementTestUtils.addEndpoints(_dbClient, haNetwork, vnx2BE);
// Create 3 storage systems
StorageSystem vmaxStorageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax1");
StorageSystem vmaxStorageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax2");
StorageSystem vmaxStorageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "vmax", "vmax3");
StorageSystem vnxStorageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vnxblock", "vnx1");
StorageSystem vnxStorageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vnxblock", "vnx2");
StorageSystem vnxStorageSystem3 = PlacementTestUtils.createStorageSystem(_dbClient, "vnxblock", "vnx3");
// Create two front-end storage ports VMAX1
List<StoragePort> vmax1Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vmax1FE.length; i++) {
vmax1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vmaxStorageSystem1, sourceNetwork, vmax1FE[i], srcVarray, StoragePort.PortType.frontend.name(), "portGroupvmax1" + i, "FE0+FC0" + i));
}
// Create two front-end storage ports VMAX1
vmax1Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vmax1BE.length; i++) {
vmax1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vmaxStorageSystem1, sourceNetwork, vmax1BE[i], srcVarray, StoragePort.PortType.backend.name(), "portGroupvmax1" + i, "BE0+FC0" + i));
}
// Create two front-end storage ports VMAX2
List<StoragePort> vmax2Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vmax2FE.length; i++) {
vmax2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vmaxStorageSystem2, haNetwork, vmax2FE[i], haVarray, StoragePort.PortType.frontend.name(), "portGroupvmax2" + i, "D0+FC0" + i));
}
for (int i = 0; i < vmax2FE.length; i++) {
vmax2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vmaxStorageSystem2, haNetwork, vmax2FE[i], standbyTgtVarray, StoragePort.PortType.frontend.name(), "portGroupvmax2" + i, "D0+FC0" + i));
}
// Create two front-end storage ports VMAX3
List<StoragePort> vmax3Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vmax3FE.length; i++) {
vmax3Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vmaxStorageSystem3, sourceNetwork, vmax3FE[i], srcVarray, StoragePort.PortType.frontend.name(), "portGroupvmax3" + i, "E0+FC0" + i));
}
// Create two front-end storage ports VNX1
List<StoragePort> vnx1Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vnx1FE.length; i++) {
vnx1Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vnxStorageSystem1, sourceNetwork, vnx1FE[i], srcJournalVarray, StoragePort.PortType.frontend.name(), "portGroupvnx1" + i, "C1+FC1" + i));
}
// Create two front-end storage ports VNX2
List<StoragePort> vnx2Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vnx2FE.length; i++) {
vnx2Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vnxStorageSystem2, sourceNetwork, vnx2FE[i], haJournalVarray, StoragePort.PortType.frontend.name(), "portGroupvnx2" + i, "D1+FC1" + i));
}
// Create two front-end storage ports VNX3
List<StoragePort> vnx3Ports = new ArrayList<StoragePort>();
for (int i = 0; i < vnx1FE.length; i++) {
vnx3Ports.add(PlacementTestUtils.createStoragePort(_dbClient, vnxStorageSystem3, sourceNetwork, vnx3FE[i], tgtJournalVarray, StoragePort.PortType.frontend.name(), "portGroupvnx3" + i, "E1+FC1" + i));
}
// Create 2 VPLEX storage systems
StorageSystem vplexStorageSystem1 = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex1");
StorageSystem vplexStorageSystem2 = PlacementTestUtils.createStorageSystem(_dbClient, "vplex", "vplex2");
// Create two back-end storage ports VPLEX1cluster1
List<StoragePort> fePorts1 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex11FE.length; i++) {
fePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, sourceNetwork, vplex11FE[i], srcVarray, StoragePort.PortType.frontend.name(), "portGroupFE1-" + (i + 1), "A0+FC0" + i));
}
// Create two back-end storage ports VPLEX1cluster1
List<StoragePort> bePorts1 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex11BE.length; i++) {
bePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, sourceNetwork, vplex11BE[i], srcVarray, StoragePort.PortType.backend.name(), "portGroupBE1-" + (i + 1), "B0+FC0" + i));
}
// Create two front-end storage ports VPLEX1cluster2
List<StoragePort> fePorts2 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex12FE.length; i++) {
fePorts2.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, haNetwork, vplex12FE[i], haVarray, StoragePort.PortType.frontend.name(), "portGroupFE2-" + (i + 1), "F0+FC0" + i));
}
// Create two back-end storage ports VPLEX1cluster2
List<StoragePort> bePorts2 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex12BE.length; i++) {
bePorts2.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem1, haNetwork, vplex12BE[i], haVarray, StoragePort.PortType.backend.name(), "portGroupBE2-" + (i + 1), "G0+FC0" + i));
}
// List<StoragePort> fePorts3 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex21FE.length; i++) {
fePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem2, sourceNetwork, vplex21FE[i], activeTgtVarray, StoragePort.PortType.frontend.name(), "portGroupFE3-" + (i + 1), "H0+FC0" + i));
}
// List<StoragePort> bePorts3 = new ArrayList<StoragePort>();
for (int i = 0; i < vplex21BE.length; i++) {
bePorts1.add(PlacementTestUtils.createStoragePort(_dbClient, vplexStorageSystem2, sourceNetwork, vplex21BE[i], activeTgtVarray, StoragePort.PortType.backend.name(), "portGroupBE3-" + (i + 1), "I0+FC0" + i));
}
// Create RP system
AbstractChangeTrackingSet<String> wwnSite1 = new StringSet();
for (int i = 0; i < rp1FE.length; i++) {
wwnSite1.add(rp1FE[i]);
}
StringSetMap initiatorsSiteMap = new StringSetMap();
initiatorsSiteMap.put("site1", wwnSite1);
AbstractChangeTrackingSet<String> wwnSite2 = new StringSet();
for (int i = 0; i < rp2FE.length; i++) {
wwnSite2.add(rp2FE[i]);
}
initiatorsSiteMap.put("site2", wwnSite2);
AbstractChangeTrackingSet<String> wwnSite3 = new StringSet();
for (int i = 0; i < rp3FE.length; i++) {
wwnSite3.add(rp3FE[i]);
}
initiatorsSiteMap.put("site3", wwnSite3);
StringSet storageSystems = new StringSet();
storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", "vplex1cluster1"));
storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", vnxStorageSystem1.getSerialNumber()));
storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", vmaxStorageSystem1.getSerialNumber()));
// ////////////////////////////////////////////////////////////////
// NEGATIVE-TEST Step 1/2:
// Change vmaxStorageSystem3 and vnxStorageSystem3 to site3 visibility below.
// What this will do is allow site1 to place to site3 as a REMOTE copy but will be invalid for a
// MP CDP setup as there is no LOCAL copy on the Active Source side.
//
// Need to ensure that the VPLEX is not fronting the Storage Systems, see Step 2/2.
//
// Result: Placement should exhaust it's options and fail.
// ////////////////////////////////////////////////////////////////
storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", vnxStorageSystem3.getSerialNumber()));
storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site1", vmaxStorageSystem3.getSerialNumber()));
storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", "vplex1cluster2"));
storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", vnxStorageSystem2.getSerialNumber()));
storageSystems.add(ProtectionSystem.generateAssociatedStorageSystem("site2", vmaxStorageSystem2.getSerialNumber()));
StringSetMap rpVisibleSystems = new StringSetMap();
StringSet storageIds = new StringSet();
storageIds.add(vplexStorageSystem1.getId().toString());
storageIds.add(vmaxStorageSystem1.getId().toString());
storageIds.add(vnxStorageSystem1.getId().toString());
storageIds.add(vmaxStorageSystem3.getId().toString());
storageIds.add(vnxStorageSystem3.getId().toString());
rpVisibleSystems.put("site1", storageIds);
StringSet storageIds2 = new StringSet();
storageIds2.add(vplexStorageSystem1.getId().toString());
storageIds2.add(vmaxStorageSystem2.getId().toString());
storageIds2.add(vnxStorageSystem2.getId().toString());
rpVisibleSystems.put("site2", storageIds2);
StringMap siteVolCap = new StringMap();
siteVolCap.put("site1", "3221225472");
siteVolCap.put("site2", "3221225472");
StringMap siteVolCnt = new StringMap();
siteVolCnt.put("site1", "10");
siteVolCnt.put("site2", "10");
ProtectionSystem rpSystem = PlacementTestUtils.createProtectionSystem(_dbClient, "rp", "rp1", "site1", "site2", "site3", "IP", initiatorsSiteMap, storageSystems, rpVisibleSystems, Long.valueOf("3221225472"), Long.valueOf("2"), siteVolCap, siteVolCnt);
// RP Site Array objects
RPSiteArray rpSiteArray1 = new RPSiteArray();
rpSiteArray1.setId(URI.create("rsa1"));
rpSiteArray1.setStorageSystem(URI.create("vplex1"));
rpSiteArray1.setRpInternalSiteName("site1");
rpSiteArray1.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray1);
RPSiteArray rpSiteArray2 = new RPSiteArray();
rpSiteArray2.setId(URI.create("rsa2"));
rpSiteArray2.setStorageSystem(URI.create("vplex1"));
rpSiteArray2.setRpInternalSiteName("site2");
rpSiteArray2.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray2);
RPSiteArray rpSiteArray3 = new RPSiteArray();
rpSiteArray3.setId(URI.create("rsa3"));
rpSiteArray3.setStorageSystem(URI.create("vplex2"));
rpSiteArray3.setRpInternalSiteName("site3");
rpSiteArray3.setRpProtectionSystem(rpSystem.getId());
_dbClient.createObject(rpSiteArray3);
// Create a storage pool for vmax1
StoragePool srcPool1 = PlacementTestUtils.createStoragePool(_dbClient, srcVarray, vmaxStorageSystem1, "SrcPool1", "SrcPool1", Long.valueOf(SIZE_GB * 75), Long.valueOf(SIZE_GB * 150), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax1
StoragePool srcPool2 = PlacementTestUtils.createStoragePool(_dbClient, srcVarray, vmaxStorageSystem1, "SrcPool2", "SrcPool2", Long.valueOf(SIZE_GB * 75), Long.valueOf(SIZE_GB * 150), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax1
StoragePool srcPool3 = PlacementTestUtils.createStoragePool(_dbClient, srcVarray, vmaxStorageSystem1, "SrcPool3", "SrcPool3", Long.valueOf(SIZE_GB * 200), Long.valueOf(SIZE_GB * 200), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax2
StoragePool haPool4 = PlacementTestUtils.createStoragePool(_dbClient, haVarray, vmaxStorageSystem2, "HaPool4", "HaPool4", Long.valueOf(SIZE_GB * 1024), Long.valueOf(SIZE_GB * 1024 * 1024), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax2
StoragePool haPool5 = PlacementTestUtils.createStoragePool(_dbClient, haVarray, vmaxStorageSystem2, "HaPool5", "HaPool5", Long.valueOf(SIZE_GB * 300), Long.valueOf(SIZE_GB * 300), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax2
// StoragePool haPool6 = PlacementTestUtils.createStoragePool(_dbClient, haVarray, vmaxStorageSystem2, "Hapool6", "HaPool6",
// Long.valueOf(1024 * 1024 * 1), Long.valueOf(1024 * 1024 * 1), 100, 100,
// StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
StoragePool haPool6 = PlacementTestUtils.createStoragePool(_dbClient, haVarray, vmaxStorageSystem3, "Hapool6", "HaPool6", Long.valueOf(SIZE_GB * 100), Long.valueOf(SIZE_GB * 300), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax3
StoragePool tgtPool7 = PlacementTestUtils.createStoragePool(_dbClient, srcVarray, vmaxStorageSystem3, "TgtPool7", "TgtPool7", Long.valueOf(SIZE_GB * 300), Long.valueOf(SIZE_GB * 300), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vmax3
StoragePool tgtPool8 = PlacementTestUtils.createStoragePool(_dbClient, haVarray, vmaxStorageSystem3, "Tgtpool8", "TgtPool8", Long.valueOf(SIZE_GB * 300), Long.valueOf(SIZE_GB * 300), 300, 300, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vnx1
StoragePool sjPool9 = PlacementTestUtils.createStoragePool(_dbClient, srcJournalVarray, vnxStorageSystem1, "Sjpool9", "SjPool9", Long.valueOf(SIZE_GB * 1024), Long.valueOf(SIZE_GB * 1024 * 1024), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vnx1
StoragePool hajPool10 = PlacementTestUtils.createStoragePool(_dbClient, haJournalVarray, vnxStorageSystem2, "HaJpool10", "HaJPool10", Long.valueOf(SIZE_GB * 1024), Long.valueOf(SIZE_GB * 1024 * 1024), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create a storage pool for vnx1
StoragePool tjPool11 = PlacementTestUtils.createStoragePool(_dbClient, tgtJournalVarray, vnxStorageSystem3, "Tjpool11", "TjPool11", Long.valueOf(SIZE_GB * 1024), Long.valueOf(SIZE_GB * 1024 * 1024), 100, 100, StoragePool.SupportedResourceTypes.THIN_ONLY.toString());
// Create HA vpool
// haPool6 should never be selected by placement
VirtualPool haVpool = new VirtualPool();
haVpool.setId(URI.create("urn:storageos:VirtualPool:11111111-2222-3333-4444-555555555555:vdc1"));
haVpool.setLabel("haVpool");
haVpool.setType("block");
haVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
haVpool.setDriveType(SupportedDriveTypes.FC.name());
haVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
StringSet matchedPools = new StringSet();
matchedPools.add(haPool4.getId().toString());
matchedPools.add(haPool5.getId().toString());
haVpool.setMatchedStoragePools(matchedPools);
StringSet virtualArrays1 = new StringSet();
virtualArrays1.add(haVarray.getId().toString());
haVpool.setVirtualArrays(virtualArrays1);
haVpool.setUseMatchedPools(true);
_dbClient.createObject(haVpool);
// Create HA Journal Vpool
VirtualPool haJournalVpool = new VirtualPool();
haJournalVpool.setId(URI.create("haJournalVpool"));
haJournalVpool.setLabel("haJournalVpool");
haJournalVpool.setType("block");
haJournalVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
// haJournalVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name()); //Uncomment this line to fail placement.
// haJournalVpool doesnt have a storagesystem that VPLEX can see
haJournalVpool.setDriveType(SupportedDriveTypes.FC.name());
matchedPools = new StringSet();
matchedPools.add(hajPool10.getId().toString());
haJournalVpool.setMatchedStoragePools(matchedPools);
StringSet haJournalVarrays = new StringSet();
haJournalVarrays.add(haJournalVarray.getId().toString());
haJournalVpool.setVirtualArrays(haJournalVarrays);
haJournalVpool.setUseMatchedPools(true);
_dbClient.createObject(haJournalVpool);
// Create tgt journal vpool
VirtualPool tgtJournalVpool = new VirtualPool();
tgtJournalVpool.setId(URI.create("tgtJournalVpool"));
tgtJournalVpool.setLabel("tgtJournalVpool");
tgtJournalVpool.setType("block");
tgtJournalVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
tgtJournalVpool.setDriveType(SupportedDriveTypes.FC.name());
matchedPools = new StringSet();
matchedPools.add(tjPool11.getId().toString());
tgtJournalVpool.setMatchedStoragePools(matchedPools);
StringSet tgtJournalVarrays = new StringSet();
tgtJournalVarrays.add(tgtJournalVarray.getId().toString());
tgtJournalVpool.setVirtualArrays(tgtJournalVarrays);
tgtJournalVpool.setUseMatchedPools(true);
_dbClient.createObject(tgtJournalVpool);
// Create src journal vpool
VirtualPool srcJournalVpool = new VirtualPool();
srcJournalVpool.setId(URI.create("srcJournalVpool"));
srcJournalVpool.setLabel("srcJournalVpool");
srcJournalVpool.setType("block");
srcJournalVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
srcJournalVpool.setDriveType(SupportedDriveTypes.FC.name());
matchedPools = new StringSet();
matchedPools.add(sjPool9.getId().toString());
srcJournalVpool.setMatchedStoragePools(matchedPools);
StringSet srcJournalVarrays = new StringSet();
srcJournalVarrays.add(srcJournalVarray.getId().toString());
srcJournalVpool.setVirtualArrays(srcJournalVarrays);
srcJournalVpool.setUseMatchedPools(true);
_dbClient.createObject(srcJournalVpool);
// Create RP MetroPoint active target vpool
VirtualPool mpActiveTgtVpool = new VirtualPool();
mpActiveTgtVpool.setId(URI.create("mpTargetVpool"));
mpActiveTgtVpool.setLabel("mpTargetVpool");
mpActiveTgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
mpActiveTgtVpool.setDriveType(SupportedDriveTypes.FC.name());
// ////////////////////////////////////////////////////////////////
// NEGATIVE-TEST Step 2/2:
// Comment out the below setHighAvailability() line so that this vpool is not
// fronted by the VPLEX and will need to rely on the Storage System connectivity.
//
// Result: Placement should exhaust it's options and fail.
// ////////////////////////////////////////////////////////////////
mpActiveTgtVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
matchedPools = new StringSet();
matchedPools.add(tgtPool7.getId().toString());
matchedPools.add(tgtPool8.getId().toString());
mpActiveTgtVpool.setMatchedStoragePools(matchedPools);
mpActiveTgtVpool.setUseMatchedPools(true);
StringSet activeTgtVarrays = new StringSet();
activeTgtVarrays.add(srcVarray.getId().toString());
mpActiveTgtVpool.setVirtualArrays(activeTgtVarrays);
_dbClient.createObject(mpActiveTgtVpool);
// Create RP MetroPoint standby target vpool
VirtualPool mpStandbyTgtVpool = new VirtualPool();
mpStandbyTgtVpool.setId(URI.create("mpStandbyTargetVpool"));
mpStandbyTgtVpool.setLabel("mpStandbyTargetVpool");
mpStandbyTgtVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
mpStandbyTgtVpool.setDriveType(SupportedDriveTypes.FC.name());
// mpTgtVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_local.name());
matchedPools = new StringSet();
// matchedPools.add(tgtPool7.getId().toString());
matchedPools.add(haPool4.getId().toString());
mpStandbyTgtVpool.setMatchedStoragePools(matchedPools);
mpStandbyTgtVpool.setUseMatchedPools(true);
StringSet standbyTgtVarrays = new StringSet();
standbyTgtVarrays.add(haVarray.getId().toString());
mpStandbyTgtVpool.setVirtualArrays(standbyTgtVarrays);
_dbClient.createObject(mpStandbyTgtVpool);
// Create a RP VPLEX virtual pool
// srcPool3 should never be chosen during placement
VirtualPool mpSrcVpool = new VirtualPool();
mpSrcVpool.setId(URI.create("mpSrcVpool"));
mpSrcVpool.setLabel("mpSrcVpool");
mpSrcVpool.setSupportedProvisioningType(VirtualPool.ProvisioningType.Thin.name());
mpSrcVpool.setDriveType(SupportedDriveTypes.FC.name());
mpSrcVpool.setHighAvailability(VirtualPool.HighAvailabilityType.vplex_distributed.name());
matchedPools = new StringSet();
matchedPools.add(srcPool1.getId().toString());
matchedPools.add(srcPool2.getId().toString());
mpSrcVpool.setMatchedStoragePools(matchedPools);
mpSrcVpool.setUseMatchedPools(true);
mpSrcVpool.setJournalVarray(srcJournalVarray.getId().toString());
mpSrcVpool.setJournalVpool(srcJournalVpool.getId().toString());
mpSrcVpool.setStandbyJournalVarray(haJournalVarray.getId().toString());
mpSrcVpool.setStandbyJournalVpool(haJournalVpool.getId().toString());
mpSrcVpool.setJournalSize("2X");
StringMap vavpMap = new StringMap();
vavpMap.put(haVarray.getId().toString(), haVpool.getId().toString());
mpSrcVpool.setHaVarrayVpoolMap(vavpMap);
mpSrcVpool.setMetroPoint(true);
// Active Source Local Target
VpoolProtectionVarraySettings activeProtectionSettings = new VpoolProtectionVarraySettings();
activeProtectionSettings.setVirtualPool(mpActiveTgtVpool.getId());
activeProtectionSettings.setJournalVpool(mpActiveTgtVpool.getId());
activeProtectionSettings.setId(URI.create("activeProtectionSettings"));
_dbClient.createObject(activeProtectionSettings);
// Standby Source Local Target
VpoolProtectionVarraySettings standbyProtectionSettings = new VpoolProtectionVarraySettings();
standbyProtectionSettings.setVirtualPool(mpStandbyTgtVpool.getId());
standbyProtectionSettings.setJournalVpool(mpStandbyTgtVpool.getId());
standbyProtectionSettings.setId(URI.create("standbyProtectionSettings"));
_dbClient.createObject(standbyProtectionSettings);
// Define the targets
StringMap protectionVarray = new StringMap();
protectionVarray.put(srcVarray.getId().toString(), activeProtectionSettings.getId().toString());
protectionVarray.put(haVarray.getId().toString(), standbyProtectionSettings.getId().toString());
mpSrcVpool.setProtectionVarraySettings(protectionVarray);
mpSrcVpool.setRpCopyMode("SYNCHRONOUS");
mpSrcVpool.setRpRpoType("MINUTES");
mpSrcVpool.setRpRpoValue(Long.valueOf("5"));
StringSet srcVarrays = new StringSet();
srcVarrays.add(srcVarray.getId().toString());
mpSrcVpool.setVirtualArrays(srcVarrays);
_dbClient.createObject(mpSrcVpool);
// Create Tenant
TenantOrg tenant = new TenantOrg();
tenant.setId(URI.create("tenant"));
_dbClient.createObject(tenant);
// Create a project object
Project project = new Project();
project.setId(URI.create("project"));
project.setLabel("project");
project.setTenantOrg(new NamedURI(tenant.getId(), project.getLabel()));
_dbClient.createObject(project);
// Create block consistency group
BlockConsistencyGroup cg = new BlockConsistencyGroup();
cg.setProject(new NamedURI(project.getId(), project.getLabel()));
cg.setId(URI.create("blockCG"));
_dbClient.createObject(cg);
// Create capabilities
VirtualPoolCapabilityValuesWrapper capabilities = PlacementTestUtils.createCapabilities("10GB", 13, cg);
// Run single volume placement: Run 10 times to make sure pool6 never comes up for source and pool9 for target.
for (int i = 0; i < 10; i++) {
List recommendations = PlacementTestUtils.invokePlacement(_dbClient, _coordinator, srcVarray, project, mpSrcVpool, capabilities);
assertNotNull(recommendations);
assertTrue(!recommendations.isEmpty());
assertNotNull(recommendations.get(0));
RPProtectionRecommendation rec = (RPProtectionRecommendation) recommendations.get(0);
for (RPRecommendation rpRec : rec.getSourceRecommendations()) {
assertNotNull(rpRec.getVirtualArray());
assertNotNull(rpRec.getVirtualPool());
assertNotNull(rpRec.getInternalSiteName());
assertNotNull(rpRec.getSourceStorageSystem());
assertNotNull(rpRec.getSourceStoragePool());
assertTrue("site1".equals(rpRec.getInternalSiteName()));
assertTrue(vmaxStorageSystem1.getId().toString().equals(rpRec.getSourceStorageSystem().toString()));
assertTrue((srcPool1.getId().toString().equals(rpRec.getSourceStoragePool().toString())) || (srcPool2.getId().toString().equals(rpRec.getSourceStoragePool().toString())) || (srcPool3.getId().toString().equals(rpRec.getSourceStoragePool().toString())));
assertNotNull(rpRec.getVirtualVolumeRecommendation());
assertNotNull(rpRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
assertTrue("vplex1".equals(rpRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
assertNotNull(rpRec.getHaRecommendation());
assertNotNull(rpRec.getHaRecommendation().getInternalSiteName());
assertTrue("vplex1".equals(rpRec.getHaRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
assertTrue("site2".equals(rpRec.getHaRecommendation().getInternalSiteName()));
assertTrue(haVarray.getId().toString().equals(rpRec.getHaRecommendation().getVirtualArray().toString()));
assertTrue("urn:storageos:VirtualPool:11111111-2222-3333-4444-555555555555:vdc1".equals(rpRec.getHaRecommendation().getVirtualPool().getId().toString()));
assertTrue(vmaxStorageSystem2.getId().toString().equals(rpRec.getHaRecommendation().getSourceStorageSystem().toString()));
assertTrue((haPool4.getId().toString().equals(rpRec.getHaRecommendation().getSourceStoragePool().toString())) || (haPool5.getId().toString().equals(rpRec.getHaRecommendation().getSourceStoragePool().toString())) || (haPool6.getId().toString().equals(rpRec.getHaRecommendation().getSourceStoragePool().toString())));
assertNotNull(rpRec.getTargetRecommendations());
assertTrue(!rpRec.getTargetRecommendations().isEmpty());
for (RPRecommendation targetRec : rpRec.getTargetRecommendations()) {
assertNotNull(targetRec.getInternalSiteName());
assertNotNull(targetRec.getVirtualArray());
assertNotNull(targetRec.getVirtualPool());
assertNotNull(targetRec.getSourceStorageSystem());
assertNotNull(targetRec.getSourceStoragePool());
if (VirtualPool.vPoolSpecifiesHighAvailability(mpActiveTgtVpool)) {
assertNotNull(targetRec.getVirtualVolumeRecommendation());
assertNotNull(targetRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
assertTrue(vplexStorageSystem1.getId().toString().equals(targetRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
assertTrue(vmaxStorageSystem3.getId().toString().equals(targetRec.getSourceStorageSystem().toString()));
assertTrue(srcVarray.getId().toString().equals(targetRec.getVirtualArray().toString()));
assertTrue("site1".equals(targetRec.getInternalSiteName()));
assertTrue(mpActiveTgtVpool.getId().toString().equals(targetRec.getVirtualPool().getId().toString()));
assertTrue((tgtPool7.getId().toString().equals(targetRec.getSourceStoragePool().toString())) || (tgtPool8.getId().toString().equals(targetRec.getSourceStoragePool().toString())));
}
if (VirtualPool.vPoolSpecifiesHighAvailability(mpStandbyTgtVpool)) {
assertNotNull(targetRec.getVirtualVolumeRecommendation());
assertNotNull(targetRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
assertTrue(vplexStorageSystem2.getId().toString().equals(targetRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
assertTrue(vmaxStorageSystem3.getId().toString().equals(targetRec.getSourceStorageSystem().toString()));
assertTrue(standbyTgtVarray.getId().toString().equals(targetRec.getVirtualArray().toString()));
assertTrue("site2".equals(targetRec.getInternalSiteName()));
assertTrue(mpActiveTgtVpool.getId().toString().equals(targetRec.getVirtualPool().getId().toString()));
assertTrue((tgtPool7.getId().toString().equals(targetRec.getSourceStoragePool().toString())) || (tgtPool8.getId().toString().equals(targetRec.getSourceStoragePool().toString())));
}
}
}
// Source journal
assertNotNull(rec.getSourceJournalRecommendation());
assertNotNull(rec.getSourceJournalRecommendation().getInternalSiteName());
assertNotNull(rec.getSourceJournalRecommendation().getSourceStoragePool());
assertNotNull(rec.getSourceJournalRecommendation().getSourceStorageSystem());
assertNotNull(rec.getSourceJournalRecommendation().getVirtualArray());
assertNotNull(rec.getSourceJournalRecommendation().getVirtualPool());
assertTrue("site1".equals(rec.getSourceJournalRecommendation().getInternalSiteName()));
assertTrue(vnxStorageSystem1.getId().toString().equals(rec.getSourceJournalRecommendation().getSourceStorageSystem().toString()));
assertTrue((sjPool9.getId().toString().equals(rec.getSourceJournalRecommendation().getSourceStoragePool().toString())));
if (VirtualPool.vPoolSpecifiesHighAvailability(srcJournalVpool)) {
assertNotNull(rec.getSourceJournalRecommendation().getVirtualVolumeRecommendation());
assertNotNull(rec.getSourceJournalRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem());
assertTrue(vplexStorageSystem1.getId().toString().equals(rec.getSourceJournalRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem()));
}
// Source HA journal
assertNotNull(rec.getStandbyJournalRecommendation());
assertNotNull(rec.getStandbyJournalRecommendation().getInternalSiteName());
assertNotNull(rec.getStandbyJournalRecommendation().getSourceStoragePool());
assertNotNull(rec.getStandbyJournalRecommendation().getSourceStorageSystem());
assertNotNull(rec.getStandbyJournalRecommendation().getVirtualArray());
assertNotNull(rec.getStandbyJournalRecommendation().getVirtualPool());
assertTrue("site2".equals(rec.getStandbyJournalRecommendation().getInternalSiteName()));
assertTrue(vnxStorageSystem2.getId().toString().equals(rec.getStandbyJournalRecommendation().getSourceStorageSystem().toString()));
assertTrue((hajPool10.getId().toString().equals(rec.getStandbyJournalRecommendation().getSourceStoragePool().toString())));
if (VirtualPool.vPoolSpecifiesHighAvailability(haJournalVpool)) {
assertNotNull(rec.getStandbyJournalRecommendation().getVirtualVolumeRecommendation());
assertNotNull(rec.getStandbyJournalRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem());
assertTrue(vplexStorageSystem1.getId().toString().equals(rec.getStandbyJournalRecommendation().getVirtualVolumeRecommendation().getVPlexStorageSystem()));
}
// TargetJournal
assertNotNull(rec.getTargetJournalRecommendations());
assertTrue(!rec.getTargetJournalRecommendations().isEmpty());
for (RPRecommendation targetJournalRec : rec.getTargetJournalRecommendations()) {
assertNotNull(targetJournalRec);
assertNotNull(targetJournalRec.getInternalSiteName());
assertNotNull(targetJournalRec.getSourceStoragePool());
assertNotNull(targetJournalRec.getSourceStorageSystem());
assertNotNull(targetJournalRec.getVirtualArray());
assertNotNull(targetJournalRec.getVirtualPool());
if (targetJournalRec.getVirtualArray().toString().equals(srcVarray.getId().toString())) {
assertTrue("site1".equals(targetJournalRec.getInternalSiteName()));
assertTrue(mpActiveTgtVpool.getId().toString().equals(targetJournalRec.getVirtualPool().getId().toString()));
assertTrue((tgtPool7.getId().toString().equals(targetJournalRec.getSourceStoragePool().toString())) || haPool4.getId().toString().equals(targetJournalRec.getSourceStoragePool().toString()));
assertTrue(vmaxStorageSystem3.getId().toString().equals(targetJournalRec.getSourceStorageSystem().toString()));
if (VirtualPool.vPoolSpecifiesHighAvailability(mpActiveTgtVpool)) {
assertNotNull(targetJournalRec.getVirtualVolumeRecommendation());
assertNotNull(targetJournalRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
assertTrue(vplexStorageSystem1.getId().toString().equals(targetJournalRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
}
}
if (targetJournalRec.getVirtualArray().toString().equals(haVarray.getId().toString())) {
assertTrue("site2".equals(targetJournalRec.getInternalSiteName()));
assertTrue(mpStandbyTgtVpool.getId().toString().equals(targetJournalRec.getVirtualPool().getId().toString()));
assertTrue((haPool4.getId().toString().equals(targetJournalRec.getSourceStoragePool().toString())));
assertTrue(vmaxStorageSystem2.getId().toString().equals(targetJournalRec.getSourceStorageSystem().toString()));
if (VirtualPool.vPoolSpecifiesHighAvailability(mpStandbyTgtVpool)) {
assertNotNull(targetJournalRec.getVirtualVolumeRecommendation());
assertNotNull(targetJournalRec.getVirtualVolumeRecommendation().getVPlexStorageSystem());
assertTrue(vplexStorageSystem2.getId().toString().equals(targetJournalRec.getVirtualVolumeRecommendation().getVPlexStorageSystem().toString()));
}
}
}
_log.info(String.format("Placement results (#%s) : \n %s", i, rec.toString(_dbClient)));
}
_log.info("### PASS ###");
}
use of com.emc.storageos.db.client.model.NamedURI in project coprhd-controller by CoprHD.
the class BlockIngestOrchestrator method updateVolume.
/*
* Update volume properties
*/
protected void updateVolume(Volume volume, StorageSystem system, String volumeNativeGuid, StoragePool pool, VirtualArray virtualArray, VirtualPool vPool, UnManagedVolume unManagedVolume, Project project) throws IngestionException {
_logger.debug("Updating Volume for native volume id " + volumeNativeGuid);
volume.setNativeGuid(volumeNativeGuid);
volume.setVirtualPool(vPool.getId());
volume.setVirtualArray(virtualArray.getId());
volume.setStorageController(system.getId());
String systemType = system.checkIfVmax3() ? DiscoveredDataObject.Type.vmax3.name() : system.getSystemType();
volume.setSystemType(systemType);
volume.setPool(unManagedVolume.getStoragePoolUri());
// adding capacity
String allocatedCapacity = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.ALLOCATED_CAPACITY.toString(), unManagedVolume.getVolumeInformation());
String provisionedCapacity = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.PROVISIONED_CAPACITY.toString(), unManagedVolume.getVolumeInformation());
volume.setAllocatedCapacity(Long.parseLong(allocatedCapacity));
volume.setProvisionedCapacity(Long.parseLong(provisionedCapacity));
volume.setCapacity(Long.parseLong(provisionedCapacity));
volume.setWWN(unManagedVolume.getWwn());
updateBlockObjectNativeIds(volume, unManagedVolume);
setProtocol(pool, volume, vPool);
volume.setTenant(new NamedURI(project.getTenantOrg().getURI(), volume.getLabel()));
volume.setProject(new NamedURI(project.getId(), volume.getLabel()));
try {
PropertySetterUtil.addVolumeDetails(unManagedVolume.getVolumeInformation(), volume);
} catch (Exception e) {
_logger.error("UnManaged Volume {} ingestion ran into an exception: ", unManagedVolume.getLabel(), e);
throw IngestionException.exceptions.couldNotCreateVolume(e.getLocalizedMessage());
}
}
use of com.emc.storageos.db.client.model.NamedURI in project coprhd-controller by CoprHD.
the class BlockSnapIngestOrchestrator method createSnapshot.
private BlockSnapshot createSnapshot(IngestionRequestContext requestContext, String nativeGuid) throws IngestionException {
UnManagedVolume unManagedVolume = requestContext.getCurrentUnmanagedVolume();
BlockSnapshot snapShot = new BlockSnapshot();
snapShot.setId(URIUtil.createId(BlockSnapshot.class));
snapShot.setNativeGuid(nativeGuid);
updateBlockObjectNativeIds(snapShot, unManagedVolume);
StringSetMap unManagedVolumeInformation = unManagedVolume.getVolumeInformation();
String deviceLabel = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.DEVICE_LABEL.toString(), unManagedVolumeInformation);
if (null == deviceLabel || deviceLabel.trim().isEmpty()) {
deviceLabel = nativeGuid;
}
// In case of XIO snaps, the snapshots belong to a snapset which represents the snapshot CG. This will be
// populated in SNAPSHOT_CONSISTENCY_GROUP_NAME
// The same is applicable to external device snapshots
String snapsetName = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.SNAPSHOT_CONSISTENCY_GROUP_NAME.toString(), unManagedVolumeInformation);
if (null == snapsetName || snapsetName.trim().isEmpty()) {
snapsetName = deviceLabel;
}
snapShot.setSnapsetLabel(snapsetName);
snapShot.setStorageController(requestContext.getStorageSystem().getId());
String systemType = requestContext.getStorageSystem().checkIfVmax3() ? DiscoveredDataObject.Type.vmax3.name() : requestContext.getStorageSystem().getSystemType();
snapShot.setSystemType(systemType);
snapShot.setVirtualArray(requestContext.getVarray(unManagedVolume).getId());
snapShot.setProject(new NamedURI(requestContext.getProject().getId(), snapShot.getLabel()));
snapShot.setWWN(unManagedVolume.getWwn());
String allocatedCapacity = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.ALLOCATED_CAPACITY.toString(), unManagedVolume.getVolumeInformation());
String provisionedCapacity = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.PROVISIONED_CAPACITY.toString(), unManagedVolume.getVolumeInformation());
snapShot.setAllocatedCapacity(Long.parseLong(allocatedCapacity));
snapShot.setProvisionedCapacity(Long.parseLong(provisionedCapacity));
String syncActive = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.IS_SYNC_ACTIVE.toString(), unManagedVolume.getVolumeInformation());
Boolean isSyncActive = (null != syncActive) ? Boolean.parseBoolean(syncActive) : false;
snapShot.setIsSyncActive(isSyncActive);
String readOnly = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.IS_READ_ONLY.toString(), unManagedVolume.getVolumeInformation());
Boolean isReadOnly = (null != readOnly) ? Boolean.parseBoolean(readOnly) : false;
snapShot.setIsReadOnly(isReadOnly);
String settingsInstance = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.SETTINGS_INSTANCE.toString(), unManagedVolume.getVolumeInformation());
snapShot.setSettingsInstance(settingsInstance);
String needsCopyToTarget = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.NEEDS_COPY_TO_TARGET.toString(), unManagedVolumeInformation);
Boolean isNeedsCopyToTarget = (null != needsCopyToTarget) ? Boolean.parseBoolean(needsCopyToTarget) : false;
snapShot.setNeedsCopyToTarget(isNeedsCopyToTarget);
String techType = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.TECHNOLOGY_TYPE.toString(), unManagedVolumeInformation);
snapShot.setTechnologyType(techType);
BlockConsistencyGroup cg = getConsistencyGroup(unManagedVolume, snapShot, requestContext, _dbClient);
if (null != cg) {
requestContext.getVolumeContext().getCGObjectsToCreateMap().put(cg.getLabel(), cg);
decorateCGInfoInVolumes(cg, snapShot, requestContext, unManagedVolume);
}
return snapShot;
}
use of com.emc.storageos.db.client.model.NamedURI in project coprhd-controller by CoprHD.
the class BlockVolumeIngestOrchestrator method ingestBlockObjects.
@Override
protected <T extends BlockObject> T ingestBlockObjects(IngestionRequestContext requestContext, Class<T> clazz) throws IngestionException {
UnManagedVolume unManagedVolume = requestContext.getCurrentUnmanagedVolume();
boolean unManagedVolumeExported = requestContext.getVolumeContext().isVolumeExported();
Volume volume = null;
List<BlockSnapshotSession> snapSessions = new ArrayList<BlockSnapshotSession>();
URI unManagedVolumeUri = unManagedVolume.getId();
String volumeNativeGuid = unManagedVolume.getNativeGuid().replace(VolumeIngestionUtil.UNMANAGEDVOLUME, VolumeIngestionUtil.VOLUME);
volume = VolumeIngestionUtil.checkIfVolumeExistsInDB(volumeNativeGuid, _dbClient);
// Check if ingested volume has export masks pending for ingestion.
if (isExportIngestionPending(volume, unManagedVolumeUri, unManagedVolumeExported)) {
return clazz.cast(volume);
}
if (null == volume) {
validateUnManagedVolume(unManagedVolume, requestContext.getVpool(unManagedVolume));
// @TODO Need to revisit this. In 8.x Provider, ReplicationGroup is automatically created when a volume is associated to a
// StorageGroup.
// checkUnManagedVolumeAddedToCG(unManagedVolume, virtualArray, tenant, project, vPool);
checkVolumeExportState(unManagedVolume, unManagedVolumeExported);
checkVPoolValidForExportInitiatorProtocols(requestContext.getVpool(unManagedVolume), unManagedVolume);
checkHostIOLimits(requestContext.getVpool(unManagedVolume), unManagedVolume, unManagedVolumeExported);
StoragePool pool = validateAndReturnStoragePoolInVAarray(unManagedVolume, requestContext.getVarray(unManagedVolume));
// validate quota is exceeded for storage systems and pools
checkSystemResourceLimitsExceeded(requestContext.getStorageSystem(), unManagedVolume, requestContext.getExhaustedStorageSystems());
checkPoolResourceLimitsExceeded(requestContext.getStorageSystem(), pool, unManagedVolume, requestContext.getExhaustedPools());
String autoTierPolicyId = getAutoTierPolicy(unManagedVolume, requestContext.getStorageSystem(), requestContext.getVpool(unManagedVolume));
validateAutoTierPolicy(autoTierPolicyId, unManagedVolume, requestContext.getVpool(unManagedVolume));
volume = createVolume(requestContext, volumeNativeGuid, pool, unManagedVolume, autoTierPolicyId);
}
if (volume != null) {
String syncActive = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.IS_SYNC_ACTIVE.toString(), unManagedVolume.getVolumeInformation());
boolean isSyncActive = (null != syncActive) ? Boolean.parseBoolean(syncActive) : false;
volume.setSyncActive(isSyncActive);
if (VolumeIngestionUtil.isFullCopy(unManagedVolume)) {
_logger.info("Setting clone related properties {}", unManagedVolume.getId());
String replicaState = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.REPLICA_STATE.toString(), unManagedVolume.getVolumeInformation());
volume.setReplicaState(replicaState);
String replicationGroupName = PropertySetterUtil.extractValueFromStringSet(SupportedVolumeInformation.FULL_COPY_CONSISTENCY_GROUP_NAME.toString(), unManagedVolume.getVolumeInformation());
if (replicationGroupName != null && !replicationGroupName.isEmpty()) {
volume.setReplicationGroupInstance(replicationGroupName);
}
}
// Create snapshot sessions for each synchronization aspect for the volume.
StringSet syncAspectInfoForVolume = PropertySetterUtil.extractValuesFromStringSet(SupportedVolumeInformation.SNAPSHOT_SESSIONS.toString(), unManagedVolume.getVolumeInformation());
if ((syncAspectInfoForVolume != null) && (!syncAspectInfoForVolume.isEmpty())) {
Project project = requestContext.getProject();
// If this is a vplex backend volume, then the front end project should be set as snapshot session's project
if (requestContext instanceof VplexVolumeIngestionContext && VolumeIngestionUtil.isVplexBackendVolume(unManagedVolume)) {
project = ((VplexVolumeIngestionContext) requestContext).getFrontendProject();
}
for (String syncAspectInfo : syncAspectInfoForVolume) {
String[] syncAspectInfoComponents = syncAspectInfo.split(":");
String syncAspectName = syncAspectInfoComponents[0];
String syncAspectObjPath = syncAspectInfoComponents[1];
// Make sure it is not already created.
URIQueryResultList queryResults = new URIQueryResultList();
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getBlockSnapshotSessionBySessionInstance(syncAspectObjPath), queryResults);
Iterator<URI> queryResultsIter = queryResults.iterator();
if (!queryResultsIter.hasNext()) {
BlockSnapshotSession session = new BlockSnapshotSession();
session.setId(URIUtil.createId(BlockSnapshotSession.class));
session.setLabel(syncAspectName);
session.setSessionLabel(syncAspectName);
session.setParent(new NamedURI(volume.getId(), volume.getLabel()));
session.setProject(new NamedURI(project.getId(), project.getLabel()));
session.setStorageController(volume.getStorageController());
session.setSessionInstance(syncAspectObjPath);
StringSet linkedTargetURIs = new StringSet();
URIQueryResultList snapshotQueryResults = new URIQueryResultList();
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getBlockSnapshotBySettingsInstance(syncAspectObjPath), snapshotQueryResults);
Iterator<URI> snapshotQueryResultsIter = snapshotQueryResults.iterator();
while (snapshotQueryResultsIter.hasNext()) {
linkedTargetURIs.add(snapshotQueryResultsIter.next().toString());
}
session.setLinkedTargets(linkedTargetURIs);
session.setOpStatus(new OpStatusMap());
snapSessions.add(session);
}
}
if (!snapSessions.isEmpty()) {
_dbClient.createObject(snapSessions);
}
}
}
// Note that a VPLEX backend volume can also be a snapshot target volume.
// When the VPLEX ingest orchestrator is executed, it gets the ingestion
// strategy for the backend volume and executes it. If the backend volume
// is both a snapshot and a VPLEX backend volume, this local volume ingest
// strategy is invoked and a Volume instance will result. That is fine because
// we need to represent that VPLEX backend volume. However, we also need a
// BlockSnapshot instance to represent the snapshot target volume. Therefore,
// if the unmanaged volume is also a snapshot target volume, we get and
// execute the local snapshot ingest strategy to create this BlockSnapshot
// instance and we add it to the created object list. Note that since the
// BlockSnapshot is added to the created objects list and the Volume and
// BlockSnapshot instance will have the same native GUID, we must be careful
// about adding the Volume to the created object list in the VPLEX ingestion
// strategy.
BlockObject snapshot = null;
if (VolumeIngestionUtil.isSnapshot(unManagedVolume)) {
String strategyKey = ReplicationStrategy.LOCAL.name() + "_" + VolumeType.SNAPSHOT.name();
IngestStrategy ingestStrategy = ingestStrategyFactory.getIngestStrategy(IngestStrategyEnum.getIngestStrategy(strategyKey));
snapshot = ingestStrategy.ingestBlockObjects(requestContext, BlockSnapshot.class);
requestContext.getBlockObjectsToBeCreatedMap().put(snapshot.getNativeGuid(), snapshot);
}
// Run this always when volume NO_PUBLIC_ACCESS
if (markUnManagedVolumeInactive(requestContext, volume)) {
_logger.info("All the related replicas and parent has been ingested ", unManagedVolume.getNativeGuid());
// RP masks.
if (!unManagedVolumeExported && !VolumeIngestionUtil.checkUnManagedResourceIsRecoverPointEnabled(unManagedVolume)) {
unManagedVolume.setInactive(true);
requestContext.getUnManagedVolumesToBeDeleted().add(unManagedVolume);
}
} else if (volume != null) {
_logger.info("Not all the parent/replicas of unManagedVolume {} have been ingested , hence marking as internal", unManagedVolume.getNativeGuid());
volume.addInternalFlags(INTERNAL_VOLUME_FLAGS);
for (BlockSnapshotSession snapSession : snapSessions) {
snapSession.addInternalFlags(INTERNAL_VOLUME_FLAGS);
}
_dbClient.updateObject(snapSessions);
}
return clazz.cast(volume);
}
use of com.emc.storageos.db.client.model.NamedURI in project coprhd-controller by CoprHD.
the class BlockVplexVolumeIngestOrchestrator method findOrCreateExportGroup.
/**
* Find or Create an ExportGroup.
*
* @param vplex -- VPLEX StorageSystem
* @param array -- Array StorageSystem
* @param initiators -- Collection<Initiator> representing VPLEX back-end ports.
* @param virtualArrayURI
* @param projectURI
* @param tenantURI
* @param numPaths Value of maxPaths to be put in ExportGroup
* @param unmanagedExportMask the unmanaged export mask
* @return existing or newly created ExportGroup (not yet persisted)
*/
private ExportGroup findOrCreateExportGroup(IngestionRequestContext requestContext, StorageSystem array, Collection<Initiator> initiators, URI virtualArrayURI, URI projectURI, URI tenantURI, int numPaths, UnManagedExportMask unmanagedExportMask) {
StorageSystem vplex = requestContext.getStorageSystem();
String arrayName = array.getSystemType().replace("block", "") + array.getSerialNumber().substring(array.getSerialNumber().length() - 4);
String groupName = unmanagedExportMask.getMaskName() + "_" + arrayName;
ExportGroup exportGroup = requestContext.findExportGroup(groupName, projectURI, virtualArrayURI, null, null);
if (null != exportGroup) {
_logger.info(String.format("Returning existing ExportGroup %s", exportGroup.getLabel()));
return exportGroup;
}
List<ExportGroup> exportGroups = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, ExportGroup.class, PrefixConstraint.Factory.getFullMatchConstraint(ExportGroup.class, "label", groupName));
if (null != exportGroups && !exportGroups.isEmpty()) {
for (ExportGroup group : exportGroups) {
if (null != group) {
_logger.info(String.format("Returning existing ExportGroup %s", group.getLabel()));
exportGroup = group;
}
}
} else {
Map<String, ExportGroup> possibleExportGroups = new HashMap<String, ExportGroup>();
Set<String> initiatorUris = new HashSet<String>();
for (Initiator initiator : initiators) {
// Determine all the possible existing Export Groups
List<ExportGroup> groups = ExportUtils.getInitiatorExportGroups(initiator, _dbClient);
for (ExportGroup group : groups) {
if (!possibleExportGroups.containsKey(group.getId().toString())) {
possibleExportGroups.put(group.getId().toString(), group);
}
}
initiatorUris.add(initiator.getId().toString());
}
// If there are possible Export Groups, look for one with that matches on inits, varray, project, and tenant.
for (ExportGroup group : possibleExportGroups.values()) {
if (URIUtil.identical(group.getVirtualArray(), virtualArrayURI) && URIUtil.identical(group.getProject().getURI(), projectURI) && URIUtil.identical(group.getTenant().getURI(), tenantURI)) {
if (group.getInitiators().containsAll(initiatorUris)) {
_logger.info(String.format("Returning existing ExportGroup %s from database.", group.getLabel()));
return group;
}
}
}
// No existing group has the mask, let's create one.
exportGroup = new ExportGroup();
exportGroup.setLabel(groupName);
exportGroup.setProject(new NamedURI(projectURI, exportGroup.getLabel()));
exportGroup.setVirtualArray(vplex.getVirtualArray());
exportGroup.setTenant(new NamedURI(tenantURI, exportGroup.getLabel()));
exportGroup.setGeneratedName(groupName);
exportGroup.setVolumes(new StringMap());
exportGroup.setOpStatus(new OpStatusMap());
exportGroup.setVirtualArray(virtualArrayURI);
exportGroup.setNumPaths(numPaths);
// Add the initiators into the ExportGroup.
for (Initiator initiator : initiators) {
exportGroup.addInitiator(initiator);
}
_logger.info(String.format("Returning new ExportGroup %s", exportGroup.getLabel()));
}
return exportGroup;
}
Aggregations