Search in sources :

Example 1 with DiscoveredSystemObject

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

the class AbstractDiscoveredSystemController method queueTask.

protected void queueTask(DbClient dbClient, Class<? extends DiscoveredSystemObject> systemClazz, Dispatcher dispatcher, String methodName, Object... args) {
    final URI systemURI = (URI) args[0];
    _log.info("System {} received RMI request {}.", systemURI, methodName);
    try {
        // 1. select target device
        final DiscoveredSystemObject device = dbClient.queryObject(systemClazz, systemURI);
        final Controller controller = lookupDeviceController(device);
        // 2. queue request
        dispatcher.queue(device.getId(), device.getSystemType(), controller, methodName, args);
    } catch (RetryableDatabaseException e) {
        if (e.getServiceCode() == ServiceCode.DBSVC_CONNECTION_ERROR) {
            // netflix curator ConnectionException is not serializable
            // and thus should not be sent back to rmi client.
            _log.error("Failed to queue task due to dbsvc disconnected. Error: ", e);
            throw DatabaseException.retryables.connectionFailed();
        }
        throw e;
    }
}
Also used : DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject) Controller(com.emc.storageos.Controller) URI(java.net.URI) RetryableDatabaseException(com.emc.storageos.db.exceptions.RetryableDatabaseException)

Example 2 with DiscoveredSystemObject

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

the class DiscoveryStatusUtils method markAsFailed.

/**
 * Marks the target as failed.
 *
 * @param target
 *            the target object.
 * @param message
 *            the error message
 * @param e
 *            the error that caused the failure.
 */
public static void markAsFailed(ModelClient modelClient, DataObject target, String message, Exception e) {
    if (target instanceof DiscoveredSystemObject) {
        DiscoveredSystemObject obj = (DiscoveredSystemObject) target;
        obj.setDiscoveryStatus(DataCollectionJobStatus.ERROR.name());
        obj.setLastDiscoveryStatusMessage(message);
        obj.setLastDiscoveryRunTime(System.currentTimeMillis());
        modelClient.save(obj);
    }
}
Also used : DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject)

Example 3 with DiscoveredSystemObject

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

the class DiscoveryStatusUtils method markAsIgnored.

/**
 * Marks the target as ignored.
 *
 * @param target
 *            the target object.
 */
public static void markAsIgnored(ModelClient modelClient, DataObject target) {
    if (target instanceof DiscoveredSystemObject) {
        DiscoveredSystemObject obj = (DiscoveredSystemObject) target;
        obj.setCompatibilityStatus(CompatibilityStatus.UNKNOWN.name());
        obj.setDiscoveryStatus(DataCollectionJobStatus.COMPLETE.name());
        obj.setLastDiscoveryStatusMessage("");
        obj.setLastDiscoveryRunTime(System.currentTimeMillis());
        modelClient.save(obj);
    }
}
Also used : DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject)

Example 4 with DiscoveredSystemObject

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

the class DiscoveryStatusUtils method markAsIncompatible.

/**
 * Marks the target as incompatible.
 *
 * @param target
 *            the target object.
 */
public static void markAsIncompatible(ModelClient modelClient, DataObject target, String message) {
    if (target instanceof DiscoveredSystemObject) {
        DiscoveredSystemObject obj = (DiscoveredSystemObject) target;
        obj.setDiscoveryStatus(DataCollectionJobStatus.COMPLETE.name());
        obj.setCompatibilityStatus(CompatibilityStatus.INCOMPATIBLE.name());
        obj.setLastDiscoveryStatusMessage(message);
        obj.setLastDiscoveryRunTime(System.currentTimeMillis());
        modelClient.save(obj);
    }
}
Also used : DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject)

Example 5 with DiscoveredSystemObject

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

the class DiscoveryStatusUtils method markAsProcessing.

/**
 * Marks the target as processing.
 *
 * @param target
 *            the target object.
 */
public static void markAsProcessing(ModelClient modelClient, DataObject target) {
    if (target instanceof DiscoveredSystemObject) {
        DiscoveredSystemObject obj = (DiscoveredSystemObject) target;
        obj.setDiscoveryStatus(DataCollectionJobStatus.IN_PROGRESS.name());
        modelClient.save(obj);
    }
}
Also used : DiscoveredSystemObject(com.emc.storageos.db.client.model.DiscoveredSystemObject)

Aggregations

DiscoveredSystemObject (com.emc.storageos.db.client.model.DiscoveredSystemObject)43 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)15 ControllerException (com.emc.storageos.volumecontroller.ControllerException)14 WorkflowException (com.emc.storageos.workflow.WorkflowException)14 Workflow (com.emc.storageos.workflow.Workflow)13 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)4 URI (java.net.URI)3 Controller (com.emc.storageos.Controller)2 BlockObject (com.emc.storageos.db.client.model.BlockObject)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 CompatibilityException (com.emc.storageos.computesystemcontroller.exceptions.CompatibilityException)1 StoragePortGroup (com.emc.storageos.db.client.model.StoragePortGroup)1 RetryableDatabaseException (com.emc.storageos.db.exceptions.RetryableDatabaseException)1 AbstractDiscoveredSystemController (com.emc.storageos.impl.AbstractDiscoveredSystemController)1 ProtectionExportController (com.emc.storageos.protectioncontroller.ProtectionExportController)1 RPController (com.emc.storageos.protectioncontroller.RPController)1 RPDeviceController (com.emc.storageos.protectioncontroller.impl.recoverpoint.RPDeviceController)1 WorkflowRestartedException (com.emc.storageos.workflow.WorkflowRestartedException)1 IOException (java.io.IOException)1