use of org.ovirt.engine.core.common.action.WatchdogParameters in project ovirt-engine by oVirt.
the class BackendTemplateWatchdogResource method remove.
@Override
public Response remove() {
get();
WatchdogParameters parameters = new WatchdogParameters();
parameters.setId(templateId);
parameters.setVm(false);
return performAction(ActionType.RemoveWatchdog, parameters);
}
use of org.ovirt.engine.core.common.action.WatchdogParameters in project ovirt-engine by oVirt.
the class BackendTemplateWatchdogsResource method add.
public Response add(Watchdog watchdog) {
validateParameters(watchdog, "action", "model");
WatchdogParameters parameters = new WatchdogParameters();
if (watchdog.isSetAction()) {
parameters.setAction(WatchdogMapper.map(watchdog.getAction()));
}
if (watchdog.isSetModel()) {
parameters.setModel(WatchdogMapper.map(watchdog.getModel()));
}
parameters.setId(templateId);
parameters.setVm(false);
return performCreate(ActionType.AddWatchdog, parameters, new WatchdogResolver());
}
use of org.ovirt.engine.core.common.action.WatchdogParameters 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());
}
}
}
}
use of org.ovirt.engine.core.common.action.WatchdogParameters in project ovirt-engine by oVirt.
the class BackendInstanceTypeWatchdogsResource method add.
public Response add(Watchdog watchdog) {
validateParameters(watchdog, "action", "model");
WatchdogParameters parameters = new WatchdogParameters();
if (watchdog.isSetAction()) {
parameters.setAction(WatchdogMapper.map(watchdog.getAction()));
}
if (watchdog.isSetModel()) {
parameters.setModel(WatchdogMapper.map(watchdog.getModel()));
}
parameters.setId(instanteTypeId);
parameters.setVm(false);
return performCreate(ActionType.AddWatchdog, parameters, new WatchdogResolver());
}
Aggregations