Skip to content

Commit 56f5195

Browse files
Update volume state (from Snapshotting) on MS start when its snapshot job not finished and snapshot in Creating state
1 parent 549842b commit 56f5195

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/SnapshotDataFactoryImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@
2424
import javax.inject.Inject;
2525

2626
import com.cloud.storage.Snapshot;
27+
import com.cloud.storage.Volume;
2728
import com.cloud.utils.fsm.NoTransitionException;
2829
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
2930
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
3031
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
3132
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
3233
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
3334
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
35+
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
3436
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
3537
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
3638
import org.apache.commons.collections.CollectionUtils;
@@ -209,6 +211,8 @@ public void updateOperationFailed(long snapshotId) throws NoTransitionException
209211
for (SnapshotDataStoreVO snapshotStoreRef : snapshotStoreRefs) {
210212
SnapshotInfo snapshotInfo = getSnapshot(snapshotStoreRef.getSnapshotId(), snapshotStoreRef.getDataStoreId(), snapshotStoreRef.getRole());
211213
if (snapshotInfo != null) {
214+
VolumeInfo volumeInfo = snapshotInfo.getBaseVolume();
215+
volumeInfo.stateTransit(Volume.Event.OperationFailed);
212216
((SnapshotObject)snapshotInfo).processEvent(Snapshot.Event.OperationFailed);
213217
snapshotInfo.processEvent(ObjectInDataStoreStateMachine.Event.OperationFailed);
214218
}

0 commit comments

Comments
 (0)