Moti Asayag has uploaded a new change for review.

Change subject: engine: AcrivateVdsCommand cleanup
......................................................................

engine: AcrivateVdsCommand cleanup

The patch performs few minor cleanups.

Change-Id: I7b407c035cbc094b314b3d26a4a1d679b8a8303f
Signed-off-by: Moti Asayag <masa...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ActivateVdsCommand.java
1 file changed, 16 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/21/10821/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 2a98cf2..2b1dd98 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
@@ -11,31 +11,23 @@
 import org.ovirt.engine.core.common.action.VdsActionParameters;
 import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
-import org.ovirt.engine.core.common.locks.LockingGroup;
 import org.ovirt.engine.core.common.businessentities.network.Network;
+import org.ovirt.engine.core.common.locks.LockingGroup;
 import 
org.ovirt.engine.core.common.vdscommands.ActivateVdsVDSCommandParameters;
 import 
org.ovirt.engine.core.common.vdscommands.SetVdsStatusVDSCommandParameters;
 import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.dal.VdcBllMessages;
-import org.ovirt.engine.core.dal.dbbroker.DbFacade;
 import org.ovirt.engine.core.utils.transaction.TransactionMethod;
 import org.ovirt.engine.core.utils.transaction.TransactionSupport;
 
+@SuppressWarnings("serial")
 @LockIdNameAttribute
 @NonTransactiveCommandAttribute
 public class ActivateVdsCommand<T extends VdsActionParameters> extends 
VdsCommand<T> {
+
     public ActivateVdsCommand(T parameters) {
         super(parameters);
-    }
-
-    @Override
-    public AuditLogType getAuditLogTypeValue() {
-        if(getParameters().isRunSilent()) {
-            return getSucceeded() ? AuditLogType.VDS_ACTIVATE_ASYNC : 
AuditLogType.VDS_ACTIVATE_FAILED_ASYNC;
-        } else {
-            return getSucceeded() ? AuditLogType.VDS_ACTIVATE : 
AuditLogType.VDS_ACTIVATE_FAILED;
-        }
     }
 
     /**
@@ -57,24 +49,24 @@
             @Override
             public Void runInTransaction() {
                 
getCompensationContext().snapshotEntityStatus(vds.getDynamicData(), 
vds.getstatus());
-                
Backend.getInstance().getResourceManager().RunVdsCommand(VDSCommandType.SetVdsStatus,
+                
getBackend().getResourceManager().RunVdsCommand(VDSCommandType.SetVdsStatus,
                         new SetVdsStatusVDSCommandParameters(getVdsId(), 
VDSStatus.Unassigned));
                 getCompensationContext().stateChanged();
                 return null;
             }
         });
 
-        setSucceeded(Backend.getInstance().getResourceManager()
+        setSucceeded(getBackend().getResourceManager()
                 .RunVdsCommand(VDSCommandType.ActivateVds, new 
ActivateVdsVDSCommandParameters(getVdsId()))
                 .getSucceeded());
+
         if (getSucceeded()) {
             TransactionSupport.executeInNewTransaction(new 
TransactionMethod<Void>() {
 
                 @Override
                 public Void runInTransaction() {
                     // set network to operational / non-operational
-                    List<Network> networks = 
DbFacade.getInstance().getNetworkDao()
-                            .getAllForCluster(vds.getvds_group_id());
+                    List<Network> networks = 
getNetworkDAO().getAllForCluster(vds.getvds_group_id());
                     for (Network net : networks) {
                         NetworkClusterHelper.setStatus(vds.getvds_group_id(), 
net);
                     }
@@ -105,4 +97,13 @@
         addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ACTIVATE);
         addCanDoActionMessage(VdcBllMessages.VAR__TYPE__HOST);
     }
+
+    @Override
+    public AuditLogType getAuditLogTypeValue() {
+        if (getParameters().isRunSilent()) {
+            return getSucceeded() ? AuditLogType.VDS_ACTIVATE_ASYNC : 
AuditLogType.VDS_ACTIVATE_FAILED_ASYNC;
+        } else {
+            return getSucceeded() ? AuditLogType.VDS_ACTIVATE : 
AuditLogType.VDS_ACTIVATE_FAILED;
+        }
+    }
 }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7b407c035cbc094b314b3d26a4a1d679b8a8303f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Moti Asayag <masa...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to