Skip to content

Commit 4798db0

Browse files
committed
CLOUDSTACK-7960: [Automation] Creation of Volume from Snapshot fails due to StringIndexOutOfBoundsException
Fixed the appropriate CopyCommand handler in simulator plugin
1 parent bf56584 commit 4798db0

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public Answer backupSnapshot(CopyCommand cmd) {
151151
int index = snapshot.getPath().lastIndexOf("/");
152152

153153
String snapshotName = snapshot.getPath().substring(index + 1);
154-
String snapshotRelPath = null;
154+
String snapshotRelPath = "snapshots";
155155
SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
156156
newSnapshot.setPath(snapshotRelPath + File.separator + snapshotName);
157157
return new CopyCmdAnswer(newSnapshot);
@@ -218,7 +218,6 @@ public Answer createVolumeFromSnapshot(CopyCommand cmd) {
218218
SnapshotObjectTO snapshot = (SnapshotObjectTO)srcData;
219219
String snapshotPath = snapshot.getPath();
220220
int index = snapshotPath.lastIndexOf("/");
221-
snapshotPath = snapshotPath.substring(0, index);
222221
String snapshotName = snapshotPath.substring(index + 1);
223222
VolumeObjectTO newVol = new VolumeObjectTO();
224223
newVol.setPath(snapshotName);

0 commit comments

Comments
 (0)