Michael Kublin has uploaded a new change for review.

Change subject: engine:Cannot remove iscsi master storage right after removing 
the storage pool
......................................................................

engine:Cannot remove iscsi master storage right after removing the storage pool

The problem is sipmle domain was moved to UnAttached status before it was 
disconnected
from pool, that's why remove failed.
Solution change status of domain after performing an operation

Change-Id: I5e6b57cd772e6fb7b35b22972131331349a04c09
Bug-Url: https://bugzilla.redhat.com/836168
Signed-off-by: Michael Kublin <mkub...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java
1 file changed, 10 insertions(+), 25 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/60/8360/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java
index 0374b0e..0e6dcbe 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java
@@ -33,15 +33,11 @@
 import org.ovirt.engine.core.utils.SyncronizeNumberOfAsyncOperations;
 import org.ovirt.engine.core.utils.linq.LinqUtils;
 import org.ovirt.engine.core.utils.linq.Predicate;
-import org.ovirt.engine.core.utils.log.Log;
-import org.ovirt.engine.core.utils.log.LogFactory;
 import org.ovirt.engine.core.utils.transaction.TransactionMethod;
 import org.ovirt.engine.core.utils.transaction.TransactionSupport;
 
 @NonTransactiveCommandAttribute(forceCompensation = true)
 public class RemoveStoragePoolCommand<T extends StoragePoolParametersBase> 
extends StorageHandlingCommandBase<T> {
-
-    private static Log log = LogFactory.getLog(RemoveStoragePoolCommand.class);
 
     public RemoveStoragePoolCommand(T parameters) {
         super(parameters);
@@ -77,16 +73,7 @@
                 return;
             }
         }
-        TransactionSupport.executeInNewTransaction(new 
TransactionMethod<Void>()  {
-
-            @Override
-            public Void runInTransaction() {
-                getCompensationContext().snapshotEntity(getStoragePool());
-                
DbFacade.getInstance().getStoragePoolDao().remove(getStoragePool().getId());
-                getCompensationContext().stateChanged();
-                return null;
-            }
-        });
+        getStoragePoolDAO().remove(getStoragePool().getId());
         setSucceeded(true);
     }
 
@@ -188,22 +175,20 @@
         });
 
         setSucceeded(true);
-        TransactionSupport.executeInNewTransaction(new 
TransactionMethod<Void>() {
-            @Override
-            public Void runInTransaction() {
-                
getCompensationContext().snapshotEntity(masterDomain.getStoragePoolIsoMapData());
-                DbFacade.getInstance()
-                        .getStoragePoolIsoMapDao()
-                        
.remove(masterDomain.getStoragePoolIsoMapData().getId());
-                getCompensationContext().stateChanged();
-                return null;
-            }
-        });
         if (getStoragePool().getstorage_pool_type() != StorageType.LOCALFS) {
             for (VDS vds : vdss) {
                 
StorageHelperDirector.getInstance().getItem(getStoragePool().getstorage_pool_type())
                         .DisconnectStorageFromDomainByVdsId(masterDomain, 
vds.getId());
             }
+            TransactionSupport.executeInNewTransaction(new 
TransactionMethod<Void>() {
+                @Override
+                public Void runInTransaction() {
+                    DbFacade.getInstance()
+                            .getStoragePoolIsoMapDao()
+                            
.remove(masterDomain.getStoragePoolIsoMapData().getId());
+                    return null;
+                }
+            });
         } else {
             try {
                 Backend


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

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

Reply via email to