use of com.emc.storageos.db.client.DbClient in project coprhd-controller by CoprHD.
the class StoragePortHADomainPopulater method process.
/*
* (non-Javadoc)
*
* @see com.emc.storageos.db.client.upgrade.BaseCustomMigrationCallback#process()
*/
@Override
public void process() throws MigrationCallbackException {
log.info("START - StoragePortHADomainPopulater migration call back");
DbClient dbClient = getDbClient();
List<URI> storagePortURIs = dbClient.queryByType(StoragePort.class, false);
Iterator<StoragePort> storagePortsIter = dbClient.queryIterativeObjects(StoragePort.class, storagePortURIs);
Map<URI, StorageSystem> uriVsSystem = new HashMap<>();
List<StoragePort> modifiedPorts = new ArrayList<>();
while (storagePortsIter.hasNext()) {
StoragePort storagePort = storagePortsIter.next();
URI deviceURI = storagePort.getStorageDevice();
StorageSystem system = null;
if (uriVsSystem.containsKey(deviceURI)) {
system = uriVsSystem.get(deviceURI);
} else {
system = dbClient.queryObject(StorageSystem.class, deviceURI);
if (null != system) {
uriVsSystem.put(deviceURI, system);
} else {
log.warn("No storage system found for the port - {} , it will be skipped from" + "migration, storageHADomain will continue to remain empty", storagePort.getId().toString());
continue;
}
}
if (storagePort.getStorageHADomain() == null && DiscoveredDataObject.Type.openstack.name().equalsIgnoreCase((system.getSystemType()))) {
StorageHADomain haDomain = createStorageAdapter(system, dbClient);
log.info("Populating the storageHADomian for the port - {} ", storagePort.getId().toString());
storagePort.setStorageHADomain(haDomain.getId());
modifiedPorts.add(storagePort);
}
}
// Persist the change
if (!modifiedPorts.isEmpty()) {
dbClient.persistObject(modifiedPorts);
}
log.info("END - StoragePortHADomainPopulater migration call back");
}
use of com.emc.storageos.db.client.DbClient in project coprhd-controller by CoprHD.
the class VDCRoleMigrationCallback method process.
@Override
public void process() throws MigrationCallbackException {
_log.info("VDC Role Migration Started ...");
DbClient dbClient = getDbClient();
TenantOrg rootTenant = findRootTenant(dbClient);
StringSetMap tenantRoles = rootTenant.getRoleAssignments();
if (tenantRoles == null) {
_log.info("No Role Assignments in original Root Tenant. Skip moving.");
return;
}
VirtualDataCenter vdc = VdcUtil.getLocalVdc();
if (vdc == null) {
throw new IllegalStateException("the CF of Local VDC is not found.");
}
// only copy VDC role assignments
copyRoleAssignments(tenantRoles, vdc);
removeRoleFromRootTenant(vdc, rootTenant);
dbClient.persistObject(vdc);
dbClient.persistObject(rootTenant);
_log.info("VDC Role Migration Done.");
}
use of com.emc.storageos.db.client.DbClient in project coprhd-controller by CoprHD.
the class VPlexVolumeProtocolMigration method process.
@Override
public void process() throws MigrationCallbackException {
DbClient dbClient = getDbClient();
List<URI> volumeURIs = dbClient.queryByType(Volume.class, false);
Iterator<Volume> volumesIter = dbClient.queryIterativeObjects(Volume.class, volumeURIs);
while (volumesIter.hasNext()) {
Volume volume = volumesIter.next();
URI systemURI = volume.getStorageController();
if (!NullColumnValueGetter.isNullURI(systemURI)) {
StorageSystem system = dbClient.queryObject(StorageSystem.class, systemURI);
if ((system != null) && (DiscoveredDataObject.Type.vplex.name().equals(system.getSystemType()))) {
// This is a VPLEX volume. If not already set,
// set the protocols to FC.
StringSet protocols = volume.getProtocol();
if (protocols == null) {
protocols = new StringSet();
protocols.add(StorageProtocol.Block.FC.name());
volume.setProtocol(protocols);
dbClient.persistObject(volume);
}
}
}
}
}
use of com.emc.storageos.db.client.DbClient in project coprhd-controller by CoprHD.
the class VcenterTenantsSharingMigration method process.
@Override
public void process() throws MigrationCallbackException {
DbClient dbClient = getDbClient();
List<URI> vcenterURIs = dbClient.queryByType(Vcenter.class, false);
Iterator<Vcenter> vcentersIter = dbClient.queryIterativeObjects(Vcenter.class, vcenterURIs);
_log.info("Migrating vCenter tenant to acls - start");
while (vcentersIter.hasNext()) {
Vcenter vcenter = vcentersIter.next();
URI tenantURI = vcenter.getTenant();
if (!NullColumnValueGetter.isNullURI(tenantURI)) {
_log.info("Migrating the tenant {} of the vCenter {}", vcenter.getTenant(), vcenter.getLabel());
vcenter.setCascadeTenancy(Boolean.TRUE);
vcenter.addAcl(tenantURI);
vcenter.setTenant(NullColumnValueGetter.getNullURI());
dbClient.persistObject(vcenter);
}
}
_log.info("Migrating vCenter tenant to acls - end");
}
use of com.emc.storageos.db.client.DbClient in project coprhd-controller by CoprHD.
the class VirtualPoolDedupCapableMigration method process.
@Override
public void process() throws MigrationCallbackException {
logger.info("Virtual pool DedupCapable 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.getDedupCapable() == null) {
virtualPool.setDedupCapable(false);
modifiedVpools.add(virtualPool);
logger.info("Updating VirtualPool (id={}) with DedupCapable set to default value 'false' ", virtualPool.getId().toString());
}
}
if (!modifiedVpools.isEmpty()) {
dbClient.updateObject(modifiedVpools);
}
} catch (Exception ex) {
logger.error("Exception occured while migrating DedupCapable for Virtual pools");
logger.error(ex.getMessage(), ex);
}
logger.info("Virtual pool DedupCapable migration END");
}
Aggregations