cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject git commit: updated refs/heads/4.2 to 14d865f
Date Wed, 14 Aug 2013 18:30:19 GMT
Updated Branches:
  refs/heads/4.2 674552269 -> 14d865fb9


CLOUDSTACK-4315: VPC - when fail to add nic to the VR, a) remove the nic b) remove the reference
to nic from router_network_ref table. Before the fix b) was missing, and it caused NPEs when
tried to apply the rules on the routers not having nic in the network


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

Branch: refs/heads/4.2
Commit: 14d865fb9b314db93d1ce9df40bdb17209223312
Parents: 6745522
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Wed Aug 14 11:20:46 2013 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Wed Aug 14 11:22:07 2013 -0700

----------------------------------------------------------------------
 .../network/element/VirtualRouterElement.java   | 17 +---------
 .../element/VpcVirtualRouterElement.java        |  1 -
 .../VpcVirtualNetworkApplianceManagerImpl.java  | 34 +++++++++++---------
 .../com/cloud/vm/VirtualMachineManagerImpl.java |  6 ++--
 4 files changed, 24 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/14d865fb/server/src/com/cloud/network/element/VirtualRouterElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/VirtualRouterElement.java b/server/src/com/cloud/network/element/VirtualRouterElement.java
index d26c1e1..13096b8 100755
--- a/server/src/com/cloud/network/element/VirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VirtualRouterElement.java
@@ -30,7 +30,6 @@ import org.apache.cloudstack.api.command.admin.router.CreateVirtualRouterElement
 import org.apache.cloudstack.api.command.admin.router.ListVirtualRouterElementsCmd;
 import org.apache.log4j.Logger;
 
-import com.cloud.agent.api.PvlanSetupCommand;
 import com.cloud.agent.api.to.LoadBalancerTO;
 import com.cloud.configuration.ConfigurationManager;
 import com.cloud.configuration.dao.ConfigurationDao;
@@ -50,7 +49,6 @@ import com.cloud.network.Network.Service;
 import com.cloud.network.NetworkMigrationResponder;
 import com.cloud.network.NetworkModel;
 import com.cloud.network.Networks;
-import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.Networks.TrafficType;
 import com.cloud.network.PhysicalNetworkServiceProvider;
 import com.cloud.network.PublicIpAddress;
@@ -87,7 +85,6 @@ import com.cloud.utils.db.SearchCriteriaService;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.DomainRouterVO;
 import com.cloud.vm.NicProfile;
-import com.cloud.vm.NicVO;
 import com.cloud.vm.ReservationContext;
 import com.cloud.vm.UserVmManager;
 import com.cloud.vm.UserVmVO;
@@ -98,18 +95,6 @@ import com.cloud.vm.VirtualMachineProfile;
 import com.cloud.vm.dao.DomainRouterDao;
 import com.cloud.vm.dao.UserVmDao;
 import com.google.gson.Gson;
-import org.apache.cloudstack.api.command.admin.router.ConfigureVirtualRouterElementCmd;
-import org.apache.cloudstack.api.command.admin.router.CreateVirtualRouterElementCmd;
-import org.apache.cloudstack.api.command.admin.router.ListVirtualRouterElementsCmd;
-import org.apache.log4j.Logger;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
 
 @Local(value = {NetworkElement.class, FirewallServiceProvider.class, 
 		        DhcpServiceProvider.class, UserDataServiceProvider.class, 
@@ -385,7 +370,7 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
             
             List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(),
Role.VIRTUAL_ROUTER);
             if (routers == null || routers.isEmpty()) {
-                s_logger.debug("Virtual router elemnt doesn't need to apply firewall rules
on the backend; virtual " +
+                s_logger.debug("Virtual router elemnt doesn't need to apply lb rules on the
backend; virtual " +
                 		"router doesn't exist in the network " + network.getId());
                 return true;
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/14d865fb/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
index b5889c4..754dd81 100644
--- a/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VpcVirtualRouterElement.java
@@ -464,7 +464,6 @@ public class VpcVirtualRouterElement extends VirtualRouterElement implements
Vpc
         } else {
             return true;
         }
-
     }
 
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/14d865fb/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index 5e300f0..fe7fe46 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -295,23 +295,27 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
             return false;
         }
         
-        //Check if router is a part of the Guest network
-        if (!_networkModel.isVmPartOfNetwork(router.getId(), network.getId())) {
-            s_logger.debug("Router " + router + " is not a part of the Guest network " +
network);
-            return true;
-        }
-        
-        boolean result = setupVpcGuestNetwork(network, router, false, _networkModel.getNicProfile(router,
network.getId(), null));
-        if (!result) {
-            s_logger.warn("Failed to destroy guest network config " + network + " on router
" + router);
-            return false;
-        }
-        
-        result = result && _itMgr.removeVmFromNetwork(router, network, null);
-        
-        if (result) {
+        boolean result = true;
+        try {
+            //Check if router is a part of the Guest network
+            if (!_networkModel.isVmPartOfNetwork(router.getId(), network.getId())) {
+                s_logger.debug("Router " + router + " is not a part of the Guest network
" + network);
+                return result;
+            }
+            
+            result = setupVpcGuestNetwork(network, router, false, _networkModel.getNicProfile(router,
network.getId(), null));
+            if (!result) {
+                s_logger.warn("Failed to destroy guest network config " + network + " on
router " + router);
+                return false;
+            }
+            
+            result = result && _itMgr.removeVmFromNetwork(router, network, null);
+        } finally {
+            if (result) {
                 _routerDao.removeRouterFromGuestNetwork(router.getId(), network.getId());
             }
+        }
+        
         return result;
     }
     

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/14d865fb/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 6691b40..ee09087 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -2913,8 +2913,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
                     s_logger.warn("Failed to plug nic to the vm " + vm + " in network " +
network);
                     return null;
                 }
-            }finally{
-                if(!result){
+            } finally {
+                if (!result){
+                    s_logger.debug("Removing nic " + nic + " from vm " + vmProfile.getVirtualMachine()
+                            + " as nic plug failed on the backend");
                     _networkMgr.removeNic(vmProfile, _nicsDao.findById(nic.getId()));
                 }
             }


Mime
View raw message