Search in sources :

Example 21 with VmWatchdog

use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.

the class BackendTemplateWatchdogsResourceTest method getEntity.

private VmWatchdog getEntity() {
    VmWatchdog watchdog = new VmWatchdog();
    watchdog.setId(WATCHDOG_ID);
    watchdog.setAction(VmWatchdogAction.RESET);
    watchdog.setModel(VmWatchdogType.i6300esb);
    return watchdog;
}
Also used : VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog)

Example 22 with VmWatchdog

use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.

the class VmBaseListModel method setVmWatchdogToParams.

protected void setVmWatchdogToParams(final UnitVmModel model, VmManagementParametersBase updateVmParams) {
    VmWatchdogType wdModel = model.getWatchdogModel().getSelectedItem();
    updateVmParams.setUpdateWatchdog(true);
    if (wdModel != null) {
        VmWatchdog vmWatchdog = new VmWatchdog();
        vmWatchdog.setAction(model.getWatchdogAction().getSelectedItem());
        vmWatchdog.setModel(wdModel);
        updateVmParams.setWatchdog(vmWatchdog);
    }
}
Also used : VmWatchdogType(org.ovirt.engine.core.common.businessentities.VmWatchdogType) VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog)

Example 23 with VmWatchdog

use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.

the class VmTemplateManagementCommand method updateWatchdog.

protected void updateWatchdog(Guid templateId) {
    // do not update if this flag is not set
    if (getParameters().isUpdateWatchdog()) {
        QueryReturnValue query = runInternalQuery(QueryType.GetWatchdog, new IdQueryParameters(templateId));
        List<VmWatchdog> watchdogs = query.getReturnValue();
        if (watchdogs.isEmpty()) {
            if (getParameters().getWatchdog() != null) {
                WatchdogParameters parameters = new WatchdogParameters();
                parameters.setVm(false);
                parameters.setClusterIndependent(getVmTemplate().getTemplateType() == VmEntityType.INSTANCE_TYPE || isBlankTemplate());
                parameters.setId(templateId);
                parameters.setAction(getParameters().getWatchdog().getAction());
                parameters.setModel(getParameters().getWatchdog().getModel());
                runInternalAction(ActionType.AddWatchdog, parameters, cloneContextAndDetachFromParent());
            }
        } else {
            WatchdogParameters watchdogParameters = new WatchdogParameters();
            watchdogParameters.setVm(false);
            watchdogParameters.setClusterIndependent(getVmTemplate().getTemplateType() == VmEntityType.INSTANCE_TYPE || isBlankTemplate());
            watchdogParameters.setId(templateId);
            if (getParameters().getWatchdog() == null) {
                // there is a watchdog in the vm, there should not be any, so let's delete
                runInternalAction(ActionType.RemoveWatchdog, watchdogParameters, cloneContextAndDetachFromParent());
            } else {
                // there is a watchdog in the vm, we have to update.
                watchdogParameters.setAction(getParameters().getWatchdog().getAction());
                watchdogParameters.setModel(getParameters().getWatchdog().getModel());
                runInternalAction(ActionType.UpdateWatchdog, watchdogParameters, cloneContextAndDetachFromParent());
            }
        }
    }
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) WatchdogParameters(org.ovirt.engine.core.common.action.WatchdogParameters) VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog)

Example 24 with VmWatchdog

use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.

the class AbstractVmWatchdogCommand method getVmWatchdogValidator.

protected VmWatchdogValidator getVmWatchdogValidator() {
    VmWatchdogValidator vmWatchdogValidator = null;
    VmWatchdog watchdog = createWatchdogFromParams();
    if (getParameters().isVm()) {
        vmWatchdogValidator = new VmWatchdogValidator(getVm().getOs(), watchdog, getVm().getCompatibilityVersion());
    } else {
        if (getVmTemplate().getClusterId() != null) {
            vmWatchdogValidator = new VmWatchdogValidator(getVmTemplate().getOsId(), watchdog, getVmTemplate().getCompatibilityVersion());
        }
    }
    return vmWatchdogValidator;
}
Also used : VmWatchdogValidator(org.ovirt.engine.core.bll.validator.VmWatchdogValidator) VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog)

Example 25 with VmWatchdog

use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.

the class AbstractVmWatchdogCommand method createWatchdogFromParams.

private VmWatchdog createWatchdogFromParams() {
    VmWatchdog watchdog = new VmWatchdog();
    watchdog.setAction(getParameters().getAction());
    watchdog.setModel(getParameters().getModel());
    watchdog.setVmId(getParameters().getId());
    return watchdog;
}
Also used : VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog)

Aggregations

VmWatchdog (org.ovirt.engine.core.common.businessentities.VmWatchdog)27 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)7 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)7 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)6 Guid (org.ovirt.engine.core.compat.Guid)5 Test (org.junit.Test)4 GraphicsType (org.ovirt.engine.core.common.businessentities.GraphicsType)4 Arrays (java.util.Arrays)3 Collection (java.util.Collection)3 List (java.util.List)3 Watchdog (org.ovirt.engine.api.model.Watchdog)3 GraphicsDevice (org.ovirt.engine.core.common.businessentities.GraphicsDevice)3 VmBase (org.ovirt.engine.core.common.businessentities.VmBase)3 VmRngDevice (org.ovirt.engine.core.common.businessentities.VmRngDevice)3 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)3 VmWatchdogType (org.ovirt.engine.core.common.businessentities.VmWatchdogType)3 QueryType (org.ovirt.engine.core.common.queries.QueryType)3 AsyncQuery (org.ovirt.engine.ui.frontend.AsyncQuery)3 Frontend (org.ovirt.engine.ui.frontend.Frontend)3 BuilderExecutor (org.ovirt.engine.ui.uicommonweb.builders.BuilderExecutor)3