cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sate...@apache.org
Subject git commit: updated refs/heads/master to c14c736
Date Wed, 07 Aug 2013 01:37:38 GMT
Updated Branches:
  refs/heads/master 578c4444d -> c14c736d7


CLOUDSTACK-4047 [sM][VMWare][ZWPS]: no need of storage migration while migrating VM when the
root volume is on zone wide primary storage

Introduced check for zone wide pools while listing hosts for migration.

Signed-off-by: Sateesh Chodapuneedi <sateesh@apache.org>


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

Branch: refs/heads/master
Commit: c14c736d7afbfa53fe0fdf2ad5d73860343fa75f
Parents: 578c444
Author: Sateesh Chodapuneedi <sateesh@apache.org>
Authored: Wed Aug 7 01:36:32 2013 +0530
Committer: Sateesh Chodapuneedi <sateesh@apache.org>
Committed: Wed Aug 7 01:36:32 2013 +0530

----------------------------------------------------------------------
 .../com/cloud/server/ManagementServerImpl.java  | 27 +++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c14c736d/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 1ea1141..7460084 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -23,6 +23,7 @@ import java.security.NoSuchAlgorithmException;
 import java.security.SecureRandom;
 import java.util.ArrayList;
 import java.util.Calendar;
+import java.util.Collection;
 import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
@@ -148,13 +149,13 @@ import org.apache.cloudstack.api.command.admin.storage.AddS3Cmd;
 import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
 import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd;
 import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
-import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd;
 import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
 import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd;
+import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd;
 import org.apache.cloudstack.api.command.admin.storage.FindStoragePoolsForMigrationCmd;
-import org.apache.cloudstack.api.command.admin.storage.ListSecondaryStagingStoresCmd;
 import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd;
 import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd;
+import org.apache.cloudstack.api.command.admin.storage.ListSecondaryStagingStoresCmd;
 import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
 import org.apache.cloudstack.api.command.admin.storage.ListStorageProvidersCmd;
 import org.apache.cloudstack.api.command.admin.storage.PreparePrimaryStorageForMaintenanceCmd;
@@ -1094,6 +1095,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         List<HostVO> allHosts = null;
         Map<Host, Boolean> requiresStorageMotion = new HashMap<Host, Boolean>();
         DataCenterDeployment plan = null;
+        boolean zoneWideStoragePool = false;
         if (canMigrateWithStorage) {
             allHostsPair = searchForServers(startIndex, pageSize, null, hostType, null, srcHost.getDataCenterId(),
null,
                     null, null, null, null, null, srcHost.getHypervisorType(), srcHost.getHypervisorVersion());
@@ -1107,7 +1109,10 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
                 if (volumePools.isEmpty()) {
                     iterator.remove();
                 } else {
-                    if (!host.getClusterId().equals(srcHost.getClusterId()) || usesLocal)
{
+                    if (srcHost.getHypervisorType() == HypervisorType.VMware || srcHost.getHypervisorType()
== HypervisorType.KVM) {
+                        zoneWideStoragePool = checkForZoneWideStoragePool(volumePools);
+                    }
+                    if ((!host.getClusterId().equals(srcHost.getClusterId()) || usesLocal)
&& !zoneWideStoragePool) {
                         requiresStorageMotion.put(host, true);
                     }
                 }
@@ -1169,6 +1174,22 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
                 suitableHosts, requiresStorageMotion);
     }
 
+    private boolean checkForZoneWideStoragePool(Map<Volume, List<StoragePool>>
volumePools) {
+        boolean zoneWideStoragePool = false;
+        Collection<List<StoragePool>> pools = volumePools.values();
+        List<StoragePool> aggregatePoolList = new ArrayList<StoragePool>();
+        for (Iterator<List<StoragePool>> volumePoolsIter = pools.iterator();
volumePoolsIter.hasNext();) {
+            aggregatePoolList.addAll(volumePoolsIter.next());
+        }
+        for (StoragePool pool : aggregatePoolList) {
+            if (null == pool.getClusterId()) {
+                zoneWideStoragePool = true;
+                break;
+            }
+        }
+        return zoneWideStoragePool;
+    }
+
     private Map<Volume, List<StoragePool>> findSuitablePoolsForVolumes(VirtualMachineProfile
vmProfile,
             Host host) {
         List<VolumeVO> volumes = _volumeDao.findCreatedByInstance(vmProfile.getId());


Mime
View raw message