use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.
the class ExistingNonClusterModelBehavior method initialize.
@Override
public void initialize() {
super.initialize();
updateNumOfSockets();
getModel().getUsbPolicy().setItems(Arrays.asList(UsbPolicy.values()));
getModel().getIsSoundcardEnabled().setIsChangeable(true);
Frontend.getInstance().runQuery(QueryType.GetGraphicsDevices, new IdQueryParameters(entity.getId()), new AsyncQuery<QueryReturnValue>(returnValue -> {
List<GraphicsDevice> graphicsDevices = returnValue.getReturnValue();
Set<GraphicsType> graphicsTypesCollection = new HashSet<>();
for (GraphicsDevice graphicsDevice : graphicsDevices) {
graphicsTypesCollection.add(graphicsDevice.getGraphicsType());
}
initDisplayTypes(entity.getDefaultDisplayType(), UnitVmModel.GraphicsTypes.fromGraphicsTypes(graphicsTypesCollection));
doBuild();
}));
initSoundCard(entity.getId());
updateConsoleDevice(entity.getId());
initPriority(entity.getPriority());
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());
getModel().getCpuSharesAmount().setEntity(entity.getCpuShares());
getModel().getIsHighlyAvailable().setEntity(entity.isAutoStartup());
updateCpuSharesSelection();
}
use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.
the class VmWatchdogValidatorTest method isModelCompatibleWithOsTest.
private void isModelCompatibleWithOsTest(Matcher<ValidationResult> matcher, VmWatchdogType watchDogModel) {
Version version = new Version();
VmWatchdog vmWatchdog = new VmWatchdog();
vmWatchdog.setModel(watchDogModel);
VmWatchdogValidator.VmWatchdogClusterDependentValidator validator = spy(new VmWatchdogValidator.VmWatchdogClusterDependentValidator(0, vmWatchdog, version));
OsRepository osRepository = mock(OsRepository.class);
when(validator.getOsRepository()).thenReturn(osRepository);
when(osRepository.getVmWatchdogTypes(anyInt(), any())).thenReturn(WATCHDOG_MODELS);
assertThat(validator.isValid(), matcher);
}
use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.
the class BackendInstanceTypeWatchdogResourceTest method getEntity.
private VmWatchdog getEntity() {
VmWatchdog watchdog = new VmWatchdog();
watchdog.setId(WATCHDOG_ID);
watchdog.setAction(VmWatchdogAction.RESET);
watchdog.setModel(VmWatchdogType.i6300esb);
return watchdog;
}
use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.
the class BackendInstanceTypeWatchdogsResourceTest method getEntity.
private VmWatchdog getEntity() {
VmWatchdog watchdog = new VmWatchdog();
watchdog.setId(WATCHDOG_ID);
watchdog.setAction(VmWatchdogAction.RESET);
watchdog.setModel(VmWatchdogType.i6300esb);
return watchdog;
}
use of org.ovirt.engine.core.common.businessentities.VmWatchdog in project ovirt-engine by oVirt.
the class BackendTemplateWatchdogResourceTest method getEntity.
private VmWatchdog getEntity() {
VmWatchdog watchdog = new VmWatchdog();
watchdog.setId(WATCHDOG_ID);
watchdog.setAction(VmWatchdogAction.RESET);
watchdog.setModel(VmWatchdogType.i6300esb);
return watchdog;
}
Aggregations