Gilad Chaplik has uploaded a new change for review.

Change subject: core: runVmCommandParams: remove get/setInternalExecution
......................................................................

core: runVmCommandParams: remove get/setInternalExecution

AuditLogableBase.isInternalExecution() can be used instead (implemented
TODO in code).

Change-Id: I225cd8808f5b780f5e79a41b29143eca3d8b711e
Signed-off-by: Gilad Chaplik <gchap...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/RunVmParams.java
2 files changed, 5 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/08/13408/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
index 847ac5b..c7f6287 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
@@ -266,7 +266,7 @@
                     else {
                         statelessVmTreatment();
                     }
-                } else if (!getParameters().getIsInternal() && !_isRerun
+                } else if (!isInternalExecution() && !_isRerun
                         && getVm().getStatus() != VMStatus.Suspended
                         && statelessSnapshotExistsForVm()
                         && !isVMPartOfManualPool()) {
@@ -461,10 +461,8 @@
             }
             if (mResume) {
                 return getSucceeded() ? AuditLogType.USER_RESUME_VM : 
AuditLogType.USER_FAILED_RESUME_VM;
-            } else if (getParameters() != null && 
getParameters().getIsInternal()) {
-                return getSucceeded() ?
-                        (statelessSnapshotExistsForVm() ? 
AuditLogType.VDS_INITIATED_RUN_VM_AS_STATELESS : 
AuditLogType.VDS_INITIATED_RUN_VM) :
-                        AuditLogType.VDS_INITIATED_RUN_VM_FAILED;
+            } else if (isInternalExecution()) {
+                return getSucceeded() ? AuditLogType.VDS_INITIATED_RUN_VM : 
AuditLogType.VDS_INITIATED_RUN_VM_FAILED;
             } else {
                 return getSucceeded() ?
                         (VMStatus) getActionReturnValue() == VMStatus.Up ?
@@ -664,11 +662,6 @@
 
     @Override
     protected boolean canDoAction() {
-        // setting the RunVmParams Internal flag according to the command 
Internal flag.
-        // we can not use only the command Internal flag and remove this flag 
from RunVmParams
-        // since canRunVm is static and can not call non-static method 
isInternalExecution
-        getParameters().setIsInternal(isInternalExecution());
-
         VM vm = getVm();
 
         if (vm == null) {
@@ -714,7 +707,6 @@
             if (canDoAction && getParameters().getVmPayload() != null) {
                 canDoAction = checkPayload(getParameters().getVmPayload(),
                         getParameters().getDiskPath());
-
                 if (canDoAction && 
!StringUtils.isEmpty(getParameters().getFloppyPath()) &&
                         getParameters().getVmPayload().getType() == 
VmDeviceType.FLOPPY) {
                     
addCanDoActionMessage(VdcBllMessages.VMPAYLOAD_FLOPPY_EXCEEDED);
@@ -762,8 +754,8 @@
             Job job = 
JobRepositoryFactory.getJobRepository().getJobWithSteps(step.getJobId());
             Step executingStep = job.getDirectStep(StepEnum.EXECUTING);
             // We would like to to set the run stateless step as substep of 
executing step
-            getParameters().setIsInternal(true);
-            // The iternal command should be monitored for tasks
+            setInternalExecution(true);
+            // The internal command should be monitored for tasks
             runStatelessVmCtx.setMonitored(true);
             Step runStatelessStep =
                     ExecutionHandler.addSubStep(getExecutionContext(),
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/RunVmParams.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/RunVmParams.java
index 1a6d2ce..04f5d5c 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/RunVmParams.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/RunVmParams.java
@@ -74,14 +74,6 @@
         _destinationVdsId = value;
     }
 
-    public boolean getIsInternal() {
-        return _internal;
-    }
-
-    public void setIsInternal(boolean value) {
-        _internal = value;
-    }
-
     public BootSequence getBootSequence() {
         return _bootSequence;
     }


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

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

Reply via email to