Updated Branches:
  refs/heads/master e99a1ef1d -> 79d49ca2d

CLOUDSTACK-3758 [Vmware][ZWPS] Failed to create volume from snapshot

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/79d49ca2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/79d49ca2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/79d49ca2

Branch: refs/heads/master
Commit: 79d49ca2dc7c981be400fb660878d3671d2e46d2
Parents: e99a1ef
Author: Sateesh Chodapuneedi <[email protected]>
Authored: Wed Jul 24 03:48:28 2013 +0530
Committer: Sateesh Chodapuneedi <[email protected]>
Committed: Wed Jul 24 03:51:23 2013 +0530

----------------------------------------------------------------------
 .../cloud/storage/snapshot/SnapshotManagerImpl.java | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79d49ca2/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 123c595..14fb65d 100755
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -26,9 +26,6 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
 import org.apache.cloudstack.api.command.user.snapshot.CreateSnapshotPolicyCmd;
 import 
org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotPoliciesCmd;
 import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotPoliciesCmd;
@@ -48,6 +45,9 @@ import 
org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
@@ -80,6 +80,7 @@ import com.cloud.resource.ResourceManager;
 import com.cloud.server.ResourceTag.TaggedResourceType;
 import com.cloud.storage.CreateSnapshotPayload;
 import com.cloud.storage.DataStoreRole;
+import com.cloud.storage.ScopeType;
 import com.cloud.storage.Snapshot;
 import com.cloud.storage.Snapshot.Type;
 import com.cloud.storage.SnapshotPolicyVO;
@@ -1145,7 +1146,14 @@ public class SnapshotManagerImpl extends ManagerBase 
implements SnapshotManager,
         }
         String snapshotName = vmDisplayName + "_" + volume.getName() + "_" + 
timeString;
 
-        HypervisorType hypervisorType = volume.getHypervisorType();
+        HypervisorType hypervisorType = HypervisorType.None;
+        StoragePoolVO storagePool = 
_storagePoolDao.findById(volume.getDataStore().getId());
+        if (storagePool.getScope() == ScopeType.ZONE) {
+            hypervisorType = storagePool.getHypervisor();
+        } else {
+            hypervisorType = volume.getHypervisorType();
+        }
+
         SnapshotVO snapshotVO = new SnapshotVO(volume.getDataCenterId(), 
volume.getAccountId(), volume.getDomainId(), volume.getId(), 
volume.getDiskOfferingId(), snapshotName,
                 (short) snapshotType.ordinal(), snapshotType.name(), 
volume.getSize(), hypervisorType);
 

Reply via email to