Search in sources :

Example 36 with AuditLogableImpl

use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl in project ovirt-engine by oVirt.

the class HostedEngineImporter method doImport.

/**
 * Import the VM into ovirt engine by removing the old, un-managed VM
 * and re-import it with its disks and nics.
 *
 * @param vm         the VM to import
 */
public void doImport(VM vm) {
    StoragePool storagePool = storagePoolDao.getForCluster(vm.getClusterId());
    if (!Config.<Boolean>getValue(ConfigValues.AutoImportHostedEngine)) {
        return;
    }
    ActionReturnValue heVmImported;
    // get the special sd of hosted engine
    Guid storageDomainId = vm.getImages().get(0).getStorageIds().get(0);
    StorageDomain sd = getHEStorageDomain(vm, storagePool, storageDomainId);
    // no point in trying this without the SD
    if (sd != null && (sd.getStatus() == StorageDomainStatus.Active) && storagePool.getStatus() == StoragePoolStatus.Up) {
        log.info("Try to import the Hosted Engine VM '{}'", vm);
        if (vmStaticDAO.get(vm.getId()) == null || removedHEVM(vm)) {
            heVmImported = importHEVM(vm, sd);
            if (heVmImported.getSucceeded()) {
                resourceManager.getVmManager(vm.getId()).update(vm.getStaticData());
                log.info("Successfully imported the Hosted Engine VM");
                auditLogDirector.log(new AuditLogableImpl(), AuditLogType.HOSTED_ENGINE_VM_IMPORT_SUCCEEDED);
            } else {
                log.error("Failed importing the Hosted Engine VM");
                auditLogDirector.log(new AuditLogableImpl(), AuditLogType.HOSTED_ENGINE_VM_IMPORT_FAILED);
            }
        }
    } else {
        if (sd == null) {
            log.debug("Skip trying to import the Hosted Engine VM. Storage Domain '{}' doesn't exist", storageDomainId);
            auditLogDirector.log(new AuditLogableImpl(), AuditLogType.HOSTED_ENGINE_SD_NOT_EXIT);
        } else {
            log.debug("Skip trying to import the Hosted Engine VM. Storage Domain '{}' isn't ACTIVE", sd);
            auditLogDirector.log(new AuditLogableImpl(), AuditLogType.HOSTED_ENGINE_SD_NOT_ACTIVE);
        }
    }
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) Guid(org.ovirt.engine.core.compat.Guid) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 37 with AuditLogableImpl

use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl in project ovirt-engine by oVirt.

the class IPTablesDeprecationNotifier method logWarning.

private void logWarning(Cluster cluster) {
    AuditLogable auditLog = new AuditLogableImpl();
    auditLog.setClusterId(cluster.getId());
    auditLog.setClusterName(cluster.getName());
    auditLog.addCustomValue("DeprecatingVersion", Version.v4_2.toString());
    // we cannot add 4.3 to Version enum until 4.2 release is branched
    auditLog.addCustomValue("RemovingVersion", "4.3");
    auditLogDirector.log(auditLog, AuditLogType.DEPRECATED_IPTABLES_FIREWALL);
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 38 with AuditLogableImpl

use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl in project ovirt-engine by oVirt.

the class GetVmsFromExternalProviderQuery method logFailureToGetVms.

private void logFailureToGetVms() {
    AuditLogable logable = new AuditLogableImpl();
    logable.addCustomValue("URL", getParameters().getUrl());
    auditLogDirector.log(logable, AuditLogType.IMPORTEXPORT_GET_EXTERNAL_VMS_INFO_FAILED);
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 39 with AuditLogableImpl

use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl in project ovirt-engine by oVirt.

the class UpdateVdsCommand method checkKdumpIntegrationStatus.

private void checkKdumpIntegrationStatus() {
    VdsStatic vdsSt = getParameters().getVdsStaticData();
    if (vdsSt.isPmEnabled() && vdsSt.isPmKdumpDetection()) {
        VdsDynamic vdsDyn = vdsDynamicDao.get(vdsSt.getId());
        if (vdsDyn != null && vdsDyn.getKdumpStatus() != KdumpStatus.ENABLED) {
            AuditLogable logable = new AuditLogableImpl();
            logable.setVdsId(vdsSt.getId());
            logable.setVdsName(vdsSt.getName());
            auditLogDirector.log(logable, AuditLogType.KDUMP_DETECTION_NOT_CONFIGURED_ON_VDS);
        }
    }
}
Also used : VdsStatic(org.ovirt.engine.core.common.businessentities.VdsStatic) AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Example 40 with AuditLogableImpl

use of org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl in project ovirt-engine by oVirt.

the class NetworkConfigurator method createEvent.

private AuditLogable createEvent() {
    final AuditLogable event = new AuditLogableImpl();
    event.setVdsName(host.getName());
    event.setVdsId(host.getId());
    return event;
}
Also used : AuditLogable(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable) AuditLogableImpl(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)

Aggregations

AuditLogableImpl (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableImpl)88 AuditLogable (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogable)85 AuditLogDirector (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector)8 AuditLogType (org.ovirt.engine.core.common.AuditLogType)6 Guid (org.ovirt.engine.core.compat.Guid)5 EngineException (org.ovirt.engine.core.common.errors.EngineException)4 HostUpgradeManagerResult (org.ovirt.engine.core.common.HostUpgradeManagerResult)3 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)3 AnsibleCommandBuilder (org.ovirt.engine.core.common.utils.ansible.AnsibleCommandBuilder)3 AnsibleReturnValue (org.ovirt.engine.core.common.utils.ansible.AnsibleReturnValue)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)2 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)2 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)2 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)2 Event (org.ovirt.engine.core.common.eventqueue.Event)2