Greg Padgett has uploaded a new change for review. Change subject: webadmin, backend: control of hosted engine maintenance mode ......................................................................
webadmin, backend: control of hosted engine maintenance mode Allow control of hosted engine local/global maintenance. Global maintenance is performed via right-clicking on the host, while local maintenance is tied into the existing host vds maintenance operation. Change-Id: I0f76f7ad63bcf6d7871c362b46cfa6e928eb9c74 Bug-Url: https://bugzilla.redhat.com/1047649 Signed-off-by: Greg Padgett <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceNumberOfVdssCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceVdsCommand.java A backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetHaMaintenanceCommand.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/SetHaMaintenanceParameters.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/HaMaintenanceMode.java A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/SetHaMaintenanceModeVDSCommandParameters.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java M backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java A backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SetHaMaintenanceModeVDSCommand.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java M frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java M frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java M frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java M frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVirtualMachineView.java A packaging/dbscripts/upgrade/03_04_0510_add_ha_maintenance_events.sql 24 files changed, 372 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/23531/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.java index bb15e13..6674a75 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.java @@ -9,6 +9,7 @@ import org.ovirt.engine.core.common.AuditLogType; import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.VdsActionParameters; +import org.ovirt.engine.core.common.businessentities.HaMaintenanceMode; import org.ovirt.engine.core.common.businessentities.VDS; import org.ovirt.engine.core.common.businessentities.VDSStatus; import org.ovirt.engine.core.common.businessentities.network.Network; @@ -16,6 +17,7 @@ import org.ovirt.engine.core.common.locks.LockingGroup; import org.ovirt.engine.core.common.utils.Pair; import org.ovirt.engine.core.common.vdscommands.ActivateVdsVDSCommandParameters; +import org.ovirt.engine.core.common.vdscommands.SetHaMaintenanceModeVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.VDSCommandType; import org.ovirt.engine.core.common.vdscommands.VDSReturnValue; @@ -28,8 +30,11 @@ @NonTransactiveCommandAttribute public class ActivateVdsCommand<T extends VdsActionParameters> extends VdsCommand<T> { + private boolean haMaintenanceFailed; + public ActivateVdsCommand(T parameters) { super(parameters); + haMaintenanceFailed = false; } /** @@ -39,6 +44,7 @@ */ protected ActivateVdsCommand(Guid commandId) { super(commandId); + haMaintenanceFailed = false; } @Override @@ -67,6 +73,14 @@ return null; } }); + + if (vds.getHighlyAvailableIsConfigured()) { + SetHaMaintenanceModeVDSCommandParameters param + = new SetHaMaintenanceModeVDSCommandParameters(vds, HaMaintenanceMode.LOCAL, false); + if (!runVdsCommand(VDSCommandType.SetHaMaintenanceMode, param).getSucceeded()) { + haMaintenanceFailed = true; + } + } } } @@ -96,9 +110,17 @@ @Override public AuditLogType getAuditLogTypeValue() { if (getParameters().isRunSilent()) { - return getSucceeded() ? AuditLogType.VDS_ACTIVATE_ASYNC : AuditLogType.VDS_ACTIVATE_FAILED_ASYNC; + return getSucceeded() + ? (haMaintenanceFailed + ? AuditLogType.VDS_ACTIVATE_MANUAL_HA_ASYNC + : AuditLogType.VDS_ACTIVATE_ASYNC) + : AuditLogType.VDS_ACTIVATE_FAILED_ASYNC; } else { - return getSucceeded() ? AuditLogType.VDS_ACTIVATE : AuditLogType.VDS_ACTIVATE_FAILED; + return getSucceeded() + ? (haMaintenanceFailed + ? AuditLogType.VDS_ACTIVATE_MANUAL_HA + : AuditLogType.VDS_ACTIVATE) + : AuditLogType.VDS_ACTIVATE_FAILED; } } } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceNumberOfVdssCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceNumberOfVdssCommand.java index 4867e60..8d4eecb 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceNumberOfVdssCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceNumberOfVdssCommand.java @@ -203,6 +203,10 @@ List<String> nonMigratableVmDescriptionsToFrontEnd = new ArrayList<String>(); for (VM vm : vms) { + if (vm.isHostedEngine()) { + // The Hosted Engine vm is migrated by the HA agent + continue; + } if (vm.getMigrationSupport() != MigrationSupport.MIGRATABLE) { nonMigratableVmDescriptionsToFrontEnd.add(vm.getName()); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceVdsCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceVdsCommand.java index f6a25ab..8c62c03 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceVdsCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MaintenanceVdsCommand.java @@ -16,6 +16,7 @@ import org.ovirt.engine.core.common.action.MaintenanceVdsParameters; import org.ovirt.engine.core.common.action.VdcActionType; import org.ovirt.engine.core.common.action.VdcReturnValueBase; +import org.ovirt.engine.core.common.businessentities.HaMaintenanceMode; import org.ovirt.engine.core.common.businessentities.MigrationSupport; import org.ovirt.engine.core.common.businessentities.StoragePool; import org.ovirt.engine.core.common.businessentities.StoragePoolStatus; @@ -32,6 +33,7 @@ import org.ovirt.engine.core.common.job.Step; import org.ovirt.engine.core.common.job.StepEnum; import org.ovirt.engine.core.common.vdscommands.DisconnectStoragePoolVDSCommandParameters; +import org.ovirt.engine.core.common.vdscommands.SetHaMaintenanceModeVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters; import org.ovirt.engine.core.common.vdscommands.VDSCommandType; import org.ovirt.engine.core.compat.Guid; @@ -47,10 +49,12 @@ private final boolean _isInternal; private List<VM> vms; + private boolean haMaintenanceFailed; public MaintenanceVdsCommand(T parameters) { super(parameters); _isInternal = parameters.getIsInternal(); + haMaintenanceFailed = false; } @Override @@ -60,6 +64,22 @@ setSucceeded(true); } else { orderListOfRunningVmsOnVds(getVdsId()); + + if (getVds().getHighlyAvailableIsConfigured()) { + SetHaMaintenanceModeVDSCommandParameters params + = new SetHaMaintenanceModeVDSCommandParameters(getVds(), HaMaintenanceMode.LOCAL, true); + if (!runVdsCommand(VDSCommandType.SetHaMaintenanceMode, params).getSucceeded()) { + // HA maintenance failure is fatal only if the Hosted Engine vm is running on this host + for (VM vm : vms) { + if (vm.isHostedEngine()) { + setSucceeded(false); + return; + } + } + haMaintenanceFailed = true; + } + } + setSucceeded(migrateAllVms(getExecutionContext())); // if non responsive move directly to maintenance @@ -103,6 +123,10 @@ boolean succeeded = true; for (VM vm : vms) { + if (vm.isHostedEngine()) { + // The Hosted Engine vm is migrated by the HA agent + continue; + } // if HAOnly is true check that vm is HA (auto_startup should be true) if (vm.getStatus() != VMStatus.MigratingFrom && (!HAOnly || (HAOnly && vm.isAutoStartup()))) { VdcReturnValueBase result = @@ -145,14 +169,18 @@ @Override public AuditLogType getAuditLogTypeValue() { if (_isInternal) { - if (getSucceeded()) { + if (getSucceeded() && !haMaintenanceFailed) { return AuditLogType.VDS_MAINTENANCE; + } else if (getSucceeded()) { + return AuditLogType.VDS_MAINTENANCE_MANUAL_HA; } else { return AuditLogType.VDS_MAINTENANCE_FAILED; } } else { - if (getSucceeded()) { + if (getSucceeded() && !haMaintenanceFailed) { return AuditLogType.USER_VDS_MAINTENANCE; + } else if (getSucceeded()) { + return AuditLogType.USER_VDS_MAINTENANCE_MANUAL_HA; } else { return AuditLogType.USER_VDS_MAINTENANCE_MIGRATION_FAILED; } @@ -174,6 +202,10 @@ orderListOfRunningVmsOnVds(vdsId); for (VM vm : vms) { + if (vm.isHostedEngine()) { + // The Hosted Engine vm is migrated by the HA agent + continue; + } if (vm.getMigrationSupport() != MigrationSupport.MIGRATABLE) { reasons.add(VdcBllMessages.VDS_CANNOT_MAINTENANCE_IT_INCLUDES_NON_MIGRATABLE_VM.toString()); return false; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetHaMaintenanceCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetHaMaintenanceCommand.java new file mode 100644 index 0000000..26d165a --- /dev/null +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/SetHaMaintenanceCommand.java @@ -0,0 +1,68 @@ +package org.ovirt.engine.core.bll; + + +import org.ovirt.engine.core.bll.utils.PermissionSubject; +import org.ovirt.engine.core.common.AuditLogType; +import org.ovirt.engine.core.common.VdcObjectType; +import org.ovirt.engine.core.common.action.SetHaMaintenanceParameters; +import org.ovirt.engine.core.common.action.VdsActionParameters; +import org.ovirt.engine.core.common.errors.VdcBLLException; +import org.ovirt.engine.core.common.errors.VdcBllMessages; +import org.ovirt.engine.core.common.vdscommands.SetHaMaintenanceModeVDSCommandParameters; +import org.ovirt.engine.core.common.vdscommands.VDSCommandType; + +import java.util.Collections; +import java.util.List; + +@NonTransactiveCommandAttribute +public class SetHaMaintenanceCommand extends VdsCommand<VdsActionParameters> { + + public SetHaMaintenanceCommand(VdsActionParameters vdsActionParameters) { + super(vdsActionParameters); + } + + @Override + protected void executeCommand() { + boolean succeeded = false; + SetHaMaintenanceParameters params = (SetHaMaintenanceParameters) getParameters(); + try { + succeeded = runVdsCommand( + VDSCommandType.SetHaMaintenanceMode, + new SetHaMaintenanceModeVDSCommandParameters( + getVds(), params.getMode(), params.getIsEnabled())) + .getSucceeded(); + } catch (VdcBLLException e) { + log.errorFormat("Could not {0} {1} Hosted Engine HA maintenance mode on host {2}", + (params.getIsEnabled() ? "enable" : "disable"), + params.getMode().name().toLowerCase(), + getVdsName()); + } + getReturnValue().setSucceeded(succeeded); + } + + @Override + protected boolean canDoAction() { + VdsValidator vdsValidator = new VdsValidator(getVds()); + + return validate(vdsValidator.exists()) + && validate(vdsValidator.isUp()); + } + + @Override + public List<PermissionSubject> getPermissionCheckSubjects() { + return Collections.singletonList(new PermissionSubject(getParameters().getVdsId(), + VdcObjectType.VDS, getActionType().getActionGroup())); + } + + @Override + public AuditLogType getAuditLogTypeValue() { + return getSucceeded() ? AuditLogType.USER_SET_HOSTED_ENGINE_MAINTENANCE + : AuditLogType.USER_FAILED_TO_SET_HOSTED_ENGINE_MAINTENANCE; + } + + @Override + protected void setActionMessageParameters() { + addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM__CLUSTER); + addCanDoActionMessage(VdcBllMessages.VAR__ACTION__UPDATE); + } +} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java index 9bf4842..b747ab4 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/AuditLogType.java @@ -16,6 +16,7 @@ VDS_RECOVER(14), // When VDS changes status down->up VDS_MAINTENANCE(15), // When VDS is transferred to maintenance mode VDS_ACTIVATE(16), // When VDS is reactivated + VDS_ACTIVATE_MANUAL_HA(10404), // When VDS is reactivated VDS_MAINTENANCE_FAILED(17, AuditLogTimeInterval.MINUTE.getValue()), // When VDS is transferred to maintenance mode VDS_ACTIVATE_FAILED(18, AuditLogTimeInterval.MINUTE.getValue()), // When VDS is reactivated VDS_RECOVER_FAILED(19, AuditLogTimeInterval.MINUTE.getValue()), // When VDS changes status down->up @@ -68,6 +69,8 @@ CPU_FLAGS_NX_IS_MISSING(601), // maintenance mode USER_VDS_MAINTENANCE_MIGRATION_FAILED(602), + VDS_MAINTENANCE_MANUAL_HA(10402, AuditLogTimeInterval.MINUTE.getValue()), + USER_VDS_MAINTENANCE_MANUAL_HA(10403), SYSTEM_VDS_RESTART(121, AuditLogTimeInterval.MINUTE.getValue()), SYSTEM_FAILED_VDS_RESTART(122, AuditLogTimeInterval.MINUTE.getValue()), @@ -766,6 +769,7 @@ TASK_CLEARING_ASYNC_TASK(9501, AuditLogTimeInterval.MINUTE.getValue()), VDS_ACTIVATE_ASYNC(9502, AuditLogTimeInterval.HOUR.getValue() * 3), // When VDS is reactivated by autorecovery + VDS_ACTIVATE_MANUAL_HA_ASYNC(10405, AuditLogTimeInterval.HOUR.getValue() * 3), // When VDS is reactivated by autorecovery VDS_ACTIVATE_FAILED_ASYNC(9503, AuditLogTimeInterval.HOUR.getValue() * 3), // When VDS is reactivated STORAGE_ACTIVATE_ASYNC(9504, AuditLogTimeInterval.HOUR.getValue() * 3), // When VDS is reactivated by autorecovery @@ -856,7 +860,11 @@ USER_UPDATED_AFFINITY_GROUP(10352), USER_FAILED_TO_UPDATE_AFFINITY_GROUP(10353), USER_REMOVED_AFFINITY_GROUP(10354), - USER_FAILED_TO_REMOVE_AFFINITY_GROUP(10355); + USER_FAILED_TO_REMOVE_AFFINITY_GROUP(10355), + + // Hosted Engine + USER_SET_HOSTED_ENGINE_MAINTENANCE(10400), + USER_FAILED_TO_SET_HOSTED_ENGINE_MAINTENANCE(10401); private int intValue; // indicates time interval in seconds on which identical events from same instance are suppressed. diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java index 932e774..05f8b2c 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/VdcEventNotificationUtils.java @@ -20,7 +20,9 @@ // VDS AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.VDS_FAILURE); AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.USER_VDS_MAINTENANCE); + AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.USER_VDS_MAINTENANCE_MANUAL_HA); AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.USER_VDS_MAINTENANCE_MIGRATION_FAILED); + AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.VDS_ACTIVATE_MANUAL_HA); AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.VDS_ACTIVATE_FAILED); AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.VDS_RECOVER_FAILED); AddEventNotificationEntry(EventNotificationEntity.Host, AuditLogType.VDS_APPROVE_FAILED); diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/SetHaMaintenanceParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/SetHaMaintenanceParameters.java new file mode 100644 index 0000000..cf92fc0 --- /dev/null +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/SetHaMaintenanceParameters.java @@ -0,0 +1,27 @@ +package org.ovirt.engine.core.common.action; + +import org.ovirt.engine.core.common.businessentities.HaMaintenanceMode; +import org.ovirt.engine.core.compat.Guid; + +public class SetHaMaintenanceParameters extends VdsActionParameters { + private static final long serialVersionUID = -3296572537630656681L; + private HaMaintenanceMode mode; + private boolean enabled; + + public SetHaMaintenanceParameters(Guid vdsId, HaMaintenanceMode mode, boolean enabled) { + super(vdsId); + this.mode = mode; + this.enabled = enabled; + } + + public SetHaMaintenanceParameters() { + } + + public HaMaintenanceMode getMode() { + return this.mode; + } + + public boolean getIsEnabled() { + return this.enabled; + } +} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java index 22b2421..80fd235 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VdcActionType.java @@ -321,7 +321,9 @@ // Affinity Groups AddAffinityGroup(1950, ActionGroup.MANIPULATE_AFFINITY_GROUPS, false, QuotaDependency.NONE), EditAffinityGroup(1951, ActionGroup.MANIPULATE_AFFINITY_GROUPS, false, QuotaDependency.NONE), - RemoveAffinityGroup(1952, ActionGroup.MANIPULATE_AFFINITY_GROUPS, false, QuotaDependency.NONE); + RemoveAffinityGroup(1952, ActionGroup.MANIPULATE_AFFINITY_GROUPS, false, QuotaDependency.NONE), + + SetHaMaintenance(2000, ActionGroup.MANIPUTLATE_HOST, false, QuotaDependency.NONE); private int intValue; private ActionGroup actionGroup; diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/HaMaintenanceMode.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/HaMaintenanceMode.java new file mode 100644 index 0000000..c1dd681 --- /dev/null +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/HaMaintenanceMode.java @@ -0,0 +1,14 @@ +package org.ovirt.engine.core.common.businessentities; + +public enum HaMaintenanceMode { + GLOBAL, + LOCAL; + + public int getValue() { + return this.ordinal(); + } + + public static HaMaintenanceMode forValue(int value) { + return values()[value]; + } +} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/SetHaMaintenanceModeVDSCommandParameters.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/SetHaMaintenanceModeVDSCommandParameters.java new file mode 100644 index 0000000..d4889be --- /dev/null +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/SetHaMaintenanceModeVDSCommandParameters.java @@ -0,0 +1,37 @@ +package org.ovirt.engine.core.common.vdscommands; + +import org.ovirt.engine.core.common.businessentities.HaMaintenanceMode; +import org.ovirt.engine.core.common.businessentities.VDS; + +/** + * Parameters used to change Hosted Engine maintenance mode + */ +public class SetHaMaintenanceModeVDSCommandParameters extends VdsIdVDSCommandParametersBase { + private HaMaintenanceMode mode; + private boolean enabled; + + public SetHaMaintenanceModeVDSCommandParameters(VDS vds, HaMaintenanceMode mode, boolean enabled) { + super(vds.getId()); + this.mode = mode; + this.enabled = enabled; + } + + public SetHaMaintenanceModeVDSCommandParameters() { + } + + public HaMaintenanceMode getMode() { + return mode; + } + + public void setMode(HaMaintenanceMode mode) { + this.mode = mode; + } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } +} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java index 8648cab..d8e5f448 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/VDSCommandType.java @@ -117,6 +117,7 @@ ExtendImageSize("org.ovirt.engine.core.vdsbroker.irsbroker"), ExtendVmDiskSize("org.ovirt.engine.core.vdsbroker.vdsbroker"), SetMOMPolicyParameters("org.ovirt.engine.core.vdsbroker.vdsbroker"), + SetHaMaintenanceMode("org.ovirt.engine.core.vdsbroker.vdsbroker"), // Gluster VDS commands CreateGlusterVolume("org.ovirt.engine.core.vdsbroker.gluster"), SetGlusterVolumeOption("org.ovirt.engine.core.vdsbroker.gluster"), diff --git a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java index f58d39a..e43915a 100644 --- a/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java +++ b/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/auditloghandling/AuditLogDirector.java @@ -63,6 +63,7 @@ initExtrnalEvents(); initMomPoliciesSeverities(); initPmPolicySeverities(); + initHostedEngineSeverities(); } private static void initProviderSeverities() { @@ -298,12 +299,15 @@ severities.put(AuditLogType.VDS_RECOVER_FAILED, AuditLogSeverity.ERROR); severities.put(AuditLogType.VDS_RECOVER_FAILED_VMS_UNKNOWN, AuditLogSeverity.ERROR); severities.put(AuditLogType.VDS_MAINTENANCE, AuditLogSeverity.WARNING); + severities.put(AuditLogType.VDS_MAINTENANCE_MANUAL_HA, AuditLogSeverity.WARNING); severities.put(AuditLogType.VDS_MAINTENANCE_FAILED, AuditLogSeverity.ERROR); severities.put(AuditLogType.VDS_STATUS_CHANGE_FAILED_DUE_TO_STOP_SPM_FAILURE, AuditLogSeverity.WARNING); + severities.put(AuditLogType.USER_VDS_MAINTENANCE_MANUAL_HA, AuditLogSeverity.WARNING); severities.put(AuditLogType.USER_VDS_MAINTENANCE_MIGRATION_FAILED, AuditLogSeverity.WARNING); severities.put(AuditLogType.SYSTEM_VDS_RESTART, AuditLogSeverity.NORMAL); severities.put(AuditLogType.SYSTEM_FAILED_VDS_RESTART, AuditLogSeverity.ERROR); severities.put(AuditLogType.VDS_ACTIVATE, AuditLogSeverity.NORMAL); + severities.put(AuditLogType.VDS_ACTIVATE_MANUAL_HA, AuditLogSeverity.WARNING); severities.put(AuditLogType.VDS_ACTIVATE_FAILED, AuditLogSeverity.ERROR); severities.put(AuditLogType.HOST_REFRESHED_CAPABILITIES, AuditLogSeverity.NORMAL); severities.put(AuditLogType.HOST_REFRESH_CAPABILITIES_FAILED, AuditLogSeverity.ERROR); @@ -357,6 +361,7 @@ severities.put(AuditLogType.VDS_LOW_DISK_SPACE, AuditLogSeverity.WARNING); severities.put(AuditLogType.VDS_LOW_DISK_SPACE_ERROR, AuditLogSeverity.ERROR); severities.put(AuditLogType.VDS_ACTIVATE_ASYNC, AuditLogSeverity.NORMAL); + severities.put(AuditLogType.VDS_ACTIVATE_MANUAL_HA, AuditLogSeverity.WARNING); severities.put(AuditLogType.VDS_ACTIVATE_FAILED_ASYNC, AuditLogSeverity.NORMAL); severities.put(AuditLogType.VDS_SET_NON_OPERATIONAL_VM_NETWORK_IS_BRIDGELESS, AuditLogSeverity.WARNING); severities.put(AuditLogType.EMULATED_MACHINES_INCOMPATIBLE_WITH_CLUSTER, AuditLogSeverity.WARNING); @@ -507,6 +512,11 @@ severities.put(AuditLogType.USER_FAILED_TO_UPDATE_MOM_POLICIES, AuditLogSeverity.WARNING); } + private static void initHostedEngineSeverities() { + severities.put(AuditLogType.USER_SET_HOSTED_ENGINE_MAINTENANCE, AuditLogSeverity.NORMAL); + severities.put(AuditLogType.USER_FAILED_TO_SET_HOSTED_ENGINE_MAINTENANCE, AuditLogSeverity.WARNING); + } + private static void initVMSeverities() { severities.put(AuditLogType.USER_ATTACH_VM_TO_AD_GROUP, AuditLogSeverity.NORMAL); severities.put(AuditLogType.USER_ATTACH_VM_TO_AD_GROUP_FAILED, AuditLogSeverity.ERROR); diff --git a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties index 051e1fc..ea34a9f 100644 --- a/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties +++ b/backend/manager/modules/dal/src/main/resources/bundles/AuditLogMessages.properties @@ -206,6 +206,8 @@ VDC_STOP=Stopping oVirt Engine. VDS_ACTIVATE=Host ${VdsName} was activated by ${UserName}. VDS_ACTIVATE_ASYNC=Host ${VdsName} was autorecovered. +VDS_ACTIVATE_MANUAL_HA=Host ${VdsName} was activated by ${UserName}, but Hosted Engine HA may still be in maintenance mode. If necessary, please correct this manually. +VDS_ACTIVATE_MANUAL_HA_ASYNC=Host ${VdsName} was autorecovered, but Hosted Engine HA may still be in maintenance mode. If necessary, please correct this manually. VDS_ACTIVATE_FAILED=Failed to activate Host ${VdsName}.(User: ${UserName}). VDS_ACTIVATE_FAILED_ASYNC=Failed to autorecover Host ${VdsName}. HOST_REFRESHED_CAPABILITIES=Successfully refreshed the capabilities of host ${VdsName}. @@ -213,6 +215,7 @@ VDS_DETECTED=State was set to ${VdsStatus} for host ${VdsName}. VDS_FAILURE=Host ${VdsName} is non responsive. VDS_MAINTENANCE=Host ${VdsName} was switched to Maintenance Mode. +VDS_MAINTENANCE_MANUAL_HA=Host ${VdsName} was switched to Maintenance mode, but Hosted Engine HA maintenance could not be enabled. Please enable it manually. VDS_MAINTENANCE_FAILED=Failed to switch Host ${VdsName} to Maintenance mode. VDS_RECOVER=Host ${VdsName} is rebooting. VDS_RECOVER_FAILED=Host ${VdsName} failed to recover. @@ -294,6 +297,7 @@ USER_SUSPEND_VM_FINISH_FAILURE_WILL_TRY_AGAIN=Failed to complete suspending of VM ${VmName}, will try again. USER_FAILED_SUSPEND_VM=Failed to suspend VM ${VmName} (Host: ${VdsName}). USER_VDS_MAINTENANCE=Host ${VdsName} was switched to Maintenance mode by ${UserName}. +USER_VDS_MAINTENANCE_MANUAL_HA=Host ${VdsName} was switched to Maintenance mode by ${UserName}, but Hosted Engine HA maintenance could not be enabled. Please enable it manually. USER_VDS_MAINTENANCE_MIGRATION_FAILED=Host ${VdsName} cannot change into maintenance mode - not all Vms have been migrated successfully. Consider manual intervention: stopping/migrating Vms: ${failedVms} (User: ${UserName}). USER_EXPORT_VM=VM ${VmName} exported to ${ExportPath} by ${UserName} USER_EXPORT_VM_FAILED=Failed to export VM ${VmName} to ${ExportPath} (User: ${UserName}) @@ -750,3 +754,5 @@ USER_FAILED_TO_UPDATE_AFFINITY_GROUP=Failed to update Affinity Group ${affinityGroupName}. (User: ${UserName}) USER_REMOVED_AFFINITY_GROUP=Affinity Group ${affinityGroupName} was removed. (User: ${UserName}) USER_FAILED_TO_REMOVE_AFFINITY_GROUP=Failed to remove Affinity Group ${affinityGroupName}. (User: ${UserName}) +USER_SET_HOSTED_ENGINE_MAINTENANCE=Hosted Engine HA maintenance mode was updated on host ${VdsName}. +USER_FAILED_TO_SET_HOSTED_ENGINE_MAINTENANCE=Hosted Engine HA maintenance mode could not be updated on host ${VdsName}. diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java index 3fa9d52..4761321 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/IVdsServer.java @@ -48,6 +48,8 @@ StatusOnlyReturnForXmlRpc setMOMPolicyParameters(Map<String, Object> key_value_store); + StatusOnlyReturnForXmlRpc setHaMaintenanceMode(String mode, boolean enabled); + StatusOnlyReturnForXmlRpc desktopLogin(String vmId, String domain, String user, String password); StatusOnlyReturnForXmlRpc desktopLogoff(String vmId, String force); diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SetHaMaintenanceModeVDSCommand.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SetHaMaintenanceModeVDSCommand.java new file mode 100644 index 0000000..0ad63b8 --- /dev/null +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/SetHaMaintenanceModeVDSCommand.java @@ -0,0 +1,22 @@ +package org.ovirt.engine.core.vdsbroker.vdsbroker; + +import org.ovirt.engine.core.common.vdscommands.SetHaMaintenanceModeVDSCommandParameters; +import org.ovirt.engine.core.dal.dbbroker.DbFacade; + +/** + * Send variables that set Hosted Engine maintenance mode to VDSM + */ +public class SetHaMaintenanceModeVDSCommand extends VdsBrokerCommand<SetHaMaintenanceModeVDSCommandParameters> { + + public SetHaMaintenanceModeVDSCommand(SetHaMaintenanceModeVDSCommandParameters parameters) { + super(parameters, DbFacade.getInstance().getVdsDao().get(parameters.getVdsId())); + } + + @Override + protected void executeVdsBrokerCommand() { + if (getVds().getHighlyAvailableIsConfigured()) { + status = getBroker().setHaMaintenanceMode(getParameters().getMode().name(), getParameters().isEnabled()); + proceedProxyReturnValue(); + } + } +} diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java index fb37e79..a746888 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerConnector.java @@ -36,6 +36,8 @@ public Map<String, Object> setMOMPolicyParameters(Map<String, Object> key_value); + public Map<String, Object> setHaMaintenanceMode(String mode, boolean enabled); + public Map<String, Object> getAllVmStats(); public Map<String, Object> migrate(Map<String, String> migrationInfo); diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java index d826685..e2bc44c 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsServerWrapper.java @@ -1371,6 +1371,17 @@ } @Override + public StatusOnlyReturnForXmlRpc setHaMaintenanceMode(String mode, boolean enabled) { + try { + Map<String, Object> xmlRpcReturnValue = vdsServer.setHaMaintenanceMode(mode, enabled); + StatusOnlyReturnForXmlRpc wrapper = new StatusOnlyReturnForXmlRpc(xmlRpcReturnValue); + return wrapper; + } catch (UndeclaredThrowableException ute) { + throw new XmlRpcRunTimeException(ute); + } + } + + @Override public GlusterTasksListReturnForXmlRpc glusterTasksList() { try { Map<String, Object> xmlRpcReturnValue = vdsServer.glusterTasksList(); diff --git a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml index 8cd71bc..e42c435 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml +++ b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/core/Common.gwt.xml @@ -55,6 +55,7 @@ <include name="common/businessentities/OpenStackImageProviderProperties.java" /> <include name="common/businessentities/VmBalloonInfo.java" /> <include name="common/businessentities/ArchitectureType.java" /> + <include name="common/businessentities/HaMaintenanceMode.java" /> <!-- Network business entities --> <include name="common/businessentities/network/VdsNetworkInterface.java" /> diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java index 4ac6063..a43b780 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java @@ -19,6 +19,7 @@ import org.ovirt.engine.core.common.action.MoveVmParameters; import org.ovirt.engine.core.common.action.RemoveVmParameters; import org.ovirt.engine.core.common.action.RunVmParams; +import org.ovirt.engine.core.common.action.SetHaMaintenanceParameters; import org.ovirt.engine.core.common.action.ShutdownVmParameters; import org.ovirt.engine.core.common.action.StopVmParameters; import org.ovirt.engine.core.common.action.StopVmTypeEnum; @@ -31,6 +32,7 @@ import org.ovirt.engine.core.common.businessentities.Disk.DiskStorageType; import org.ovirt.engine.core.common.businessentities.DiskImage; import org.ovirt.engine.core.common.businessentities.DisplayType; +import org.ovirt.engine.core.common.businessentities.HaMaintenanceMode; import org.ovirt.engine.core.common.businessentities.StorageDomain; import org.ovirt.engine.core.common.businessentities.StoragePool; import org.ovirt.engine.core.common.businessentities.Tags; @@ -303,6 +305,30 @@ privateAssignTagsCommand = value; } + private UICommand privateEnableGlobalHaMaintenanceCommand; + + public UICommand getEnableGlobalHaMaintenanceCommand() + { + return privateEnableGlobalHaMaintenanceCommand; + } + + private void setEnableGlobalHaMaintenanceCommand(UICommand value) + { + privateEnableGlobalHaMaintenanceCommand = value; + } + + private UICommand privateDisableGlobalHaMaintenanceCommand; + + public UICommand getDisableGlobalHaMaintenanceCommand() + { + return privateDisableGlobalHaMaintenanceCommand; + } + + private void setDisableGlobalHaMaintenanceCommand(UICommand value) + { + privateDisableGlobalHaMaintenanceCommand = value; + } + UICommand editConsoleCommand; public void setEditConsoleCommand(UICommand editConsoleCommand) { @@ -411,6 +437,8 @@ setRetrieveIsoImagesCommand(new UICommand("RetrieveIsoImages", this)); //$NON-NLS-1$ setChangeCdCommand(new UICommand("ChangeCD", this)); //$NON-NLS-1$ setAssignTagsCommand(new UICommand("AssignTags", this)); //$NON-NLS-1$ + setEnableGlobalHaMaintenanceCommand(new UICommand("EnableGlobalHaMaintenance", this)); //$NON-NLS-1$ + setDisableGlobalHaMaintenanceCommand(new UICommand("DisableGlobalHaMaintenance", this)); //$NON-NLS-1$ setIsoImages(new ObservableCollection<ChangeCDModel>()); ChangeCDModel tempVar = new ChangeCDModel(); @@ -1810,6 +1838,20 @@ }, model); } + private void setGlobalHaMaintenance(boolean enabled) + { + VM vm = (VM) getSelectedItem(); + if (vm == null) { + return; + } + if (!vm.isHostedEngine()) { + return; + } + + SetHaMaintenanceParameters params = new SetHaMaintenanceParameters(vm.getRunOnVds(), HaMaintenanceMode.GLOBAL, enabled); + Frontend.getInstance().runAction(VdcActionType.SetHaMaintenance, params, null, this); + } + private void preSave() { final UnitVmModel model = (UnitVmModel) getWindow(); @@ -2261,6 +2303,11 @@ && VdcActionUtils.canExecute(items, VM.class, VdcActionType.ChangeDisk)); getAssignTagsCommand().setIsExecutionAllowed(items.size() > 0); + getEnableGlobalHaMaintenanceCommand().setIsExecutionAllowed(items.size() == 1 + && isHaMaintenanceAllowed()); + getDisableGlobalHaMaintenanceCommand().setIsExecutionAllowed(items.size() == 1 + && isHaMaintenanceAllowed()); + getGuideCommand().setIsExecutionAllowed(getGuideContext() != null || (getSelectedItem() != null && getSelectedItems() != null && getSelectedItems().size() == 1)); @@ -2286,6 +2333,10 @@ } return false; + } + + private boolean isHaMaintenanceAllowed() { + return getSelectedItem() != null && ((VM) getSelectedItem()).isHostedEngine(); } /** @@ -2388,6 +2439,14 @@ { changeCD(); } + else if (command == getEnableGlobalHaMaintenanceCommand()) + { + setGlobalHaMaintenance(true); + } + else if (command == getDisableGlobalHaMaintenanceCommand()) + { + setGlobalHaMaintenance(false); + } else if (command == getAssignTagsCommand()) { assignTags(); diff --git a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java index 82f4509..151d996 100644 --- a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java +++ b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/LocalizedEnums.java @@ -218,12 +218,20 @@ String AuditLogType___USER_VDS_MAINTENANCE(); + String AuditLogType___USER_VDS_MAINTENANCE_MANUAL_HA(); + String AuditLogType___USER_VDS_MAINTENANCE_MIGRATION_FAILED(); String AuditLogType___VDS_MAINTENANCE(); + String AuditLogType___VDS_MAINTENANCE_MANUAL_HA(); + String AuditLogType___VDS_MAINTENANCE_FAILED(); + String AuditLogType___VDS_ACTIVATE_MANUAL_HA(); + + String AuditLogType___VDS_ACTIVATE_MANUAL_HA_ASYNC(); + String AuditLogType___VDS_ACTIVATE_FAILED(); String AuditLogType___VDS_RECOVER_FAILED(); diff --git a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties index 3d56d83..744a6d9 100644 --- a/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties +++ b/frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums.properties @@ -105,10 +105,14 @@ EventNotificationEntity___GlusterService=Gluster Service: AuditLogType___VDS_FAILURE=Host is non responsive AuditLogType___USER_VDS_MAINTENANCE=Host was switched to Maintenance Mode +AuditLogType___USER_VDS_MAINTENANCE_MANUAL_HA=Host was switched to Maintenance Mode, but Hosted Engine HA maintenance mode could not be enabled AuditLogType___USER_VDS_MAINTENANCE_MIGRATION_FAILED=Failed to switch Host to Maintenance mode AuditLogType___VDS_MAINTENANCE=Host was switched to Maintenance Mode +AuditLogType___VDS_MAINTENANCE_MANUAL_HA=Host was switched to Maintenance Mode, but Hosted Engine HA maintenance mode could not be enabled AuditLogType___VDS_MAINTENANCE_FAILED=Failed to switch Host to Maintenance mode AuditLogType___VDS_ACTIVATE_FAILED=Failed to activate Host +AuditLogType___VDS_ACTIVATE_MANUAL_HA=Host was activated, but Hosted Engine HA may still be in maintenance mode +AuditLogType___VDS_ACTIVATE_MANUAL_HA_ASYNC=Host was recovered, but Hosted Engine HA may still be in maintenance mode AuditLogType___VDS_RECOVER_FAILED=Host failed to recover AuditLogType___VDS_SLOW_STORAGE_RESPONSE_TIME=Slow storage response time AuditLogType___VDS_APPROVE_FAILED=Failed to approve Host diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java index 297feee..a66c0d0 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java @@ -1325,6 +1325,9 @@ @DefaultStringValue("Refresh Capabilities") String refreshHostCapabilities(); + @DefaultStringValue("Host HA Maintenance") + String hostHaMaintenance(); + // host- general @DefaultStringValue("OS Version") String osVersionHostGeneral(); @@ -1608,6 +1611,12 @@ @DefaultStringValue("Assign Tags") String assignTagsVm(); + @DefaultStringValue("Enable Global HA Maintenance") + String enableGlobalHaMaintenanceVm(); + + @DefaultStringValue("Disable Global HA Maintenance") + String disableGlobalHaMaintenanceVm(); + @DefaultStringValue("Show Report") String showReportVm(); diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVirtualMachineView.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVirtualMachineView.java index 08c11c5..2f5771d 100644 --- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVirtualMachineView.java +++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVirtualMachineView.java @@ -294,6 +294,18 @@ return getMainModel().getAssignTagsCommand(); } }); + getTable().addActionButton(new WebAdminButtonDefinition<VM>(constants.enableGlobalHaMaintenanceVm(), CommandLocation.OnlyFromContext) { + @Override + protected UICommand resolveCommand() { + return getMainModel().getEnableGlobalHaMaintenanceCommand(); + } + }); + getTable().addActionButton(new WebAdminButtonDefinition<VM>(constants.disableGlobalHaMaintenanceVm(), CommandLocation.OnlyFromContext) { + @Override + protected UICommand resolveCommand() { + return getMainModel().getDisableGlobalHaMaintenanceCommand(); + } + }); if (ReportInit.getInstance().isReportsEnabled()) { List<ActionButtonDefinition<VM>> resourceSubActions = diff --git a/packaging/dbscripts/upgrade/03_04_0510_add_ha_maintenance_events.sql b/packaging/dbscripts/upgrade/03_04_0510_add_ha_maintenance_events.sql new file mode 100644 index 0000000..a14cf18 --- /dev/null +++ b/packaging/dbscripts/upgrade/03_04_0510_add_ha_maintenance_events.sql @@ -0,0 +1,3 @@ + +INSERT INTO event_map(event_up_name, event_down_name) values('USER_VDS_MAINTENANCE_MANUAL_HA', 'VDS_ACTIVATE'); + -- To view, visit http://gerrit.ovirt.org/23531 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0f76f7ad63bcf6d7871c362b46cfa6e928eb9c74 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.4 Gerrit-Owner: Greg Padgett <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
