cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [1/3] git commit: updated refs/heads/internallb to 501f2ff
Date Wed, 17 Apr 2013 00:11:25 GMT
Updated Branches:
  refs/heads/internallb b7709b89f -> 501f2ffa0


Internal LB: added internal lb vm to the list of supported providers in VPC default offering


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

Branch: refs/heads/internallb
Commit: 8689bf9eb38a416997d5ae4d326c51b57b57553e
Parents: b7709b8
Author: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Authored: Tue Apr 16 15:59:56 2013 -0700
Committer: Alena Prokharchyk <alena.prokharchyk@citrix.com>
Committed: Tue Apr 16 15:59:56 2013 -0700

----------------------------------------------------------------------
 .../ListInternalLoadBalancerElementsCmd.java       |    3 +-
 .../src/com/cloud/network/vpc/VpcManagerImpl.java  |    1 +
 .../src/com/cloud/upgrade/dao/Upgrade410to420.java |   44 +++++++++++++-
 3 files changed, 42 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8689bf9e/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java
b/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java
index 122c233..9ef15ff 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/internallb/ListInternalLoadBalancerElementsCmd.java
@@ -26,7 +26,6 @@ import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.api.BaseListCmd;
 import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
 import org.apache.cloudstack.api.response.ListResponse;
 import org.apache.cloudstack.api.response.ProviderResponse;
 import org.apache.cloudstack.api.response.VirtualRouterProviderResponse;
@@ -42,7 +41,7 @@ import com.cloud.network.VirtualRouterProvider;
 @APICommand(name = "listInternalLoadBalancerElements", description="Lists all available Internal
Load Balancer elements.",
             responseObject=VirtualRouterProviderResponse.class, since="4.2.0")
 public class ListInternalLoadBalancerElementsCmd extends BaseListCmd {
-    public static final Logger s_logger = Logger.getLogger(ListNetworkOfferingsCmd.class.getName());
+    public static final Logger s_logger = Logger.getLogger(ListInternalLoadBalancerElementsCmd.class.getName());
     private static final String _name = "listinternalloadbalancerelementsresponse";
 
     @Inject

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8689bf9e/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index dbd36ae..06129e0 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -202,6 +202,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager,
VpcProvis
                 if (svc == Service.Lb) {
                     Set<Provider> lbProviders = new HashSet<Provider>();
                     lbProviders.add(Provider.VPCVirtualRouter);
+                    lbProviders.add(Provider.InternalLbVm);
                     svcProviderMap.put(svc, lbProviders);
                 } else {
                     svcProviderMap.put(svc, defaultProviders);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8689bf9e/server/src/com/cloud/upgrade/dao/Upgrade410to420.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/upgrade/dao/Upgrade410to420.java b/server/src/com/cloud/upgrade/dao/Upgrade410to420.java
index 05e2b49..7e07245 100644
--- a/server/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/server/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -17,10 +17,6 @@
 
 package com.cloud.upgrade.dao;
 
-import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.script.Script;
-import org.apache.log4j.Logger;
-
 import java.io.File;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
@@ -28,6 +24,11 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.UUID;
 
+import org.apache.log4j.Logger;
+
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.script.Script;
+
 public class Upgrade410to420 implements DbUpgrade {
 	final static Logger s_logger = Logger.getLogger(Upgrade410to420.class);
 
@@ -66,6 +67,7 @@ public class Upgrade410to420 implements DbUpgrade {
         updatePrimaryStore(conn);
         addEgressFwRulesForSRXGuestNw(conn);
         upgradeEIPNetworkOfferings(conn);
+        upgradeDefaultVpcOffering(conn);
     }
 	
 	private void updateSystemVmTemplates(Connection conn) {
@@ -399,4 +401,38 @@ public class Upgrade410to420 implements DbUpgrade {
             }
         }
     }
+    
+    
+    private void upgradeDefaultVpcOffering(Connection conn) {
+
+        PreparedStatement pstmt = null;
+        ResultSet rs = null;
+
+        try {
+            pstmt = conn.prepareStatement("select distinct map.vpc_offering_id from `cloud`.`vpc_offering_service_map`
map, `cloud`.`vpc_offerings` off where off.id=map.vpc_offering_id AND service='Lb'");
+            rs = pstmt.executeQuery();
+            while (rs.next()) {
+                long id = rs.getLong(1);
+                //Add internal LB vm as a supported provider for the load balancer service
+                pstmt = conn.prepareStatement("INSERT INTO `cloud`.`vpc_offering_service_map`
(vpc_offering_id, service, provider) VALUES (?,?,?)");
+                pstmt.setLong(1, id);
+                pstmt.setString(2, "Lb");
+                pstmt.setString(3, "InternalLbVm");
+                pstmt.executeUpdate();
+            }
+            
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable update the default VPC offering with
the internal lb service", e);
+        } finally {
+            try {
+                if (rs != null) {
+                    rs.close();
+                }
+                if (pstmt != null) {
+                    pstmt.close();
+                }
+            } catch (SQLException e) {
+            }
+        }
+    }
 }


Mime
View raw message