Updated Branches: refs/heads/master-6-17-stable ff33a3583 -> ec722df00
CLOUDSTACK-2943 [ZWPS][VMWARE]: NPE while creating volume from snapshot Snapshot of volume is now correctly marked with hypervisor type the volume belongs to. Earlier hypervisor_type of snapshot was NULL as cluster_id is null for zonewide storage pool. Signed-off-by: Sateesh Chodapuneedi <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ec722df0 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ec722df0 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ec722df0 Branch: refs/heads/master-6-17-stable Commit: ec722df00ef2b3249fa00453467ef9038e6aa07c Parents: ff33a35 Author: Sateesh Chodapuneedi <[email protected]> Authored: Thu Jun 27 12:41:11 2013 +0530 Committer: Sateesh Chodapuneedi <[email protected]> Committed: Thu Jun 27 12:43:56 2013 +0530 ---------------------------------------------------------------------- .../src/com/cloud/storage/snapshot/SnapshotManagerImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec722df0/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index c720169..e9641ab 100755 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -32,6 +32,7 @@ import org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotPoliciesCmd import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotPoliciesCmd; import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotsCmd; import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy; @@ -1031,7 +1032,12 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, // Create the Snapshot object and save it so we can return it to the // user - HypervisorType hypervisorType = this._volsDao.getHypervisorType(volumeId); + HypervisorType hypervisorType = HypervisorType.None; + if (storagePoolVO.getScope() == ScopeType.ZONE) { + hypervisorType = storagePoolVO.getHypervisor(); + } else { + hypervisorType = this._volsDao.getHypervisorType(volumeId); + } SnapshotVO snapshotVO = new SnapshotVO(volume.getDataCenterId(), volume.getAccountId(), volume.getDomainId(), volume.getId(), volume.getDiskOfferingId(), null, snapshotName, (short) snapshotType.ordinal(), snapshotType.name(), volume.getSize(), hypervisorType); SnapshotVO snapshot = _snapshotDao.persist(snapshotVO);
