From 44218ef07c924b09c36ca13637814786297065a4 Mon Sep 17 00:00:00 2001 From: Edison Su Date: Wed, 9 Nov 2011 10:32:48 -0800 Subject: [PATCH] bug 11919: if volume is dettached, instance id is null status 11919: resolved fixed Reviewed-by: frank --- .../cloud/storage/snapshot/SnapshotManagerImpl.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index e00dd5de4d0..188915b8125 100755 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -1369,16 +1369,16 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma } } - UserVmVO vm = _vmDao.findById(volume.getInstanceId()); - if (vm.getHypervisorType() == HypervisorType.Ovm) { - throw new InvalidParameterValueException("Ovm won't support taking snapshot"); - } - StoragePoolVO storagePoolVO = _storagePoolDao.findById(volume.getPoolId()); if (storagePoolVO == null) { throw new InvalidParameterValueException("VolumeId: " + volumeId + " please attach this volume to a VM before create snapshot for it"); } + ClusterVO cluster = _clusterDao.findById(storagePoolVO.getClusterId()); + if (cluster != null && cluster.getHypervisorType() == HypervisorType.Ovm) { + throw new InvalidParameterValueException("Ovm won't support taking snapshot"); + } + // Verify permissions _accountMgr.checkAccess(caller, null, volume);