Arik Hadas has uploaded a new change for review.

Change subject: core: remove redundant transaction on run vm
......................................................................

core: remove redundant transaction on run vm

Saving the VM dynamic information that we get back from VDSM after
calling VDSM to create a VM was used to be executed in transaction
because we used to update information related to the VDS in the DB
and we wanted it to be atomically.

Now that we don't update anything else in the DB besides the dynamic
information of the VM, doing the update in transaction with Required
scope is redundant and we can drop the transaction.

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


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/51/24551/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/CreateVmVDSCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/CreateVmVDSCommand.java
index 3eb7131..46ea98b 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/CreateVmVDSCommand.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/CreateVmVDSCommand.java
@@ -41,21 +41,14 @@
                 command = initCreateVDSCommand(vm);
                 command.execute();
                 if (command.getVDSReturnValue().getSucceeded()) {
-                    vm.setInitialized(true);
                     saveSetInitializedToDb(vm.getId());
 
-                    
TransactionSupport.executeInScope(TransactionScopeOption.Required,
-                            new TransactionMethod<Object>() {
-                        @Override
-                        public Object runInTransaction() {
-                            vm.setRunOnVds(getVdsId());
-                            if (getParameters().isClearHibernationVolumes()) {
-                                vm.setHibernationVolHandle(StringUtils.EMPTY);
-                            }
-                            
DbFacade.getInstance().getVmDynamicDao().update(vm.getDynamicData());
-                            return null;
-                        }
-                    });
+                    vm.setInitialized(true);
+                    vm.setRunOnVds(getVdsId());
+                    if (getParameters().isClearHibernationVolumes()) {
+                        vm.setHibernationVolHandle(StringUtils.EMPTY);
+                    }
+                    
DbFacade.getInstance().getVmDynamicDao().update(vm.getDynamicData());
                 } else {
                     handleCommandResult(command);
                     
ResourceManager.getInstance().RemoveAsyncRunningVm(getParameters().getVmId());


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9819a9defe421deab3badf1e4e1e62e7e3e3e92f
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