use of com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException in project coprhd-controller by CoprHD.
the class StorageSystemArrayAffinityDiscoveryMigration method process.
@Override
public void process() throws MigrationCallbackException {
logger.info("Storage system Array affinity discovery migration START");
DbClient dbClient = getDbClient();
try {
List<URI> systemURIs = dbClient.queryByType(StorageSystem.class, true);
Iterator<StorageSystem> systems = dbClient.queryIterativeObjects(StorageSystem.class, systemURIs, true);
List<StorageSystem> modifiedSystems = new ArrayList<StorageSystem>();
while (systems.hasNext()) {
StorageSystem system = systems.next();
system.setArrayAffinityStatus(DataCollectionJobStatus.CREATED.name());
system.setLastArrayAffinityRunTime(0L);
system.setNextArrayAffinityRunTime(0L);
system.setSuccessArrayAffinityTime(0L);
modifiedSystems.add(system);
logger.info("Updating StorageSystem (id={}) with default values for array affinity discovery statuses", system.getId().toString());
}
if (!modifiedSystems.isEmpty()) {
dbClient.updateObject(modifiedSystems);
}
} catch (Exception ex) {
logger.error("Exception occured while migrating array affinity discovery default values for Storage systems");
logger.error(ex.getMessage(), ex);
}
logger.info("Storage system Array affinity discovery migration END");
}
use of com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException in project coprhd-controller by CoprHD.
the class TimeSeriesIndexMigration method process.
@Override
public void process() throws MigrationCallbackException {
log.info("Adding new index records for class: {} field: {} annotation: {}", new Object[] { Order.class.getName(), Order.SUBMITTED, TimeSeriesAlternateId.class.getName() });
ColumnFamily<String, IndexColumnName> tenantToOrder = new ColumnFamily<>(SOURCE_INDEX_CF_NAME, StringSerializer.get(), IndexColumnNameSerializer.get());
ColumnFamily<String, IndexColumnName> timeseriesIndex = new ColumnFamily<>(SOURCE_INDEX_CF_NAME2, StringSerializer.get(), IndexColumnNameSerializer.get());
DataObjectType doType = TypeMap.getDoType(Order.class);
ColumnField field = doType.getColumnField(Order.SUBMITTED);
ColumnFamily<String, TimeSeriesIndexColumnName> newIndexCF = field.getIndexCF();
DbClientImpl client = (DbClientImpl) dbClient;
Keyspace ks = client.getKeyspace(Order.class);
List<CompletableFuture<Void>> tasks = new ArrayList(TASK_SIZE);
try {
OperationResult<Rows<String, IndexColumnName>> result = ks.prepareQuery(tenantToOrder).getAllRows().setRowLimit(1000).withColumnRange(new RangeBuilder().setLimit(0).build()).execute();
for (Row<String, IndexColumnName> row : result.getResult()) {
RowQuery<String, IndexColumnName> rowQuery = ks.prepareQuery(tenantToOrder).getKey(row.getKey()).autoPaginate(true).withColumnRange(new RangeBuilder().setLimit(5).build());
ColumnList<IndexColumnName> cols = rowQuery.execute().getResult();
while (!cols.isEmpty()) {
if (tasks.size() < TASK_SIZE) {
CompletableFuture<Void> task = CompletableFuture.runAsync(new MigrationTask(ks, row.getKey(), cols, tenantToOrder, timeseriesIndex, newIndexCF));
tasks.add(task);
} else {
CompletableFuture.allOf(tasks.toArray(new CompletableFuture[0])).join();
tasks = new ArrayList(TASK_SIZE);
}
cols = rowQuery.execute().getResult();
}
}
if (!tasks.isEmpty()) {
CompletableFuture.allOf(tasks.toArray(new CompletableFuture[0])).join();
}
} catch (Exception e) {
log.error("Migration to {} failed e=", newIndexCF.getName(), e);
}
}
use of com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException in project coprhd-controller by CoprHD.
the class VirtualNASMultipleProjectsAssociationMigration method process.
@Override
public void process() throws MigrationCallbackException {
logger.info("Migration started.");
DbClient dbClient = getDbClient();
List<VirtualNAS> vNASList = new ArrayList<VirtualNAS>();
try {
List<URI> virtualNASUris = dbClient.queryByType(VirtualNAS.class, true);
Iterator<VirtualNAS> virtualNASIterator = dbClient.queryIterativeObjects(VirtualNAS.class, virtualNASUris, true);
logger.info("Processing virtual NASs to set the associated project into a set.");
while (virtualNASIterator.hasNext()) {
VirtualNAS virtualNAS = virtualNASIterator.next();
URI projectURI = virtualNAS.getProject();
if (!NullColumnValueGetter.isNullURI(projectURI)) {
virtualNAS.associateProject(projectURI.toString());
vNASList.add(virtualNAS);
}
}
if (!vNASList.isEmpty()) {
logger.debug("Calling updateObject() to update virtual NAS is DB.");
dbClient.updateObject(vNASList);
}
} catch (Exception ex) {
logger.error("Exception occured while associating project to virtual NAS.");
logger.error(ex.getMessage(), ex);
}
logger.info("Migration completed successfully");
}
use of com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException in project coprhd-controller by CoprHD.
the class VirtualPoolAutoTieringPolicyMigration method process.
@Override
public void process() throws MigrationCallbackException {
logger.info("Processing virtual pool auto tiering policy migration");
DbClient dbClient = getDbClient();
try {
List<URI> virtualPoolUris = dbClient.queryByType(VirtualPool.class, true);
Iterator<VirtualPool> virtualPools = dbClient.queryIterativeObjects(VirtualPool.class, virtualPoolUris, true);
while (virtualPools.hasNext()) {
VirtualPool virtualPool = virtualPools.next();
// If there is a FAST policy associated with the vpool, then mark the uniquePolicyNames to true
if (virtualPool.getAutoTierPolicyName() != null && !virtualPool.getAutoTierPolicyName().isEmpty()) {
// No way other than using contains to differentiate NativeGuid
if (virtualPool.getAutoTierPolicyName().contains(NATIVE_GUID_DELIMITER)) {
virtualPool.setUniquePolicyNames(false);
} else {
virtualPool.setUniquePolicyNames(true);
}
dbClient.persistObject(virtualPool);
logger.info("Updating VirtualPool (id={}) with unique policy names set to {}", virtualPool.getId().toString(), virtualPool.getUniquePolicyNames());
}
}
} catch (Exception ex) {
logger.error("Exception occured while migrating auto tiering policy of vpool");
logger.error(ex.getMessage(), ex);
}
}
use of com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException in project coprhd-controller by CoprHD.
the class VirtualPoolDefaultValuesForSystemTypeDriveTypeMigration method process.
@Override
public void process() throws MigrationCallbackException {
logger.info("Migration started");
DbClient dbClient = getDbClient();
boolean changed = false;
try {
List<URI> virtualPoolUris = dbClient.queryByType(VirtualPool.class, true);
Iterator<VirtualPool> virtualPools = dbClient.queryIterativeObjects(VirtualPool.class, virtualPoolUris, true);
logger.info("Processing virtual pool to set default values for drive type and system type as NONE");
while (virtualPools.hasNext()) {
VirtualPool virtualPool = virtualPools.next();
changed = false;
if (virtualPool.getDriveType() == null) {
logger.info("Setting drive type to NONE for Virtual Pool {}", virtualPool.getId());
virtualPool.setDriveType(SupportedDriveTypes.NONE.name());
changed = true;
}
StringSetMap arrayInfo = virtualPool.getArrayInfo();
if (arrayInfo != null) {
if (arrayInfo.get(SYSTEM_TYPE_KEY) == null) {
logger.info("Setting array system type to NONE for Virtual Pool {}", virtualPool.getId());
arrayInfo.put(SYSTEM_TYPE_KEY, VirtualPool.SystemType.NONE.name());
changed = true;
}
} else {
logger.info("No existing array info. Creating new array info and setting system type to NONE for Virtual Pool {}", virtualPool.getId());
arrayInfo = new StringSetMap();
arrayInfo.put(SYSTEM_TYPE_KEY, VirtualPool.SystemType.NONE.name());
virtualPool.setArrayInfo(arrayInfo);
changed = true;
}
if (changed) {
logger.info("Persisting changes into DB for Virtual Pool {}", virtualPool.getId());
dbClient.persistObject(virtualPool);
}
}
} catch (Exception ex) {
logger.error("Exception occured while setting default values to system type and drive type in virtual pool");
logger.error(ex.getMessage(), ex);
}
logger.info("Migration completed successfully");
}
Aggregations