Maor Lipchuk has uploaded a new change for review. Change subject: core: Remove non-existent Storage Domain will be rolled forward. ......................................................................
core: Remove non-existent Storage Domain will be rolled forward. Removal of a Storage Domain which no longer exists causes a failure in the engine and blocks the user from removing the storage. The following patch validates the storage domain was not removed due to the reason of non existence, and if so it will roll-forward and delete it any how. Change-Id: I9515a5ddfcaa965c2bad1883f0543494915b8c7d Bug-Url: https://bugzilla.redhat.com/1001626 Signed-off-by: Maor Lipchuk <mlipc...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStorageDomainCommand.java 1 file changed, 15 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/33/20333/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..3d1e1a2 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,6 +15,8 @@ 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.VdcBLLException; +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; @@ -188,9 +190,19 @@ } protected boolean formatStorage(StorageDomain dom, VDS vds) { - return getVdsBroker() - .RunVdsCommand(VDSCommandType.FormatStorageDomain, - new FormatStorageDomainVDSCommandParameters(vds.getId(), dom.getId())).getSucceeded(); + try { + return getVdsBroker() + .RunVdsCommand(VDSCommandType.FormatStorageDomain, + new FormatStorageDomainVDSCommandParameters(vds.getId(), dom.getId())).getSucceeded(); + } catch (VdcBLLException e) { + if (e.getErrorCode() != VdcBllErrors.StorageDomainDoesNotExist) { + throw e; + } + log.warnFormat("Storage Domain {0} which was about to be formatted does not exist in VDS {1}", + dom.getName(), + vds.getName()); + return true; + } } @Override -- To view, visit http://gerrit.ovirt.org/20333 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9515a5ddfcaa965c2bad1883f0543494915b8c7d Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.3 Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches