cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From likit...@apache.org
Subject git commit: updated refs/heads/master to 22a8508
Date Mon, 10 Jun 2013 05:14:09 GMT
Updated Branches:
  refs/heads/master 8bc72ad55 -> 22a850828


CLOUDSTACK-2894. Removing all vlan ranges should update the vnet column to NULL.


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

Branch: refs/heads/master
Commit: 22a850828001b89fd6ac8e3916256bc7e966a1ef
Parents: 8bc72ad
Author: Likitha Shetty <likitha.shetty@citrix.com>
Authored: Fri Jun 7 19:22:39 2013 +0530
Committer: Likitha Shetty <likitha.shetty@citrix.com>
Committed: Mon Jun 10 10:39:55 2013 +0530

----------------------------------------------------------------------
 .../com/cloud/network/NetworkServiceImpl.java   | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/22a85082/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index c2af8e8..c7be2c6 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -2680,9 +2680,10 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService
{
                         vnetString = vnetString+vnetRange.first().toString()+"-"+value.toString()+";";
                     }
                }
-                vnetString = vnetString+"*";
-                vnetString = vnetString.replace(";*","");
-                network.setVnet(vnetString);
+               if (vnetString.length() > 0 && vnetString.charAt(vnetString.length()-1)==';')
{
+                   vnetString = vnetString.substring(0, vnetString.length()-1);
+               }
+               network.setVnet(vnetString);
             }
 
             for (Pair<Integer, Integer> vnetToAdd : vnetsToAdd) {
@@ -2788,12 +2789,15 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService
{
         _datacneter_vnet.deleteRange(txn, network.getDataCenterId(), network.getId(), start,
end);
 
         String vnetString="";
-        for (Pair<Integer,Integer> vnetRange : existingRanges ){
-            vnetString=vnetString+vnetRange.first().toString()+"-"+vnetRange.second().toString()+";";
+        if (existingRanges.isEmpty()) {
+            network.setVnet(null);
+        } else {
+            for (Pair<Integer,Integer> vnetRange : existingRanges ) {
+                vnetString=vnetString+vnetRange.first().toString()+"-"+vnetRange.second().toString()+";";
+            }
+            vnetString = vnetString.substring(0, vnetString.length()-1);
+            network.setVnet(vnetString);
         }
-        vnetString = vnetString+"*";
-        vnetString = vnetString.replace(";*","");
-        network.setVnet(vnetString);
         _physicalNetworkDao.update(network.getId(), network);
         txn.commit();
         _physicalNetworkDao.releaseFromLockTable(network.getId());


Mime
View raw message