use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.
the class InstanceTypeListModel method setVmWatchdogToParams.
private void setVmWatchdogToParams(final UnitVmModel model, VmTemplateManagementParameters 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);
}
}
use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.
the class ExistingNonClusterModelBehavior method doBuild.
public void doBuild() {
buildModel(entity, (source, destination) -> {
Frontend.getInstance().runQuery(QueryType.IsBalloonEnabled, new IdQueryParameters(entity.getId()), new AsyncQuery<>((QueryReturnValue returnValue) -> getModel().getMemoryBalloonDeviceEnabled().setEntity((Boolean) returnValue.getReturnValue())));
getInstance().isVirtioScsiEnabledForVm(new AsyncQuery<>(returnValue -> getModel().getIsVirtioScsiEnabled().setEntity(returnValue)), entity.getId());
getInstance().getWatchdogByVmId(new AsyncQuery<QueryReturnValue>(returnValue -> {
@SuppressWarnings("unchecked") Collection<VmWatchdog> watchdogs = returnValue.getReturnValue();
for (VmWatchdog watchdog : watchdogs) {
getModel().getWatchdogAction().setSelectedItem(watchdog.getAction());
getModel().getWatchdogModel().setSelectedItem(watchdog.getModel());
}
}), entity.getId());
Frontend.getInstance().runQuery(QueryType.GetRngDevice, new IdQueryParameters(entity.getId()), new AsyncQuery<QueryReturnValue>(returnValue -> {
List<VmDevice> rngDevices = returnValue.getReturnValue();
getModel().getIsRngEnabled().setEntity(!rngDevices.isEmpty());
if (!rngDevices.isEmpty()) {
VmRngDevice rngDevice = new VmRngDevice(rngDevices.get(0));
getModel().setRngDevice(rngDevice);
}
}));
getModel().getEmulatedMachine().setSelectedItem(entity.getCustomEmulatedMachine());
getModel().getCustomCpu().setSelectedItem(entity.getCustomCpuName());
getModel().getMigrationMode().setSelectedItem(entity.getMigrationSupport());
postBuild();
});
}
use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.
the class AddVmCommand method addVmWatchdog.
private void addVmWatchdog() {
VmWatchdog vmWatchdog = getParameters().getWatchdog();
if (vmWatchdog != null) {
ActionType actionType = getVmDeviceUtils().hasWatchdog(getVmTemplateId()) ? ActionType.UpdateWatchdog : ActionType.AddWatchdog;
runInternalAction(actionType, buildWatchdogParameters(vmWatchdog), cloneContextAndDetachFromParent());
}
}
use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.
the class GetWatchdogQueryTest method executeQueryCommandWithWatchdog.
@Test
public void executeQueryCommandWithWatchdog() {
Map<String, Object> watchdogSpecParams = new HashMap<>();
watchdogSpecParams.put("model", "i6300esb");
watchdogSpecParams.put("action", "reset");
VmDevice vmDevice = new VmDevice(new VmDeviceId(new Guid("6f86b8a4-e721-4149-b2df-056eb621b16a"), TEST_VM_ID), VmDeviceGeneralType.WATCHDOG, VmDeviceType.WATCHDOG.getName(), "", watchdogSpecParams, true, true, true, "", null, null, null);
when(vmDeviceDao.getVmDeviceByVmIdAndType(TEST_VM_ID, VmDeviceGeneralType.WATCHDOG)).thenReturn(Collections.singletonList(vmDevice));
getQuery().executeQueryCommand();
List<VmWatchdog> result = getQuery().getQueryReturnValue().getReturnValue();
assertNotNull(result);
assertFalse(result.isEmpty());
VmWatchdog watchdog = result.get(0);
assertEquals("reset", watchdog.getAction().name().toLowerCase());
assertEquals("i6300esb", watchdog.getModel().name().toLowerCase());
}
use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.
the class TemplateListModel method setVmWatchdogToParams.
private void setVmWatchdogToParams(final UnitVmModel model, UpdateVmTemplateParameters 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);
}
}
Aggregations