From b35eb04de3fd26dbbb57124dd4da51c4ffd27486 Mon Sep 17 00:00:00 2001 From: Min Chen Date: Mon, 3 Feb 2014 12:16:19 -0800 Subject: [PATCH] CLOUDSTACK-6017: NPE while creating snapshot multiple times on same Root volume with S3 as secondary storage. --- .../apache/cloudstack/storage/snapshot/SnapshotObject.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java index 9cac20de95c..669a07550e7 100644 --- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java @@ -286,7 +286,10 @@ public class SnapshotObject implements SnapshotInfo { } else if (answer instanceof CopyCmdAnswer) { SnapshotObjectTO snapshotTO = (SnapshotObjectTO)((CopyCmdAnswer)answer).getNewData(); snapshotStore.setInstallPath(snapshotTO.getPath()); - snapshotStore.setSize(snapshotTO.getPhysicalSize()); + if (snapshotTO.getPhysicalSize() != null) { + // For S3 delta snapshot, physical size is currently not set + snapshotStore.setSize(snapshotTO.getPhysicalSize()); + } if (snapshotTO.getParentSnapshotPath() == null) { snapshotStore.setParentSnapshotId(0L); }