Shahar Havivi has uploaded a new change for review. Change subject: engine: Add AddVmTemplateCommand to command executer framework ......................................................................
engine: Add AddVmTemplateCommand to command executer framework By adding AddVmTemplateCommand we can determine whether we need to delete the template if the command failed. Bug-Url: https://bugzilla.redhat.com/1105211 Change-Id: Ib47982264f535dcf38cd4f9319f842d75ebccd5d Signed-off-by: Shahar Havivi <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java 1 file changed, 8 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/96/32896/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java index 2152032..9aca45c 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmTemplateCommand.java @@ -10,7 +10,6 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; - import org.apache.commons.lang.StringUtils; import org.ovirt.engine.core.bll.context.CommandContext; import org.ovirt.engine.core.bll.profiles.CpuProfileHelper; @@ -22,6 +21,7 @@ import org.ovirt.engine.core.bll.quota.QuotaVdsDependent; import org.ovirt.engine.core.bll.snapshots.SnapshotsValidator; import org.ovirt.engine.core.bll.storage.StoragePoolValidator; +import org.ovirt.engine.core.bll.tasks.CommandCoordinatorUtil; import org.ovirt.engine.core.bll.utils.PermissionSubject; import org.ovirt.engine.core.bll.utils.VmDeviceUtils; import org.ovirt.engine.core.bll.validator.DiskImagesValidator; @@ -63,6 +63,7 @@ import org.ovirt.engine.core.common.utils.Pair; import org.ovirt.engine.core.common.validation.group.CreateEntity; import org.ovirt.engine.core.compat.Guid; +import org.ovirt.engine.core.compat.backendcompat.CommandExecutionStatus; import org.ovirt.engine.core.dal.dbbroker.DbFacade; import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector; import org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase; @@ -714,10 +715,12 @@ cloneContextAndDetachFromParent()); } - // if template exist in db remove it - if (getVmTemplate() != null) { - DbFacade.getInstance().getVmTemplateDao().remove(getVmTemplateId()); - removeNetwork(); + if (CommandCoordinatorUtil.getCommandExecutionStatus(getParameters().getCommandId()) == CommandExecutionStatus.EXECUTED) { + // if template exist in db remove it + if (getVmTemplate() != null) { + DbFacade.getInstance().getVmTemplateDao().remove(getVmTemplateId()); + removeNetwork(); + } } if (!getVmId().equals(Guid.Empty) && getVm() != null) { -- To view, visit http://gerrit.ovirt.org/32896 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib47982264f535dcf38cd4f9319f842d75ebccd5d Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.5 Gerrit-Owner: Shahar Havivi <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
