Search in sources :

Example 71 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class ObjectDeviceController method updateBucket.

@Override
public void updateBucket(URI storage, URI bucket, Long softQuota, Long hardQuota, Integer retention, String task) throws ControllerException {
    _log.info("ObjectDeviceController:updateBucket Bucket URI : {} ", bucket);
    Bucket bucketObj = _dbClient.queryObject(Bucket.class, bucket);
    StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
    BiosCommandResult result = getDevice(storageObj.getSystemType()).doUpdateBucket(storageObj, bucketObj, softQuota, hardQuota, retention, task);
    if (result.getCommandPending()) {
        return;
    }
    bucketObj.getOpStatus().updateTaskStatus(task, result.toOperation());
}
Also used : Bucket(com.emc.storageos.db.client.model.Bucket) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 72 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class ObjectDeviceController method createBucket.

@Override
public void createBucket(URI storage, URI uriPool, URI bkt, String label, String namespace, Integer retention, Long hardQuota, Long softQuota, String owner, String task) throws ControllerException {
    _log.info("ObjectDeviceController:createBucket Bucket URI : {} ", bkt);
    StorageSystem storageObj = _dbClient.queryObject(StorageSystem.class, storage);
    Bucket bucketObj = _dbClient.queryObject(Bucket.class, bkt);
    StoragePool stPool = _dbClient.queryObject(StoragePool.class, uriPool);
    ObjectDeviceInputOutput args = new ObjectDeviceInputOutput();
    args.setName(label);
    args.setNamespace(namespace);
    // recommended storage pool
    args.setDevStoragePool(stPool.getNativeId());
    args.setRetentionPeriod(retention);
    args.setBlkSizeHQ(hardQuota);
    args.setNotSizeSQ(softQuota);
    args.setOwner(owner);
    _log.info("ObjectDeviceController:createBucket URI and Type: " + storage.toString() + "   " + storageObj.getSystemType());
    BiosCommandResult result = getDevice(storageObj.getSystemType()).doCreateBucket(storageObj, bucketObj, args, task);
    if (result.getCommandPending()) {
        return;
    }
    bucketObj.getOpStatus().updateTaskStatus(task, result.toOperation());
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) Bucket(com.emc.storageos.db.client.model.Bucket) ObjectDeviceInputOutput(com.emc.storageos.volumecontroller.ObjectDeviceInputOutput) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 73 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class StoragePoolAssociationHelper method updateSystemVarrays.

/**
 * When the ports-varray associations change, for vplex system, update the system-varray association.
 * For other storage systems, update the pools-varrays associations.
 *
 * @param systemUri the system where the varray association has changed
 * @param dbClient an instance of dbClient
 */
private static void updateSystemVarrays(URI systemUri, DbClient dbClient) {
    StorageSystem system = dbClient.queryObject(StorageSystem.class, systemUri);
    if (!system.getInactive()) {
        _log.info("Updating the virtual arrays for storage system {}", system.getNativeGuid());
        if (ConnectivityUtil.isAVPlex(system)) {
            StringSet varrays = getSystemConnectedVarrays(systemUri, PortType.frontend.name(), dbClient);
            _log.info("vplex system {} varrays will be set to {}", system.getNativeGuid(), varrays);
            if (system.getVirtualArrays() == null) {
                system.setVirtualArrays(varrays);
            } else {
                system.getVirtualArrays().replace(varrays);
            }
            dbClient.updateAndReindexObject(system);
            _log.info("Updated vplex system {} varrays to {}", system.getNativeGuid(), varrays);
        } else {
            StringSet varrays = getSystemConnectedVarrays(systemUri, null, dbClient);
            _log.info("The pools of storage system {} varrays will be set to {}", system.getNativeGuid(), varrays);
            List<StoragePool> pools = getSystemPools(systemUri, dbClient);
            for (StoragePool pool : pools) {
                pool.replaceConnectedVirtualArray(varrays);
                _log.info("Updated storage pool {} varrays to {}", pool.getNativeGuid(), varrays);
            }
            dbClient.updateAndReindexObject(pools);
        }
    }
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) StringSet(com.emc.storageos.db.client.model.StringSet) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 74 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class StoragePortAssociationHelper method getVNasNetworksMap.

/**
 * Gets the networks of the virtual nas and organized in a map.
 * This code assumes that an end point exists in one and only one network.
 *
 * @param sports the ports
 * @param dbClient an instance of {@link DbClient}
 * @return a map of networks and the virtual nas that are associated to them.
 */
private static Map<String, List<NetworkLite>> getVNasNetworksMap(Collection<StoragePort> sports, DbClient dbClient) {
    Map<String, List<NetworkLite>> vNasNetwork = new HashMap<>();
    NetworkLite network;
    List<VirtualNAS> vNasList = null;
    List<NetworkLite> list = null;
    for (StoragePort sport : sports) {
        if (TransportType.IP.name().equalsIgnoreCase(sport.getTransportType())) {
            StorageSystem system = dbClient.queryObject(StorageSystem.class, sport.getStorageDevice());
            if (DiscoveredDataObject.Type.vnxfile.name().equals(system.getSystemType()) || DiscoveredDataObject.Type.isilon.name().equals(system.getSystemType()) || DiscoveredDataObject.Type.unity.name().equals(system.getSystemType())) {
                network = NetworkUtil.getEndpointNetworkLite(sport.getPortNetworkId(), dbClient);
                vNasList = getStoragePortVirtualNAS(sport, dbClient);
                if (network != null && network.getInactive() == false && network.getTransportType().equals(sport.getTransportType()) && vNasList != null && !vNasList.isEmpty()) {
                    for (VirtualNAS vNas : vNasList) {
                        list = vNasNetwork.get(vNas.getNativeGuid());
                        if (list == null) {
                            list = new ArrayList<NetworkLite>();
                            vNasNetwork.put(vNas.getNativeGuid(), list);
                        }
                        list.add(network);
                    }
                }
            }
        }
    }
    return vNasNetwork;
}
Also used : VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS) HashMap(java.util.HashMap) NetworkLite(com.emc.storageos.util.NetworkLite) StoragePort(com.emc.storageos.db.client.model.StoragePort) ArrayList(java.util.ArrayList) List(java.util.List) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 75 with StorageSystem

use of com.emc.storageos.db.client.model.StorageSystem in project coprhd-controller by CoprHD.

the class AbstractBasicMaskingOrchestrator method exportGroupCreate.

/**
 * Create storage level masking components to support the requested
 * ExportGroup object. This operation will be flexible enough to take into
 * account initiators that are in some already existent in some
 * StorageGroup. In such a case, the underlying masking component will be
 * "adopted" by the ExportGroup. Further operations against the "adopted"
 * mask will only allow for addition and removal of those initiators/volumes
 * that were added by a Bourne request. Existing initiators/volumes will be
 * maintained.
 *
 * @param storageURI - URI referencing underlying storage array
 * @param exportGroupURI - URI referencing Bourne-level masking, ExportGroup
 * @param initiatorURIs - List of Initiator URIs
 * @param volumeMap - Map of Volume URIs to requested Integer URI
 * @param token - Identifier for operation
 * @throws Exception
 */
@Override
public void exportGroupCreate(URI storageURI, URI exportGroupURI, List<URI> initiatorURIs, Map<URI, Integer> volumeMap, String token) throws Exception {
    ExportOrchestrationTask taskCompleter = null;
    try {
        BlockStorageDevice device = getDevice();
        ExportGroup exportGroup = _dbClient.queryObject(ExportGroup.class, exportGroupURI);
        StorageSystem storage = _dbClient.queryObject(StorageSystem.class, storageURI);
        taskCompleter = new ExportOrchestrationTask(exportGroupURI, token);
        logExportGroup(exportGroup, storageURI);
        if (initiatorURIs != null && !initiatorURIs.isEmpty()) {
            _log.info("export_create: initiator list non-empty");
            // Set up workflow steps.
            Workflow workflow = _workflowService.getNewWorkflow(MaskingWorkflowEntryPoints.getInstance(), "exportGroupCreate", true, token);
            // Create two steps, one for Zoning, one for the ExportGroup actions.
            // This step is for zoning. It is not specific to a single
            // NetworkSystem, as it will look at all the initiators and targets and compute
            // the zones required (which might be on multiple NetworkSystems.)
            String zoningStep = generateDeviceSpecificZoningCreateWorkflow(workflow, null, exportGroup, null, volumeMap);
            boolean createdSteps = determineExportGroupCreateSteps(workflow, zoningStep, device, storage, exportGroup, initiatorURIs, volumeMap, false, token);
            if (createdSteps) {
                // Execute the plan and allow the WorkflowExecutor to fire the
                // taskCompleter.
                String successMessage = String.format("ExportGroup successfully applied for StorageArray %s", storage.getLabel());
                workflow.executePlan(taskCompleter, successMessage);
            } else {
                _log.info("export_create: no steps created");
                taskCompleter.ready(_dbClient);
            }
        } else {
            _log.info("export_create: initiator list empty, no steps to create");
            taskCompleter.ready(_dbClient);
        }
    } catch (DeviceControllerException dex) {
        if (taskCompleter != null) {
            taskCompleter.error(_dbClient, DeviceControllerException.errors.vmaxExportGroupCreateError(dex.getMessage()));
        }
    } catch (Exception ex) {
        _log.error("ExportGroup Orchestration failed.", ex);
        // TODO add service code here
        if (taskCompleter != null) {
            ServiceError serviceError = DeviceControllerException.errors.jobFailedMsg(ex.getMessage(), ex);
            taskCompleter.error(_dbClient, serviceError);
        }
    }
}
Also used : ExportGroup(com.emc.storageos.db.client.model.ExportGroup) ServiceError(com.emc.storageos.svcs.errorhandling.model.ServiceError) BlockStorageDevice(com.emc.storageos.volumecontroller.BlockStorageDevice) Workflow(com.emc.storageos.workflow.Workflow) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) ExportOrchestrationTask(com.emc.storageos.volumecontroller.impl.block.taskcompleter.ExportOrchestrationTask) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1088 URI (java.net.URI)581 ArrayList (java.util.ArrayList)424 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)319 Volume (com.emc.storageos.db.client.model.Volume)299 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)272 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)258 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)246 NamedURI (com.emc.storageos.db.client.model.NamedURI)243 WorkflowException (com.emc.storageos.workflow.WorkflowException)233 ControllerException (com.emc.storageos.volumecontroller.ControllerException)231 HashMap (java.util.HashMap)172 StoragePool (com.emc.storageos.db.client.model.StoragePool)159 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)158 StringSet (com.emc.storageos.db.client.model.StringSet)156 URISyntaxException (java.net.URISyntaxException)145 List (java.util.List)139 IOException (java.io.IOException)136 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)127 Workflow (com.emc.storageos.workflow.Workflow)126