Search in sources :

Example 96 with DbClient

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.");
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) URI(java.net.URI)

Example 97 with DbClient

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());
        }
    }
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) URI(java.net.URI)

Example 98 with DbClient

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");
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) ArrayList(java.util.ArrayList) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) URI(java.net.URI) MigrationCallbackException(com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException)

Example 99 with DbClient

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);
    }
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) Volume(com.emc.storageos.db.client.model.Volume) URI(java.net.URI)

Example 100 with DbClient

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);
                }
            }
        }
    }
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) Volume(com.emc.storageos.db.client.model.Volume) StringSet(com.emc.storageos.db.client.model.StringSet) URI(java.net.URI) BlockConsistencyGroup(com.emc.storageos.db.client.model.BlockConsistencyGroup) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

DbClient (com.emc.storageos.db.client.DbClient)253 URI (java.net.URI)155 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)73 Volume (com.emc.storageos.db.client.model.Volume)67 ArrayList (java.util.ArrayList)58 Test (org.junit.Test)42 FileShare (com.emc.storageos.db.client.model.FileShare)34 NamedURI (com.emc.storageos.db.client.model.NamedURI)31 CIMObjectPath (javax.cim.CIMObjectPath)31 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)29 WBEMClient (javax.wbem.client.WBEMClient)29 StringSet (com.emc.storageos.db.client.model.StringSet)28 CIMConnectionFactory (com.emc.storageos.volumecontroller.impl.smis.CIMConnectionFactory)28 ContainmentConstraint (com.emc.storageos.db.client.constraint.ContainmentConstraint)26 MigrationCallbackException (com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException)25 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)22 InternalDbClient (com.emc.storageos.db.client.upgrade.InternalDbClient)22 VNXeApiClient (com.emc.storageos.vnxe.VNXeApiClient)21 CIMInstance (javax.cim.CIMInstance)21 BlockObject (com.emc.storageos.db.client.model.BlockObject)20