Search in sources :

Example 1 with AuditLogManager

use of com.emc.storageos.security.audit.AuditLogManager in project coprhd-controller by CoprHD.

the class FileDeviceController method auditFile.

/**
 * Record audit log for file service
 *
 * @param auditType
 *            Type of AuditLog
 * @param operationalStatus
 *            Status of operation
 * @param description
 *            Description for the AuditLog
 * @param descparams
 *            Description paramters
 */
public static void auditFile(DbClient dbClient, OperationTypeEnum auditType, boolean operationalStatus, String description, Object... descparams) {
    AuditLogManager auditMgr = AuditLogManagerFactory.getAuditLogManager();
    auditMgr.recordAuditLog(null, null, EVENT_SERVICE_TYPE, auditType, System.currentTimeMillis(), operationalStatus ? AuditLogManager.AUDITLOG_SUCCESS : AuditLogManager.AUDITLOG_FAILURE, description, descparams);
}
Also used : AuditLogManager(com.emc.storageos.security.audit.AuditLogManager)

Example 2 with AuditLogManager

use of com.emc.storageos.security.audit.AuditLogManager in project coprhd-controller by CoprHD.

the class VcenterClusterCompleter method complete.

@Override
protected void complete(DbClient dbClient, Status status, ServiceCoded coded) throws DeviceControllerException {
    log.info("VcenterClusterCompleter.complete {}", status.name());
    VcenterDataCenter vcenterDataCenter = dbClient.queryObject(VcenterDataCenter.class, getId());
    AuditLogManager auditMgr = AuditLogManagerFactory.getAuditLogManager();
    if (status == Status.error) {
        log.info("Error in state " + status);
        dbClient.error(VcenterDataCenter.class, getId(), getOpId(), coded);
        if (isNotifyWorkflow()) {
            WorkflowStepCompleter.stepFailed(getOpId(), coded);
        }
        auditMgr.recordAuditLog(null, null, serviceType, opType, System.currentTimeMillis(), AuditLogManager.AUDITLOG_FAILURE, AuditLogManager.AUDITOP_END);
    } else {
        dbClient.ready(VcenterDataCenter.class, getId(), getOpId());
        if (isNotifyWorkflow()) {
            WorkflowStepCompleter.stepSucceded(getOpId());
        }
        auditMgr.recordAuditLog(null, null, serviceType, opType, System.currentTimeMillis(), AuditLogManager.AUDITLOG_SUCCESS, AuditLogManager.AUDITOP_END);
    }
}
Also used : AuditLogManager(com.emc.storageos.security.audit.AuditLogManager) VcenterDataCenter(com.emc.storageos.db.client.model.VcenterDataCenter)

Example 3 with AuditLogManager

use of com.emc.storageos.security.audit.AuditLogManager in project coprhd-controller by CoprHD.

the class OsInstallCompleter method complete.

@Override
protected void complete(DbClient dbClient, Status status, ServiceCoded coded) throws DeviceControllerException {
    log.info("OsInstallCompleter.complete {} {}", status.name(), coded);
    Host host = dbClient.queryObject(Host.class, getId());
    ComputeImageJob job = dbClient.queryObject(ComputeImageJob.class, jobId);
    AuditLogManager auditMgr = AuditLogManagerFactory.getAuditLogManager();
    if (status == Status.ready && job.getJobStatus().equals(JobStatus.SUCCESS.name())) {
        // set host type based on image type
        ComputeImage image = dbClient.queryObject(ComputeImage.class, job.getComputeImageId());
        if (image.getImageType().equals(ComputeImage.ImageType.esx.name())) {
            host.setType(Host.HostType.Esx.name());
            host.setOsVersion(image.getOsVersion());
        } else if (image.getImageType().equals(ComputeImage.ImageType.linux.name())) {
            host.setType(Host.HostType.Linux.name());
            host.setOsVersion(String.format("%s %s", image.getOsName(), image.getOsVersion()));
        }
        /*
             * Create the IpInterface that represents the IpAddress that's
             * supposed to come on the ESX Management Network (for ESX
             * installations)
             */
        IpInterface ipInterface = new IpInterface();
        ipInterface.setHost(host.getId());
        ipInterface.setId(URIUtil.createId(IpInterface.class));
        ipInterface.setIpAddress(job.getHostIp());
        ipInterface.setLabel(job.getHostName());
        ipInterface.setNetmask(job.getNetmask());
        ipInterface.setProtocol(HostInterface.Protocol.IPV4.toString());
        ipInterface.setRegistrationStatus(DiscoveredDataObject.RegistrationStatus.REGISTERED.toString());
        dbClient.createObject(ipInterface);
        /*
             * End create IpInterface. Consider making this a seperate method.
             */
        host.setCompatibilityStatus(CompatibilityStatus.COMPATIBLE.name());
        host.setProvisioningStatus(ProvisioningJobStatus.COMPLETE.toString());
        dbClient.persistObject(host);
        dbClient.ready(Host.class, getId(), getOpId());
        auditMgr.recordAuditLog(null, null, serviceType, OperationTypeEnum.INSTALL_COMPUTE_IMAGE, System.currentTimeMillis(), AuditLogManager.AUDITLOG_SUCCESS, AuditLogManager.AUDITOP_END, host.getId(), job.getId());
    } else {
        host.setProvisioningStatus(ProvisioningJobStatus.ERROR.toString());
        dbClient.persistObject(host);
        job.setJobStatus(JobStatus.FAILED.name());
        dbClient.persistObject(job);
        dbClient.error(Host.class, getId(), getOpId(), coded);
        auditMgr.recordAuditLog(null, null, serviceType, OperationTypeEnum.INSTALL_COMPUTE_IMAGE, System.currentTimeMillis(), AuditLogManager.AUDITLOG_FAILURE, AuditLogManager.AUDITOP_END, host.getId(), job.getId());
    }
}
Also used : IpInterface(com.emc.storageos.db.client.model.IpInterface) AuditLogManager(com.emc.storageos.security.audit.AuditLogManager) Host(com.emc.storageos.db.client.model.Host) ComputeImageJob(com.emc.storageos.db.client.model.ComputeImageJob) ComputeImage(com.emc.storageos.db.client.model.ComputeImage)

Example 4 with AuditLogManager

use of com.emc.storageos.security.audit.AuditLogManager in project coprhd-controller by CoprHD.

the class UnManagedFilesystemService method auditFile.

/**
 * Record audit log for file service
 *
 * @param auditType
 *            Type of AuditLog
 * @param operationalStatus
 *            Status of operation
 * @param description
 *            Description for the AuditLog
 * @param descparams
 *            Description paramters
 */
public static void auditFile(DbClient dbClient, OperationTypeEnum auditType, boolean operationalStatus, String description, Object... descparams) {
    AuditLogManager auditMgr = AuditLogManagerFactory.getAuditLogManager();
    auditMgr.recordAuditLog(null, null, EVENT_SERVICE_TYPE, auditType, System.currentTimeMillis(), operationalStatus ? AuditLogManager.AUDITLOG_SUCCESS : AuditLogManager.AUDITLOG_FAILURE, description, descparams);
}
Also used : AuditLogManager(com.emc.storageos.security.audit.AuditLogManager)

Example 5 with AuditLogManager

use of com.emc.storageos.security.audit.AuditLogManager in project coprhd-controller by CoprHD.

the class MirrorFileTaskCompleter method auditFile.

/**
 * Record audit log for file service
 *
 * @param auditType Type of AuditLog
 * @param operationalStatus Status of operation
 * @param description Description for the AuditLog
 * @param descparams Description paramters
 */
public static void auditFile(DbClient dbClient, OperationTypeEnum auditType, boolean operationalStatus, String description, Object... descparams) {
    AuditLogManager auditMgr = AuditLogManagerFactory.getAuditLogManager();
    auditMgr.setDbClient(dbClient);
    auditMgr.recordAuditLog(null, null, EVENT_SERVICE_TYPE, auditType, System.currentTimeMillis(), operationalStatus ? AuditLogManager.AUDITLOG_SUCCESS : AuditLogManager.AUDITLOG_FAILURE, description, descparams);
}
Also used : AuditLogManager(com.emc.storageos.security.audit.AuditLogManager)

Aggregations

AuditLogManager (com.emc.storageos.security.audit.AuditLogManager)9 ComputeImage (com.emc.storageos.db.client.model.ComputeImage)2 ComputeImageServer (com.emc.storageos.db.client.model.ComputeImageServer)2 Host (com.emc.storageos.db.client.model.Host)2 ComputeElement (com.emc.storageos.db.client.model.ComputeElement)1 ComputeImageJob (com.emc.storageos.db.client.model.ComputeImageJob)1 IpInterface (com.emc.storageos.db.client.model.IpInterface)1 VcenterDataCenter (com.emc.storageos.db.client.model.VcenterDataCenter)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 URI (java.net.URI)1