Maor Lipchuk has uploaded a new change for review.

Change subject: core: Remove unexisting Storage Domain will be roll forward.
......................................................................

core: Remove unexisting Storage Domain will be roll forward.

Remove of a Storage Domain which no longer exists causes a failure in
the engine and block the user from removing the storage.

The following patch adds a validation, that if the storage domain was
not removed due to non existence, engine will roll-forward and deletes
it any how.

Change-Id: I9515a5ddfcaa965c2bad1883f0543494915b8c7d
Bug-Url: https://bugzilla.redhat.com/1001626
Signed-off-by: Maor Lipchuk <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStorageDomainCommand.java
1 file changed, 10 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/58/20158/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStorageDomainCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStorageDomainCommand.java
index 8a2c907..985a2a9 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStorageDomainCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStorageDomainCommand.java
@@ -15,12 +15,14 @@
 import org.ovirt.engine.core.common.businessentities.StoragePoolIsoMapId;
 import org.ovirt.engine.core.common.businessentities.StorageType;
 import org.ovirt.engine.core.common.businessentities.VDS;
+import org.ovirt.engine.core.common.errors.VdcBllErrors;
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
 import org.ovirt.engine.core.common.interfaces.VDSBrokerFrontend;
 import org.ovirt.engine.core.common.locks.LockingGroup;
 import org.ovirt.engine.core.common.utils.Pair;
 import 
org.ovirt.engine.core.common.vdscommands.FormatStorageDomainVDSCommandParameters;
 import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
+import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.utils.transaction.TransactionMethod;
 
@@ -188,9 +190,14 @@
     }
 
     protected boolean formatStorage(StorageDomain dom, VDS vds) {
-        return getVdsBroker()
-                .RunVdsCommand(VDSCommandType.FormatStorageDomain,
-                        new 
FormatStorageDomainVDSCommandParameters(vds.getId(), 
dom.getId())).getSucceeded();
+        VDSReturnValue vdsReturnValue =
+                
getVdsBroker().RunVdsCommand(VDSCommandType.FormatStorageDomain,
+                        new 
FormatStorageDomainVDSCommandParameters(vds.getId(), dom.getId()));
+        if (VdcBllErrors.StorageDomainDoesNotExist == 
vdsReturnValue.getVdsError().getCode()) {
+            log.warnFormat("Storage Domain {0} which was about to be formatted 
is not exists in VDS id {1}", vds.getId(), dom.getId());
+            return true;
+        }
+        return vdsReturnValue.getSucceeded();
     }
 
     @Override


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9515a5ddfcaa965c2bad1883f0543494915b8c7d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to