- fix snapshot state transition bug

- removing the Publish call back handler from default interceptor
  library
This commit is contained in:
Murali Reddy 2013-01-31 16:57:55 +05:30
parent b30f1b1f7a
commit a4b3365ae5
3 changed files with 4 additions and 6 deletions

View File

@ -67,11 +67,11 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity,
}
static {
s_fsm.addTransition(Creating, Event.CreateRequested, Creating);
s_fsm.addTransition(null, Event.CreateRequested, Creating);
s_fsm.addTransition(Creating, Event.OperationSucceeded, CreatedOnPrimary);
s_fsm.addTransition(Creating, Event.OperationNotPerformed, BackedUp);
s_fsm.addTransition(Creating, Event.OperationFailed, Error);
s_fsm.addTransition(CreatedOnPrimary, Event.BackupToSecondary, BackingUp);
s_fsm.addTransition(CreatedOnPrimary, Event.OperationFailed, Error);
s_fsm.addTransition(BackingUp, Event.OperationSucceeded, BackedUp);
s_fsm.addTransition(BackingUp, Event.OperationFailed, Error);
}
@ -87,7 +87,7 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity,
enum Event {
CreateRequested,
CreatedOnPrimary,
OperationNotPerformed,
BackupToSecondary,
BackedupToSecondary,
OperationSucceeded,

View File

@ -20,7 +20,6 @@ import com.cloud.event.ActionEventUtils;
import com.cloud.utils.component.AnnotationInterceptor;
import com.cloud.utils.component.InterceptorLibrary;
import com.cloud.utils.db.DatabaseCallback;
import org.apache.cloudstack.framework.events.EventPublishCallback;
import java.util.List;
@ -30,6 +29,5 @@ public class DefaultInterceptorLibrary implements InterceptorLibrary {
public void addInterceptors(List<AnnotationInterceptor<?>> interceptors) {
interceptors.add(new DatabaseCallback());
interceptors.add(new ActionEventUtils.ActionEventCallback());
interceptors.add(new EventPublishCallback());
}
}

View File

@ -258,7 +258,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
snapshot.setSwiftId(preSnapshotVO.getSwiftId());
snapshot.setPrevSnapshotId(preId);
snapshot.setSecHostId(preSnapshotVO.getSecHostId());
stateTransitTo(snapshot, Snapshot.Event.OperationSucceeded);
stateTransitTo(snapshot, Snapshot.Event.OperationNotPerformed);
} catch (NoTransitionException nte) {
s_logger.debug("CreateSnapshot: failed to update state of snapshot due to " + nte.getMessage());
}