You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/01/18 13:21:30 UTC

git commit: updated refs/heads/4.5 to d807bf0

Repository: cloudstack
Updated Branches:
  refs/heads/4.5 f6564b0b0 -> d807bf0a4


CLOUDSTACK-8107. Failed to create snapshot from volume when the task is performed repeatedly in zone wide primary Storage.
While taking a snapshot of a volume, CS chooses the endpoint to perform backup snapshot operation by selecting any host that has the storage containing the volume mounted on it.
Instead, if the volume is attached to a VM, the endpoint chosen by CS should be the host that contains the VM.

(cherry picked from commit a75a43137316a60b20760aa5015d97f55520fd16)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d807bf0a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d807bf0a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d807bf0a

Branch: refs/heads/4.5
Commit: d807bf0a4eb6fd5b5e69318c519ad1eb0d1de5b9
Parents: f6564b0
Author: Likitha Shetty <li...@citrix.com>
Authored: Mon Oct 13 16:26:47 2014 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Sun Jan 18 17:51:19 2015 +0530

----------------------------------------------------------------------
 .../storage/endpoint/DefaultEndPointSelector.java       | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d807bf0a/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java b/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
index 18c8991..7067b8c 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
@@ -205,13 +205,21 @@ public class DefaultEndPointSelector implements EndPointSelector {
     public EndPoint select(DataObject srcData, DataObject destData, StorageAction action) {
         if (action == StorageAction.BACKUPSNAPSHOT && srcData.getDataStore().getRole() == DataStoreRole.Primary) {
             SnapshotInfo srcSnapshot = (SnapshotInfo)srcData;
+            VolumeInfo volumeInfo = srcSnapshot.getBaseVolume();
+            VirtualMachine vm = volumeInfo.getAttachedVM();
             if (srcSnapshot.getHypervisorType() == Hypervisor.HypervisorType.KVM) {
-                VolumeInfo volumeInfo = srcSnapshot.getBaseVolume();
-                VirtualMachine vm = volumeInfo.getAttachedVM();
                 if (vm != null && vm.getState() == VirtualMachine.State.Running) {
                     return getEndPointFromHostId(vm.getHostId());
                 }
             }
+            if (srcSnapshot.getHypervisorType() == Hypervisor.HypervisorType.VMware) {
+                if (vm != null) {
+                    Long hostId = vm.getHostId() != null ? vm.getHostId() : vm.getLastHostId();
+                    if (hostId != null) {
+                        return getEndPointFromHostId(hostId);
+                    }
+                }
+            }
         }
         return select(srcData, destData);
     }