incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke4...@apache.org
Subject [28/50] [abbrv] git commit: CS-9919: Support for Nexus Swiches (Cisco Vswitches)
Date Sun, 27 May 2012 22:35:41 GMT
CS-9919: Support for Nexus Swiches (Cisco Vswitches)

Description:

	Deleting the row in cluster_vsm_map after
	a cluster is deleted, if the cluster type
	is vmware and the global vswitch nexus
	config flag is set to true.


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

Branch: refs/heads/3.0.x
Commit: 4f9101bd0e4cf4cf23607d99ac58ecf2a4d5d59e
Parents: 269d4da
Author: Vijayendra Bhamidipati <vijayendra.bhamidipati@citrix.com>
Authored: Thu May 24 13:58:44 2012 -0700
Committer: Vijayendra Bhamidipati <vijayendra.bhamidipati@citrix.com>
Committed: Thu May 24 14:04:52 2012 -0700

----------------------------------------------------------------------
 server/src/com/cloud/dc/dao/ClusterVSMMapDao.java  |    1 +
 .../src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java |    9 ++++++++-
 .../com/cloud/resource/ResourceManagerImpl.java    |   12 +++++++++++-
 3 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4f9101bd/server/src/com/cloud/dc/dao/ClusterVSMMapDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/dc/dao/ClusterVSMMapDao.java b/server/src/com/cloud/dc/dao/ClusterVSMMapDao.java
index 6405069..910e858 100644
--- a/server/src/com/cloud/dc/dao/ClusterVSMMapDao.java
+++ b/server/src/com/cloud/dc/dao/ClusterVSMMapDao.java
@@ -21,4 +21,5 @@ public interface ClusterVSMMapDao extends GenericDao<ClusterVSMMapVO,
Long> {
     ClusterVSMMapVO findByClusterId(long clusterId);
     List<ClusterVSMMapVO> listByVSMId(long vsmId);
     boolean removeByVsmId(long vsmId);
+    boolean removeByClusterId(long clusterId);
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4f9101bd/server/src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java b/server/src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java
index a82fdda..618d7a4 100644
--- a/server/src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java
+++ b/server/src/com/cloud/dc/dao/ClusterVSMMapDaoImpl.java
@@ -20,7 +20,6 @@ import com.cloud.utils.db.DB;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.Transaction;
 
 @Local(value=ClusterVSMMapDao.class)
@@ -51,6 +50,14 @@ public class ClusterVSMMapDaoImpl extends GenericDaoBase<ClusterVSMMapVO,
Long>
     }
     
     @Override
+    public boolean removeByClusterId(long clusterId) {
+    	SearchCriteria<ClusterVSMMapVO> sc = ClusterSearch.create();
+    	sc.setParameters("clusterId", clusterId);
+    	this.remove(sc);
+    	return true;
+    }
+    
+    @Override
     public ClusterVSMMapVO findByClusterId(long clusterId) {
         SearchCriteria<ClusterVSMMapVO> sc = ClusterSearch.create();
         sc.setParameters("clusterId", clusterId);        

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4f9101bd/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index 478ae6f..dfe609f 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -215,6 +215,8 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService,
Ma
     protected VMTemplateDao  _templateDao;
     @Inject
     protected ConfigurationManager 			 _configMgr;
+    @Inject
+    protected ClusterVSMMapDao				 _clusterVSMMapDao;
 
     protected long                           _nodeId  = ManagementServerNode.getManagementServerId();
     
@@ -889,7 +891,7 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService,
Ma
     @DB
     public boolean deleteCluster(DeleteClusterCmd cmd) {
         Transaction txn = Transaction.currentTxn();
-        try {
+        try {        	
             txn.start();
             ClusterVO cluster = _clusterDao.lockRow(cmd.getId(), true);
             if (cluster == null) {
@@ -900,6 +902,8 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService,
Ma
                 throw new CloudRuntimeException("Cluster: " + cmd.getId() + " does not exist");
             }
 
+            Hypervisor.HypervisorType hypervisorType = cluster.getHypervisorType();
+            
             List<HostVO> hosts = listAllHostsInCluster(cmd.getId());
             if (hosts.size() > 0) {
                 if (s_logger.isDebugEnabled()) {
@@ -921,6 +925,12 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService,
Ma
 
             if (_clusterDao.remove(cmd.getId())){
                 _capacityDao.removeBy(null, null, null, cluster.getId(), null);
+                // If this cluster is of type vmware, and if the nexus vswitch global parameter
setting is turned
+                // on, remove the row in cluster_vsm_map for this cluster id.
+                if (hypervisorType == HypervisorType.VMware &&
+                		Boolean.parseBoolean(_configDao.getValue(Config.VmwareUseNexusVSwitch.toString())))
{
+                	_clusterVSMMapDao.removeByClusterId(cmd.getId());
+                }
             }
 
             txn.commit();


Mime
View raw message