incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [23/50] [abbrv] git commit: refs/heads/vim51_win8 - review 8701: createSetupGuestNetworkCommand in VpcVirtualNetworkApplianceManagerImpl.java fails when the broadcast URI is not a long
Date Sat, 02 Mar 2013 01:01:28 GMT
review 8701: createSetupGuestNetworkCommand in
VpcVirtualNetworkApplianceManagerImpl.java fails when the broadcast URI
is not a long

Fixed whitespace issues

Signed-off-by: Hugo Trippaers <htrippaers@schubergphilis.com>


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

Branch: refs/heads/vim51_win8
Commit: 68b836d46db52811dfcbc56619c4a978f54bd515
Parents: 9f2a208
Author: Roeland Kuipers <rkuipers@schubergphilis.com>
Authored: Thu Feb 28 09:43:04 2013 +0100
Committer: Hugo Trippaers <htrippaers@schubergphilis.com>
Committed: Fri Mar 1 09:38:56 2013 +0100

----------------------------------------------------------------------
 .../VpcVirtualNetworkApplianceManagerImpl.java     |   29 +++++++++------
 1 files changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/68b836d4/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 66fb03b..22d823f 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -367,7 +367,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
         
         if (router.getState() == State.Running) {
             try {
-                Commands cmds = new Commands(OnError.Stop);            	
+                Commands cmds = new Commands(OnError.Stop);
                 UnPlugNicCommand unplugNicCmd = new UnPlugNicCommand(nic, vm.getName());
                 cmds.addCommand("unplugnic", unplugNicCmd);
                 _agentMgr.send(dest.getHost().getId(), cmds);
@@ -448,15 +448,20 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
 
         SetupGuestNetworkCommand setupCmd = new SetupGuestNetworkCommand(dhcpRange, networkDomain,
false, null, 
                 defaultDns1, defaultDns2, add, _itMgr.toNicTO(nicProfile, router.getHypervisorType()));
-        long guestVlanTag = Long.parseLong(network.getBroadcastUri().getHost());
+        
         String brd = NetUtils.long2Ip(NetUtils.ip2Long(guestNic.getIp4Address()) | ~NetUtils.ip2Long(guestNic.getNetmask()));
         setupCmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId()));
         setupCmd.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(network.getId(),
router.getId()));
-        setupCmd.setAccessDetail(NetworkElementCommand.GUEST_VLAN_TAG, String.valueOf(guestVlanTag));
+        
         setupCmd.setAccessDetail(NetworkElementCommand.GUEST_NETWORK_GATEWAY, network.getGateway());
         setupCmd.setAccessDetail(NetworkElementCommand.GUEST_BRIDGE, brd);
         setupCmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
         
+        if (network.getBroadcastDomainType() == BroadcastDomainType.Vlan) {
+                long guestVlanTag = Long.parseLong(network.getBroadcastUri().getHost());
+                setupCmd.setAccessDetail(NetworkElementCommand.GUEST_VLAN_TAG, String.valueOf(guestVlanTag));
+        }
+        
         return setupCmd;
     }
     
@@ -571,8 +576,8 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
         }
 
         Commands netUsagecmds = new Commands(OnError.Continue);
-    	VpcVO vpc = _vpcDao.findById(router.getVpcId());
-    	
+        VpcVO vpc = _vpcDao.findById(router.getVpcId());
+         
         //2) Plug the nics
         for (String vlanTag : nicsToPlug.keySet()) {
             PublicIpAddress ip = nicsToPlug.get(vlanTag);
@@ -609,9 +614,9 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
             }
             //Create network usage commands. Send commands to router after IPAssoc
             NetworkUsageCommand netUsageCmd = new NetworkUsageCommand(router.getPrivateIpAddress(),
router.getInstanceName(), true, defaultNic.getIp4Address(), vpc.getCidr());
-        	netUsagecmds.addCommand(netUsageCmd);
-        	UserStatisticsVO stats = _userStatsDao.findBy(router.getAccountId(), router.getDataCenterId(),

-            		publicNtwk.getId(), publicNic.getIp4Address(), router.getId(), router.getType().toString());
+            netUsagecmds.addCommand(netUsageCmd);
+            UserStatisticsVO stats = _userStatsDao.findBy(router.getAccountId(), router.getDataCenterId(),

+            publicNtwk.getId(), publicNic.getIp4Address(), router.getId(), router.getType().toString());
             if (stats == null) {
                 stats = new UserStatisticsVO(router.getAccountId(), router.getDataCenterId(),
publicNic.getIp4Address(), router.getId(),
                         router.getType().toString(), publicNtwk.getId());
@@ -654,8 +659,8 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
             }
         });
         if(result && netUsagecmds.size() > 0){
-        	//After successful ipassoc, send commands to router
-        	sendCommandsToRouter(router, netUsagecmds);
+            //After successful ipassoc, send commands to router
+            sendCommandsToRouter(router, netUsagecmds);
         }
         return result;
     }
@@ -820,7 +825,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
                 NetworkUsageCommand netUsageCmd = new NetworkUsageCommand(router.getPrivateIpAddress(),
router.getInstanceName(), true, publicNic.getIp4Address(), vpc.getCidr());
                 usageCmds.add(netUsageCmd);
                 UserStatisticsVO stats = _userStatsDao.findBy(router.getAccountId(), router.getDataCenterId(),

-                		publicNtwk.getId(), publicNic.getIp4Address(), router.getId(), router.getType().toString());
+                publicNtwk.getId(), publicNic.getIp4Address(), router.getId(), router.getType().toString());
                 if (stats == null) {
                     stats = new UserStatisticsVO(router.getAccountId(), router.getDataCenterId(),
publicNic.getIp4Address(), router.getId(),
                             router.getType().toString(), publicNtwk.getId());
@@ -1068,7 +1073,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
                 s_logger.warn("Unable to apply StaticRoute, virtual router is not in the
right state " + router.getState());
                 
                 throw new ResourceUnavailableException("Unable to apply StaticRoute on the
backend," +
-                		" virtual router is not in the right state", DataCenter.class, router.getDataCenterId());
+                    " virtual router is not in the right state", DataCenter.class, router.getDataCenterId());
             }
         }
         return result;


Mime
View raw message