cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/4] git commit: updated refs/heads/4.3 to 1f21c29
Date Tue, 25 Nov 2014 11:43:45 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.3 2aa9bb689 -> 1f21c2985


CLOUDSTACK-6075: Increase the ram size for router service offering

Increased the ram size of Internal load balancer vm service offering also
Backported from fix by Harikrishna Patnala <harikrishna.patnala@citrix.com>
https://reviews.apache.org/r/17941/

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


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

Branch: refs/heads/4.3
Commit: 6d31aca25cd5848272aaa190581f1f7c2bc00729
Parents: 2aa9bb6
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Tue Nov 25 14:08:25 2014 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Tue Nov 25 14:08:25 2014 +0530

----------------------------------------------------------------------
 .../com/cloud/upgrade/dao/Upgrade431to432.java  | 108 +++++++++++++++++++
 .../lb/InternalLoadBalancerVMManager.java       |   2 +-
 server/src/com/cloud/configuration/Config.java  |   2 +-
 .../router/VirtualNetworkApplianceManager.java  |   2 +-
 4 files changed, 111 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6d31aca2/engine/schema/src/com/cloud/upgrade/dao/Upgrade431to432.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade431to432.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade431to432.java
index e3c8147..cfad21d 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade431to432.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade431to432.java
@@ -28,6 +28,8 @@ import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 
+import com.cloud.utils.exception.CloudRuntimeException;
+
 import org.apache.log4j.Logger;
 
 public class Upgrade431to432 implements DbUpgrade {
@@ -55,6 +57,112 @@ public class Upgrade431to432 implements DbUpgrade {
 
     @Override
     public void performDataMigration(Connection conn) {
+        updateMaxRouterSizeConfig(conn);
+        upgradeMemoryOfVirtualRoutervmOffering(conn);
+        upgradeMemoryOfInternalLoadBalancervmOffering(conn);
+    }
+
+    private void updateMaxRouterSizeConfig(Connection conn) {
+        PreparedStatement updatePstmt = null;
+        try {
+            updatePstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value='256'
WHERE name='router.ram.size'");
+            updatePstmt.executeUpdate();
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable to upgrade max ram size of router in
config.", e);
+        } finally {
+            try {
+                if (updatePstmt != null) {
+                    updatePstmt.close();
+                }
+            } catch (SQLException e) {
+            }
+        }
+        s_logger.debug("Done updating router.ram.size config to 256");
+    }
+
+    private void upgradeMemoryOfInternalLoadBalancervmOffering(Connection conn) {
+        PreparedStatement updatePstmt = null;
+        PreparedStatement selectPstmt = null;
+        ResultSet selectResultSet = null;
+        int newRamSize = 256; //256MB
+        long serviceOfferingId = 0;
+
+        /**
+         * Pick first row in service_offering table which has system vm type as internalloadbalancervm.
User added offerings would start from 2nd row onwards.
+         * We should not update/modify any user-defined offering.
+         */
+
+        try {
+            selectPstmt = conn.prepareStatement("SELECT id FROM `cloud`.`service_offering`
WHERE vm_type='internalloadbalancervm'");
+            updatePstmt = conn.prepareStatement("UPDATE `cloud`.`service_offering` SET ram_size=?
WHERE id=?");
+            selectResultSet = selectPstmt.executeQuery();
+            if(selectResultSet.next()) {
+                serviceOfferingId = selectResultSet.getLong("id");
+            }
+
+            updatePstmt.setInt(1, newRamSize);
+            updatePstmt.setLong(2, serviceOfferingId);
+            updatePstmt.executeUpdate();
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable to upgrade ram_size of service offering
for internal loadbalancer vm. ", e);
+        } finally {
+            try {
+                if (selectPstmt != null) {
+                    selectPstmt.close();
+                }
+                if (selectResultSet != null) {
+                    selectResultSet.close();
+                }
+                if (updatePstmt != null) {
+                    updatePstmt.close();
+                }
+            } catch (SQLException e) {
+            }
+        }
+        s_logger.debug("Done upgrading RAM for service offering of internal loadbalancer
vm to " + newRamSize);
+    }
+
+
+    private void upgradeMemoryOfVirtualRoutervmOffering(Connection conn) {
+        PreparedStatement updatePstmt = null;
+        PreparedStatement selectPstmt = null;
+        ResultSet selectResultSet = null;
+        int newRamSize = 256; //256MB
+        long serviceOfferingId = 0;
+
+        /**
+         * Pick first row in service_offering table which has system vm type as domainrouter.
User added offerings would start from 2nd row onwards.
+         * We should not update/modify any user-defined offering.
+         */
+
+        try {
+            selectPstmt = conn.prepareStatement("SELECT id FROM `cloud`.`service_offering`
WHERE vm_type='domainrouter'");
+            updatePstmt = conn.prepareStatement("UPDATE `cloud`.`service_offering` SET ram_size=?
WHERE id=?");
+            selectResultSet = selectPstmt.executeQuery();
+            if(selectResultSet.next()) {
+                serviceOfferingId = selectResultSet.getLong("id");
+            }
+
+            updatePstmt.setInt(1, newRamSize);
+            updatePstmt.setLong(2, serviceOfferingId);
+            updatePstmt.executeUpdate();
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable to upgrade ram_size of service offering
for domain router. ", e);
+        } finally {
+            try {
+                if (selectPstmt != null) {
+                    selectPstmt.close();
+                }
+                if (selectResultSet != null) {
+                    selectResultSet.close();
+                }
+                if (updatePstmt != null) {
+                    updatePstmt.close();
+                }
+            } catch (SQLException e) {
+            }
+        }
+        s_logger.debug("Done upgrading RAM for service offering of domain router to " + newRamSize);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6d31aca2/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManager.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManager.java
b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManager.java
index efd5bf5..16f522c 100644
--- a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManager.java
+++ b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManager.java
@@ -32,7 +32,7 @@ import com.cloud.vm.VirtualMachineProfile.Param;
 
 public interface InternalLoadBalancerVMManager {
     //RAM/CPU for the system offering used by Internal LB VMs
-    public static final int DEFAULT_INTERNALLB_VM_RAMSIZE = 128;            // 128 MB
+    public static final int DEFAULT_INTERNALLB_VM_RAMSIZE = 256;            // 256 MB
     public static final int DEFAULT_INTERNALLB_VM_CPU_MHZ = 256;            // 256 MHz
     
     /**

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6d31aca2/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 6ebb7e6..ee48002 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -306,7 +306,7 @@ public enum Config {
 	HashKey("Hidden", ManagementServer.class, String.class, "security.hash.key", null, "for
generic key-ed hash", null),
 	EncryptionKey("Hidden", ManagementServer.class, String.class, "security.encryption.key",
null, "base64 encoded key data", null),
 	EncryptionIV("Hidden", ManagementServer.class, String.class, "security.encryption.iv", null,
"base64 encoded IV data", null),
-	RouterRamSize("Hidden", NetworkOrchestrationService.class, Integer.class, "router.ram.size",
"128", "Default RAM for router VM (in MB).", null),
+	RouterRamSize("Hidden", NetworkOrchestrationService.class, Integer.class, "router.ram.size",
"256", "Default RAM for router VM (in MB).", null),
 
 	DefaultPageSize("Advanced", ManagementServer.class, Long.class, "default.page.size", "500",
"Default page size for API list* commands", null),
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6d31aca2/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
index 4ea09e5..6059658 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
@@ -62,7 +62,7 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
     static final ConfigKey<String> RouterTemplateLxc = new ConfigKey<String>(String.class,
RouterTemplateLxcCK, "Advanced", "SystemVM Template (LXC)",
         "Name of the default router template on LXC.", true, ConfigKey.Scope.Zone, null);
 
-    public static final int DEFAULT_ROUTER_VM_RAMSIZE = 128;            // 128M
+    public static final int DEFAULT_ROUTER_VM_RAMSIZE = 256;            // 256M
     public static final int DEFAULT_ROUTER_CPU_MHZ = 500;            	// 500 MHz
     public static final boolean USE_POD_VLAN = false;
     /**


Mime
View raw message