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

Change subject: core: Restore host status if pm action failed
......................................................................

core: Restore host status if pm action failed

Fixes restoring previous host status if power management start/stop
action failed.

Change-Id: I96fc99e2ffad639508a5923f268fa57ae312daa3
Bug-Url: https://bugzilla.redhat.com/1205589
Signed-off-by: Martin Perina <mper...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/33/39133/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
index 124e703..acfb601 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
@@ -14,6 +14,7 @@
 import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.action.FenceVdsActionParameters;
 import org.ovirt.engine.core.common.action.VdcActionType;
+import org.ovirt.engine.core.common.businessentities.VdsDynamic;
 import org.ovirt.engine.core.common.businessentities.pm.FenceActionType;
 import org.ovirt.engine.core.common.businessentities.FenceStatusReturnValue;
 import org.ovirt.engine.core.common.businessentities.FenceAgent;
@@ -253,7 +254,9 @@
     }
 
     protected void setStatus(VDSStatus status) {
-        if (getVds().getStatus() != status) {
+        // we need to load current status from db
+        VdsDynamic currentHost = 
getDbFacade().getVdsDynamicDao().get(getVds().getId());
+        if (currentHost != null && currentHost.getStatus() != status) {
             
getBackend().getResourceManager().RunVdsCommand(VDSCommandType.SetVdsStatus,
                     new SetVdsStatusVDSCommandParameters(getVds().getId(), 
status));
         }


-- 
To view, visit https://gerrit.ovirt.org/39133
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I96fc99e2ffad639508a5923f268fa57ae312daa3
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Peřina <mper...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to