CLOUDSTACK-7960: [Automation] Creation of Volume from Snapshot fails due to StringIndexOutOfBoundsException Fixed the appropriate CopyCommand handler in simulator plugin
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4798db0d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4798db0d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4798db0d Branch: refs/heads/master Commit: 4798db0de1862bbdf7f2af67f7684f2f3430609e Parents: bf56584 Author: Koushik Das <kous...@apache.org> Authored: Wed Nov 26 16:00:54 2014 +0530 Committer: Koushik Das <kous...@apache.org> Committed: Wed Nov 26 17:30:44 2014 +0530 ---------------------------------------------------------------------- .../src/com/cloud/resource/SimulatorStorageProcessor.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4798db0d/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java index 418dd0c..527b32f 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java +++ b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java @@ -151,7 +151,7 @@ public class SimulatorStorageProcessor implements StorageProcessor { int index = snapshot.getPath().lastIndexOf("/"); String snapshotName = snapshot.getPath().substring(index + 1); - String snapshotRelPath = null; + String snapshotRelPath = "snapshots"; SnapshotObjectTO newSnapshot = new SnapshotObjectTO(); newSnapshot.setPath(snapshotRelPath + File.separator + snapshotName); return new CopyCmdAnswer(newSnapshot); @@ -218,7 +218,6 @@ public class SimulatorStorageProcessor implements StorageProcessor { SnapshotObjectTO snapshot = (SnapshotObjectTO)srcData; String snapshotPath = snapshot.getPath(); int index = snapshotPath.lastIndexOf("/"); - snapshotPath = snapshotPath.substring(0, index); String snapshotName = snapshotPath.substring(index + 1); VolumeObjectTO newVol = new VolumeObjectTO(); newVol.setPath(snapshotName);