From 3fc392abf8a17d823d76805782d3ee01b54b5210 Mon Sep 17 00:00:00 2001 From: Koushik Das Date: Wed, 26 Nov 2014 16:00:54 +0530 Subject: [PATCH] CLOUDSTACK-7960: [Automation] Creation of Volume from Snapshot fails due to StringIndexOutOfBoundsException Fixed the appropriate CopyCommand handler in simulator plugin --- .../src/com/cloud/resource/SimulatorStorageProcessor.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java index bdb32773429..86556f7283c 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java +++ b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorStorageProcessor.java @@ -142,7 +142,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); @@ -209,7 +209,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);