Arik Hadas has uploaded a new change for review.

Change subject: core: handle down VM in separate thread on destroy
......................................................................

core: handle down VM in separate thread on destroy

We used to execute the handling of down VM in a new transaction in the
DestroyVmVDSCommand so it won't affect the current transaction. Now that
this handling is made on a different thread, there is no need for the
new transaction anymore.

Change-Id: I1f20edfece133465aade00127ff973da9b726975
Signed-off-by: Arik Hadas <aha...@redhat.com>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/DestroyVmVDSCommand.java
1 file changed, 2 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/22/28222/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/DestroyVmVDSCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/DestroyVmVDSCommand.java
index 70ba95f..0124929 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/DestroyVmVDSCommand.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/DestroyVmVDSCommand.java
@@ -68,7 +68,8 @@
                 // if using stop then call to ProcessOnVmStop because
                 // will not be called from UpdateRunTimeInfo
                 if (!parameters.getGracefully()) {
-                    onVmStop(curVm);
+                    ResourceManager.getInstance().getEventListener()
+                       .processOnVmStop(Collections.singleton(curVm.getId()));
                 }
 
                 getVDSReturnValue().setReturnValue(curVm.getStatus());
@@ -97,25 +98,6 @@
             ResourceManager.getInstance().InternalSetVmStatus(curVm,
                     parameters.getGracefully() ? VMStatus.PoweringDown : 
VMStatus.Down);
         }
-    }
-
-    /**
-     * signal the event listener that this VM is down. Because we don't care 
for failures, to prevent a side effect of
-     * aborting the current TX this method is being invoked in a new TX of its 
own.
-     * @param curVm
-     *            current VM
-     */
-    private void onVmStop(final VM curVm) {
-        TransactionSupport.executeInNewTransaction(new 
TransactionMethod<Void>() {
-
-            @Override
-            public Void runInTransaction() {
-                ResourceManager.getInstance()
-                        .getEventListener()
-                        .processOnVmStop(Collections.singleton(curVm.getId()));
-                return null;
-            }
-        });
     }
 
     private static final Log log = 
LogFactory.getLog(DestroyVmVDSCommand.class);


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

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

Reply via email to