Search in sources :

Example 16 with VmWatchdog

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();
}
Also used : UsbPolicy(org.ovirt.engine.core.common.businessentities.UsbPolicy) QueryType(org.ovirt.engine.core.common.queries.QueryType) AsyncDataProvider.getInstance(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider.getInstance) Arrays(java.util.Arrays) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) VmBase(org.ovirt.engine.core.common.businessentities.VmBase) BuilderExecutor(org.ovirt.engine.ui.uicommonweb.builders.BuilderExecutor) NameAndDescriptionVmBaseToUnitBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.NameAndDescriptionVmBaseToUnitBuilder) Guid(org.ovirt.engine.core.compat.Guid) Collection(java.util.Collection) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) Set(java.util.Set) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) HashSet(java.util.HashSet) HwOnlyVmBaseToUnitBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.HwOnlyVmBaseToUnitBuilder) Frontend(org.ovirt.engine.ui.frontend.Frontend) List(java.util.List) VmRngDevice(org.ovirt.engine.core.common.businessentities.VmRngDevice) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel) VmDevice(org.ovirt.engine.core.common.businessentities.VmDevice) AsyncQuery(org.ovirt.engine.ui.frontend.AsyncQuery) GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) Set(java.util.Set) HashSet(java.util.HashSet) GraphicsDevice(org.ovirt.engine.core.common.businessentities.GraphicsDevice) Collection(java.util.Collection) List(java.util.List) VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog) VmRngDevice(org.ovirt.engine.core.common.businessentities.VmRngDevice)

Example 17 with VmWatchdog

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);
}
Also used : Version(org.ovirt.engine.core.compat.Version) OsRepository(org.ovirt.engine.core.common.osinfo.OsRepository) VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog)

Example 18 with VmWatchdog

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;
}
Also used : VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog)

Example 19 with VmWatchdog

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;
}
Also used : VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog)

Example 20 with VmWatchdog

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;
}
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