use of com.emc.storageos.db.client.DbClient in project coprhd-controller by CoprHD.
the class VirtualPoolExpandableMigration method process.
@Override
public void process() throws MigrationCallbackException {
log.info("Handle VirtualPool 'nonDisruptiveExpansion' conversion.");
DbClient dbClient = getDbClient();
List<URI> vpURIs = dbClient.queryByType(VirtualPool.class, true);
Iterator<VirtualPool> vpIter = dbClient.queryIterativeObjects(VirtualPool.class, vpURIs);
while (vpIter.hasNext()) {
VirtualPool vp = vpIter.next();
if (vp.getNonDisruptiveExpansion()) {
vp.setExpandable(true);
vp.setFastExpansion(true);
} else if (VirtualPool.vPoolSpecifiesMirrors(vp, dbClient)) {
// As of now, we do not allow expansion of virtual pools with local mirror protection
vp.setExpandable(false);
vp.setFastExpansion(false);
} else {
// Do not allow expansion. See NOTE above.
vp.setExpandable(false);
vp.setFastExpansion(false);
}
log.info(String.format("Migrated VirtualPool %s, nonDisruptiveExpansion: %s, local mirrors: %s, expandable: %s, fastExpansion; %s", vp.getId().toString(), vp.getNonDisruptiveExpansion(), vp.getMaxNativeContinuousCopies(), vp.getExpandable(), vp.getFastExpansion()));
dbClient.persistObject(vp);
}
log.info("Completed VirtualPool 'nonDisruptiveExpansion' conversion.");
}
use of com.emc.storageos.db.client.DbClient in project coprhd-controller by CoprHD.
the class VirtualPoolMultiVolumeConsistencyMigration method updateRecoverPointVirtualPools.
/**
* Update RecoverPoint VirtualPools. Ensure the multi volume consistency field
* is set to true.
*/
private void updateRecoverPointVirtualPools() {
log.info("Updating RecoverPoint VirtualPools to enable multi volume consistency.");
DbClient dbClient = getDbClient();
List<URI> virtualPoolURIs = dbClient.queryByType(VirtualPool.class, false);
Iterator<VirtualPool> virtualPools = dbClient.queryIterativeObjects(VirtualPool.class, virtualPoolURIs);
while (virtualPools.hasNext()) {
VirtualPool virtualPool = virtualPools.next();
if (VirtualPool.vPoolSpecifiesProtection(virtualPool) && (virtualPool.getMultivolumeConsistency() == null || !virtualPool.getMultivolumeConsistency())) {
virtualPool.setMultivolumeConsistency(true);
dbClient.persistObject(virtualPool);
log.info("Updating VirtualPool (id={}) to enable multi volume consistency.", virtualPool.getId().toString());
}
}
}
use of com.emc.storageos.db.client.DbClient in project coprhd-controller by CoprHD.
the class VirtualPoolPlacementPolicyMigration method process.
@Override
public void process() throws MigrationCallbackException {
logger.info("Virtual pool placement policy migration START");
DbClient dbClient = getDbClient();
try {
List<URI> virtualPoolURIs = dbClient.queryByType(VirtualPool.class, true);
Iterator<VirtualPool> virtualPools = dbClient.queryIterativeObjects(VirtualPool.class, virtualPoolURIs, true);
List<VirtualPool> modifiedVpools = new ArrayList<VirtualPool>();
while (virtualPools.hasNext()) {
VirtualPool virtualPool = virtualPools.next();
if (VirtualPool.Type.block.name().equals(virtualPool.getType()) && virtualPool.getPlacementPolicy() == null) {
virtualPool.setPlacementPolicy(VirtualPool.ResourcePlacementPolicyType.default_policy.name());
modifiedVpools.add(virtualPool);
logger.info("Updating VirtualPool (id={}) with placement policy set to default policy", virtualPool.getId().toString());
}
}
if (!modifiedVpools.isEmpty()) {
dbClient.updateObject(modifiedVpools);
}
} catch (Exception ex) {
logger.error("Exception occured while migrating placement policy for Virtual pools");
logger.error(ex.getMessage(), ex);
}
logger.info("Virtual pool placement policy migration END");
}
use of com.emc.storageos.db.client.DbClient in project coprhd-controller by CoprHD.
the class VolumeAccessStateLinkStatusMigration method initializeVolumeFields.
/**
* For all volumes, fill in the right access states and link status
*/
private void initializeVolumeFields() {
log.info("Updating volume access state and link status.");
DbClient dbClient = this.getDbClient();
List<URI> volumeURIs = dbClient.queryByType(Volume.class, false);
Iterator<Volume> volumes = dbClient.queryIterativeObjects(Volume.class, volumeURIs);
while (volumes.hasNext()) {
Volume volume = volumes.next();
log.info("Examining Volume (id={}) for upgrade", volume.getId().toString());
if (volume.checkForRp() || volume.checkForSRDF()) {
// If this volume is a source and exported to a host, the volume is write-disabled. Otherwise it is readwrite.
volume.setLinkStatus(Volume.LinkStatus.IN_SYNC.toString());
if (volume.getPersonality().equals(Volume.PersonalityTypes.SOURCE.toString())) {
volume.setAccessState(Volume.VolumeAccessState.READWRITE.toString());
} else if (volume.getPersonality().equals(Volume.PersonalityTypes.TARGET.toString())) {
volume.setAccessState(Volume.VolumeAccessState.NOT_READY.toString());
} else if (volume.getPersonality().equals(Volume.PersonalityTypes.METADATA.toString())) {
volume.setAccessState(Volume.VolumeAccessState.NOT_READY.toString());
}
} else {
// No need to set link status for a non-protected volume.
volume.setAccessState(Volume.VolumeAccessState.READWRITE.toString());
}
dbClient.persistObject(volume);
}
}
use of com.emc.storageos.db.client.DbClient in project coprhd-controller by CoprHD.
the class VolumesInCGMigration method updateVolumesInConsistencyGroup.
/**
* Migrate the volumes in CG
*/
private void updateVolumesInConsistencyGroup() {
log.info("Migrating volumes in CG");
DbClient dbClient = getDbClient();
List<URI> volumeURIs = dbClient.queryByType(Volume.class, true);
Iterator<Volume> volumes = dbClient.queryIterativeObjects(Volume.class, volumeURIs);
while (volumes.hasNext()) {
Volume volume = volumes.next();
if (!NullColumnValueGetter.isNullURI(volume.getStorageController()) && !NullColumnValueGetter.isNullURI(volume.getConsistencyGroup())) {
URI cgUri = volume.getConsistencyGroup();
URI storageUri = volume.getStorageController();
BlockConsistencyGroup cg = dbClient.queryObject(BlockConsistencyGroup.class, cgUri);
StorageSystem system = dbClient.queryObject(StorageSystem.class, storageUri);
if (cg == null || system == null) {
continue;
}
if (volume.getSrdfParent() != null || volume.getSrdfTargets() != null) {
continue;
}
if (system.getSystemType().equals(DiscoveredDataObject.Type.vplex.name()) && cg.checkForType(Types.LOCAL)) {
// For VPLEX or VPLEX+RP source volume, update the backend volumes
String personality = volume.getPersonality();
if (NullColumnValueGetter.isNullValue(personality) || personality.equals(PersonalityTypes.SOURCE.name())) {
StringSet associatedVolumeIds = volume.getAssociatedVolumes();
if (associatedVolumeIds != null) {
for (String associatedVolumeId : associatedVolumeIds) {
Volume backendVol = dbClient.queryObject(Volume.class, URI.create(associatedVolumeId));
updateBackendVolume(cg, volume, backendVol, dbClient);
}
}
}
} else if (!cg.isProtectedCG()) {
String rpName = cg.getCgNameOnStorageSystem(storageUri);
if (rpName != null && !rpName.isEmpty()) {
volume.setReplicationGroupInstance(rpName);
dbClient.updateObject(volume);
}
}
}
}
}
Aggregations