use of com.emc.storageos.db.client.model.ProtectionSystem in project coprhd-controller by CoprHD.
the class BlockObjectMultipleConsistencyGroupsMigrationTest method prepareProtectionSystemData.
/**
* Prepares the ProtectionSystem data.
*
* @throws Exception
*/
private void prepareProtectionSystemData() throws Exception {
ProtectionSystem protectionSystem = new ProtectionSystem();
protectionSystemURI = URIUtil.createId(ProtectionSystem.class);
protectionSystem.setId(protectionSystemURI);
_dbClient.createObject(protectionSystem);
}
use of com.emc.storageos.db.client.model.ProtectionSystem in project coprhd-controller by CoprHD.
the class ProtectionSystemAssocStorageSystemMigration method updateAssociatedStorageSystemsForPS.
/**
* Update ProtectionSystems that need to have the associated storage system blanked out.
* It will be re-populated during discovery.
*/
private void updateAssociatedStorageSystemsForPS() {
DbClient dbClient = getDbClient();
List<URI> protectionSystemURIs = dbClient.queryByType(ProtectionSystem.class, false);
Iterator<ProtectionSystem> protectionSystems = dbClient.queryIterativeObjects(ProtectionSystem.class, protectionSystemURIs);
while (protectionSystems.hasNext()) {
ProtectionSystem protectionSystem = protectionSystems.next();
log.info("ProtectionSystem (id={}) must be upgraded", protectionSystem.getId().toString());
clearAssociatedStorageSystems(protectionSystem, dbClient);
log.info("ProtectionSystem (id={}) upgraded.", protectionSystem.getId().toString());
}
}
use of com.emc.storageos.db.client.model.ProtectionSystem in project coprhd-controller by CoprHD.
the class ProtectionSystemAssocStorageSystemMigrationTest method prepareProtectionSystemData.
/**
* Prepares the ProtectionSystem data.
*
* @throws Exception
*/
private void prepareProtectionSystemData() throws Exception {
ProtectionSystem protectionSystem = new ProtectionSystem();
URI protectionSystemURI = URIUtil.createId(ProtectionSystem.class);
protectionSystem.setId(protectionSystemURI);
StringSet associatedStorageSystems = new StringSet();
associatedStorageSystems.add("FAKE DATA");
associatedStorageSystems.add("FAKE DATA");
associatedStorageSystems.add("FAKE DATA");
associatedStorageSystems.add("FAKE DATA");
associatedStorageSystems.add("FAKE DATA");
protectionSystem.setAssociatedStorageSystems(associatedStorageSystems);
_dbClient.createObject(protectionSystem);
ProtectionSystem protectionSystem2 = new ProtectionSystem();
URI protectionSystemURI2 = URIUtil.createId(ProtectionSystem.class);
protectionSystem2.setId(protectionSystemURI2);
StringSet associatedStorageSystems2 = new StringSet();
associatedStorageSystems2.add("FAKE DATA2");
associatedStorageSystems2.add("FAKE DATA2");
associatedStorageSystems2.add("FAKE DATA2");
associatedStorageSystems2.add("FAKE DATA2");
associatedStorageSystems2.add("FAKE DATA2");
protectionSystem2.setAssociatedStorageSystems(associatedStorageSystems2);
_dbClient.createObject(protectionSystem2);
// Make sure our test data made it into the database as expected
List<URI> protectionSystemURIs = _dbClient.queryByType(ProtectionSystem.class, false);
int count = 0;
for (@SuppressWarnings("unused") URI ignore : protectionSystemURIs) {
count++;
}
Assert.assertTrue("Expected 2 ProtectionSystems, found: " + count, count == 2);
}
use of com.emc.storageos.db.client.model.ProtectionSystem in project coprhd-controller by CoprHD.
the class DbClientTest method testStringSetMapClear.
@Test
public void testStringSetMapClear() throws Exception {
// shows behavior of AbstractChangeTrackingMapSet.clear()
_logger.info("Starting StringSetMap3 test");
DbClient dbClient = _dbClient;
ProtectionSystem ps = new ProtectionSystem();
ps.setId(URIUtil.createId(ProtectionSystem.class));
StringSet set1 = new StringSet();
set1.add("test1");
set1.add("test2");
set1.add("test3");
set1.add("test4");
StringSet set2 = new StringSet();
set2.add("test5");
set2.add("test6");
set2.add("test7");
set2.add("test8");
String key1 = "key1";
String key2 = "key2";
StringSetMap sMap = new StringSetMap();
sMap.put(key1, set1);
sMap.put(key2, set2);
ps.setSiteInitiators(sMap);
dbClient.createObject(ps);
ProtectionSystem ps1 = dbClient.queryObject(ProtectionSystem.class, ps.getId());
StringSet set3 = new StringSet();
set3.add("test9");
set3.add("test10");
set3.add("test11");
set3.add("test12");
StringSet set4 = new StringSet();
set4.add("test13");
set4.add("test14");
set4.add("test15");
set4.add("test16");
String key4 = "key4";
String key3 = "key3";
StringSetMap sMap2 = new StringSetMap();
sMap2.put(key3, set3);
sMap2.put(key4, set4);
ps1.getSiteInitiators().clear();
ps1.getSiteInitiators().putAll(sMap2);
Assert.assertTrue(ps1.getSiteInitiators().containsKey(key1));
Assert.assertTrue(ps1.getSiteInitiators().get(key1).isEmpty());
Assert.assertTrue(ps1.getSiteInitiators().containsKey(key2));
Assert.assertTrue(ps1.getSiteInitiators().get(key2).isEmpty());
Assert.assertTrue(ps1.getSiteInitiators().containsKey(key3));
Assert.assertFalse(ps1.getSiteInitiators().get(key3).isEmpty());
Assert.assertTrue(ps1.getSiteInitiators().containsKey(key4));
Assert.assertFalse(ps1.getSiteInitiators().get(key4).isEmpty());
dbClient.persistObject(ps1);
ProtectionSystem ps2 = dbClient.queryObject(ProtectionSystem.class, ps.getId());
Assert.assertFalse(ps2.getSiteInitiators().containsKey(key1));
Assert.assertFalse(ps2.getSiteInitiators().containsKey(key2));
Assert.assertTrue(ps2.getSiteInitiators().containsKey(key3));
Assert.assertFalse(ps2.getSiteInitiators().get(key3).isEmpty());
Assert.assertTrue(ps2.getSiteInitiators().containsKey(key4));
Assert.assertFalse(ps2.getSiteInitiators().get(key4).isEmpty());
}
use of com.emc.storageos.db.client.model.ProtectionSystem in project coprhd-controller by CoprHD.
the class BlockConsistencyGroupUtils method getRPProtectionSystems.
/**
* Gets the protection system(s) containing the CGs corresponding to the
* passed RP CG.
*
* @param cg the BlockConsistencyGroup.
* @param dbClient the DB client references.
* @return A list of the the protection system(s) containing the CGs
* corresponding to the passed RP CG.
*/
public static List<ProtectionSystem> getRPProtectionSystems(BlockConsistencyGroup cg, DbClient dbClient) {
List<ProtectionSystem> rpSystems = new ArrayList<ProtectionSystem>();
if (cg.getSystemConsistencyGroups() != null && !cg.getSystemConsistencyGroups().isEmpty()) {
for (String systemUri : cg.getSystemConsistencyGroups().keySet()) {
if (URIUtil.isType(URI.create(systemUri), ProtectionSystem.class)) {
ProtectionSystem rpSystem = dbClient.queryObject(ProtectionSystem.class, URI.create(systemUri));
rpSystems.add(rpSystem);
}
}
}
return rpSystems;
}
Aggregations