Martin Peřina has uploaded a new change for review.

Change subject: core: Restart VMs running on host when kdump is detected
......................................................................

core: Restart VMs running on host when kdump is detected

Restart VMs running on host when kdump is detected, because fencing is
not executed for such host (and restarting VMs is a part if host
fencing).

Change-Id: I026267d02c4f54888a7a8e7f38256f5d587f1c8f
Bug-Url: https://bugzilla.redhat.com/1079821
Signed-off-by: Martin Perina <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsKdumpDetectionCommand.java
1 file changed, 21 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/36/28736/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsKdumpDetectionCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsKdumpDetectionCommand.java
index 41c5ca8..d9b2789 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsKdumpDetectionCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VdsKdumpDetectionCommand.java
@@ -1,6 +1,7 @@
 package org.ovirt.engine.core.bll;
 
 import java.util.Calendar;
+import java.util.List;
 
 import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.ExternalVariable;
@@ -8,11 +9,13 @@
 import org.ovirt.engine.core.common.businessentities.KdumpFlowStatus;
 import org.ovirt.engine.core.common.businessentities.KdumpStatus;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
+import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.businessentities.VdsKdumpStatus;
 import org.ovirt.engine.core.common.config.Config;
 import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
 import 
org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters;
+import 
org.ovirt.engine.core.common.vdscommands.UpdateVdsVMsClearedVDSCommandParameters;
 import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
 import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector;
 import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase;
@@ -60,6 +63,21 @@
                 && fkAlive.getUpdateDate().getTime() + listenerTimeoutInterval 
>= System.currentTimeMillis();
     }
 
+    private void restartVdsVms() {
+        List<VM> vms = getVmDAO().getAllRunningForVds(getVdsId());
+        if (!vms.isEmpty()) {
+            RestartVdsVmsOperation restartVmsOper = new RestartVdsVmsOperation(
+                    getExecutionContext(),
+                    getVds()
+            );
+            restartVmsOper.restartVms(vms);
+            Backend.getInstance()
+                    .getResourceManager()
+                    .RunVdsCommand(VDSCommandType.UpdateVdsVMsCleared,
+                            new 
UpdateVdsVMsClearedVDSCommandParameters(getVds().getId()));
+        }
+    }
+
     private KdumpDetectionResult detectHostKdumping() {
         VdsKdumpStatus kdumpStatus;
         int messageInterval = 
Config.<Integer>getValue(ConfigValues.FenceKdumpMessageInterval) * 1000;
@@ -97,6 +115,9 @@
                             .RunVdsCommand(VDSCommandType.SetVdsStatus,
                                     new 
SetVdsStatusVDSCommandParameters(getVdsId(), VDSStatus.Kdumping)
                             );
+
+                    // restart VMs running on Vds
+                    restartVdsVms();
                 }
 
                 if (kdumpStatus.getStatus() == KdumpFlowStatus.FINISHED) {


-- 
To view, visit http://gerrit.ovirt.org/28736
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I026267d02c4f54888a7a8e7f38256f5d587f1c8f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Peřina <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to