public static boolean isCommandAllowed(VM vm, ActionType actionType) { return !( (vm.isHostedEngine() && !COMMANDS_ALLOWED_ON_HOSTED_ENGINE.contains(actionType)) || (vm.isExternalVm() && !COMMANDS_ALLOWED_ON_EXTERNAL_VMS.contains(actionType)) ); } }
/** * @param vm this VM is expected to be hosted engine vm. See {@link VM#isHostedEngine()} * @param fullEntityOvfData entity which contains extra data for VM. See {@link OvfWriter} * @param version version identifier on OVF. Usually the related vm's cluster version. See {@link OvfWriter} * @param emulatedMachine emulated machine of the hosted engine VM. * @param cpuId the cpu id used by libvirt known as libvirt's cpu model. See {@link ServerCpu#getVdsVerbData()} */ public HostedEngineOvfWriter( @NotNull VM vm, @NotNull FullEntityOvfData fullEntityOvfData, @NotNull Version version, @NotNull String emulatedMachine, @NotNull String cpuId, @NotNull OsRepository osRepository, String engineXml) { super(vm, fullEntityOvfData, version, osRepository, null); if (!vm.isHostedEngine()) { throw new IllegalArgumentException( String.format("The VM %s isn't hosted engine - aborting the export", vm)); } this.emulatedMachine = Objects.requireNonNull(emulatedMachine, "The cluster emulated machine must not be null"); this.cpuId = Objects.requireNonNull(cpuId, "The cpuId must not be null"); this.engineXml = engineXml; }
@Override public boolean isValid(VmManagementParametersBase value, ConstraintValidatorContext context) { return !value.getVm().isHostedEngine() || Config.<Boolean> getValue(ConfigValues.AllowEditingHostedEngine); } }
@Override public Response maintenance(Action action) { validateParameters(action, "maintenanceEnabled"); org.ovirt.engine.core.common.businessentities.VM entity = getEntity(org.ovirt.engine.core.common.businessentities.VM.class, QueryType.GetVmByVmId, new IdQueryParameters(guid), id); if (!entity.isHostedEngine()) { throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST) .entity("Moving to maintenance mode is currently only available for the VM containing the hosted engine.") .build()); } return doAction(ActionType.SetHaMaintenance, new SetHaMaintenanceParameters(entity.getRunOnVds(), HaMaintenanceMode.GLOBAL, action.isMaintenanceEnabled()), action); }
public boolean isHostedEngine() { boolean isExistingVmBehavior = getBehavior() instanceof ExistingVmModelBehavior; if (isExistingVmBehavior) { ExistingVmModelBehavior behavior = (ExistingVmModelBehavior)getBehavior(); return behavior.getVm() != null ? behavior.getVm().isHostedEngine() : false; } return false; }
@Override public void updateHaAvailability() { super.updateHaAvailability(); if (getVm() != null && getVm().isHostedEngine()) { getModel().getIsHighlyAvailable().setEntity(false); getModel().getIsHighlyAvailable().setIsChangeable(false); getModel().getIsHighlyAvailable().setChangeProhibitionReason(getModel().constants.noHaWhenHostedEngineUsed()); } }
getcurrentVm().setUseLatestVersion(model.getTemplateWithVersion().getSelectedItem().isLatest()); if (selectedItem.isRunningOrPaused() && !selectedItem.isHostedEngine()) { AsyncDataProvider.getInstance().getVmChangedFieldsForNextRun(editedVm, getcurrentVm(), getUpdateVmParameters(false), new AsyncQuery<>( new AsyncCallback<QueryReturnValue>() {