Dhandapani Gopal has uploaded a new change for review.

Change subject: engine: Introduced force action in gluster peer detach command
......................................................................

engine: Introduced force action in gluster peer detach command

Change-Id: If2b8fa947cd6a6ece79ecfe00041f54e31e9e7ae
Signed-off-by: Dhandapani <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVdsCommand.java
M 
backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveVdsCommandTest.java
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/GlusterServerParameters.java
3 files changed, 27 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/94/8894/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVdsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVdsCommand.java
index ac3c3f9..37ecf27 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVdsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVdsCommand.java
@@ -7,7 +7,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.ovirt.engine.core.bll.utils.ClusterUtils;
 import org.ovirt.engine.core.common.AuditLogType;
-import org.ovirt.engine.core.common.action.VdsActionParameters;
+import org.ovirt.engine.core.common.action.GlusterServerParameters;
 import org.ovirt.engine.core.common.businessentities.StorageType;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
@@ -28,7 +28,7 @@
 
 @NonTransactiveCommandAttribute
 @LockIdNameAttribute
-public class RemoveVdsCommand<T extends VdsActionParameters> extends 
VdsCommand<T> {
+public class RemoveVdsCommand<T extends GlusterServerParameters> extends 
VdsCommand<T> {
 
     private AuditLogType errorType = AuditLogType.USER_FAILED_REMOVE_VDS;
     private VDS upServer;
@@ -190,16 +190,13 @@
     }
 
     private void glusterHostRemove() {
-        // UI will implement forceAction later
-        // Now assume that the force option is false
-        boolean forceAction = false;
         if (isGlusterEnabled() && clusterHasMultipleHosts() && 
!hasVolumeOnServer()) {
             VDSReturnValue returnValue =
                     runVdsCommand(
                             VDSCommandType.GlusterHostRemove,
                             new 
GlusterHostRemoveVDSParameters(upServer.getId(),
                                     getVds().gethost_name(),
-                                    forceAction));
+                                    getParameters().isForceAction()));
             setSucceeded(returnValue.getSucceeded());
             if (!getSucceeded()) {
                 
getReturnValue().getFault().setError(returnValue.getVdsError().getCode());
diff --git 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveVdsCommandTest.java
 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveVdsCommandTest.java
index ee5c13d..aceb2f7 100644
--- 
a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveVdsCommandTest.java
+++ 
b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/RemoveVdsCommandTest.java
@@ -18,7 +18,7 @@
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
 import org.ovirt.engine.core.bll.utils.ClusterUtils;
-import org.ovirt.engine.core.common.action.VdsActionParameters;
+import org.ovirt.engine.core.common.action.GlusterServerParameters;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
@@ -60,7 +60,7 @@
     /**
      * The command under test.
      */
-    private RemoveVdsCommand<VdsActionParameters> command;
+    private RemoveVdsCommand<GlusterServerParameters> command;
 
     private Guid CLUSTER_ID = new Guid("b399944a-81ab-4ec5-8266-e19ba7c3c9d1");
 
@@ -68,8 +68,8 @@
     public void setUp() {
         MockitoAnnotations.initMocks(this);
 
-        VdsActionParameters parameters = createParameters();
-        command = spy(new RemoveVdsCommand<VdsActionParameters>(parameters));
+        GlusterServerParameters parameters = createParameters();
+        command = spy(new 
RemoveVdsCommand<GlusterServerParameters>(parameters));
         clusterUtils = mock(ClusterUtils.class);
 
         doReturn(vdsDAO).when(command).getVdsDAO();
@@ -228,8 +228,8 @@
     /**
      * @return Valid parameters for the command.
      */
-    private VdsActionParameters createParameters() {
-        VdsActionParameters parameters = new 
VdsActionParameters(Guid.NewGuid());
+    private GlusterServerParameters createParameters() {
+        GlusterServerParameters parameters = new 
GlusterServerParameters(Guid.NewGuid(), false);
         return parameters;
     }
 }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/GlusterServerParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/GlusterServerParameters.java
new file mode 100644
index 0000000..d784c2d
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/GlusterServerParameters.java
@@ -0,0 +1,18 @@
+package org.ovirt.engine.core.common.action;
+
+import org.ovirt.engine.core.compat.Guid;
+
+public class GlusterServerParameters extends VdsActionParameters {
+    private static final long serialVersionUID = 3959465593772384532L;
+
+    boolean forceAction;
+
+    public GlusterServerParameters(Guid vdsId, boolean forceAction) {
+     super(vdsId);
+     this.forceAction = forceAction;
+    }
+
+    public boolean isForceAction() {
+        return forceAction;
+    }
+}


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

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

Reply via email to