You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2014/09/04 22:45:34 UTC

[1/4] git commit: updated refs/heads/hotfix/4.4/upgradepath-431to441 to 062bec4

Repository: cloudstack
Updated Branches:
  refs/heads/hotfix/4.4/upgradepath-431to441 e57f17ae8 -> 062bec4ee (forced update)


CLOUDSTACK-7418 and CLOUDSTACK-7488 - Fixed LB removal if cert is associated


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

Branch: refs/heads/hotfix/4.4/upgradepath-431to441
Commit: 6c501dba45468d216f0d3d41adaa8e05cc083321
Parents: c900aac
Author: Will Stevens <ws...@cloudops.com>
Authored: Thu Sep 4 12:49:23 2014 -0400
Committer: Will Stevens <ws...@cloudops.com>
Committed: Thu Sep 4 12:49:23 2014 -0400

----------------------------------------------------------------------
 .../com/cloud/network/lb/LoadBalancingRulesManagerImpl.java | 9 +++++++++
 .../org/apache/cloudstack/network/lb/CertServiceImpl.java   | 4 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c501dba/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
index e29d8c3..c2707bb 100755
--- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
+++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
@@ -1478,6 +1478,15 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
         final LoadBalancerVO lb = _lbDao.findById(loadBalancerId);
         FirewallRule.State backupState = lb.getState();
 
+        // remove any ssl certs associated with this LB rule before trying to delete it.
+        LoadBalancerCertMapVO lbCertMap = _lbCertMapDao.findByLbRuleId(loadBalancerId);
+        if (lbCertMap != null) {
+            boolean removeResult = removeCertFromLoadBalancer(loadBalancerId);
+            if (!removeResult) {
+                throw new CloudRuntimeException("Unable to remove certificate from load balancer rule " + loadBalancerId);
+            }
+        }
+
         List<LoadBalancerVMMapVO> backupMaps = Transaction.execute(new TransactionCallback<List<LoadBalancerVMMapVO>>() {
             @Override
             public List<LoadBalancerVMMapVO> doInTransaction(TransactionStatus status) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6c501dba/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java b/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java
index 347bfc2..b5e4a17 100644
--- a/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java
+++ b/server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java
@@ -325,7 +325,9 @@ public class CertServiceImpl implements CertService {
             List<String> lbIds = new ArrayList<String>();
             for (LoadBalancerCertMapVO mapVO : lbCertMap) {
                 LoadBalancer lb = _entityMgr.findById(LoadBalancerVO.class, mapVO.getLbId());
-                lbIds.add(lb.getUuid());
+                if (lb != null) {
+                    lbIds.add(lb.getUuid());
+                }
             }
             response.setLbIds(lbIds);
         }


[4/4] git commit: updated refs/heads/hotfix/4.4/upgradepath-431to441 to 062bec4

Posted by bh...@apache.org.
DatabaseUpgradeChecker: add upgrade path for ACS 4.3.1

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


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

Branch: refs/heads/hotfix/4.4/upgradepath-431to441
Commit: 062bec4ee815f3f7581bec389beb1d676b5e8135
Parents: 2083993
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Thu Sep 4 18:51:44 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Thu Sep 4 22:45:11 2014 +0200

----------------------------------------------------------------------
 engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/062bec4e/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java b/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
index d6633ff..a3a601c 100755
--- a/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
+++ b/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
@@ -65,7 +65,9 @@ import com.cloud.upgrade.dao.Upgrade40to41;
 import com.cloud.upgrade.dao.Upgrade410to420;
 import com.cloud.upgrade.dao.Upgrade420to421;
 import com.cloud.upgrade.dao.Upgrade421to430;
+import com.cloud.upgrade.dao.Upgrade430to431;
 import com.cloud.upgrade.dao.Upgrade430to440;
+import com.cloud.upgrade.dao.Upgrade431to440;
 import com.cloud.upgrade.dao.Upgrade440to441;
 import com.cloud.upgrade.dao.UpgradeSnapshot217to224;
 import com.cloud.upgrade.dao.UpgradeSnapshot223to224;
@@ -211,6 +213,8 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
 
         _upgradeMap.put("4.3.0", new DbUpgrade[] {new Upgrade430to440(), new Upgrade440to441()});
 
+        _upgradeMap.put("4.3.1", new DbUpgrade[] {new Upgrade430to431(), new Upgrade431to440(), new Upgrade440to441()});
+
         _upgradeMap.put("4.4.0", new DbUpgrade[] {new Upgrade440to441()});
 
         //CP Upgrades


[2/4] git commit: updated refs/heads/hotfix/4.4/upgradepath-431to441 to 062bec4

Posted by bh...@apache.org.
schema: Add upgrade path 4.3.0 to 4.3.1 picked from 51f145b

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


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

Branch: refs/heads/hotfix/4.4/upgradepath-431to441
Commit: 0f84c9b43c9dee3ea9d613a193d336580f03ccdf
Parents: 6c501db
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Thu Sep 4 18:40:03 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Thu Sep 4 22:45:10 2014 +0200

----------------------------------------------------------------------
 .../com/cloud/upgrade/dao/Upgrade430to431.java  | 124 +++++++++++++++++++
 1 file changed, 124 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0f84c9b4/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to431.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to431.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to431.java
new file mode 100644
index 0000000..b80dbe0
--- /dev/null
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to431.java
@@ -0,0 +1,124 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.upgrade.dao;
+
+import com.cloud.network.Networks.BroadcastDomainType;
+import com.cloud.utils.exception.CloudRuntimeException;
+import org.apache.log4j.Logger;
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+
+public class Upgrade430to431 implements DbUpgrade {
+    final static Logger s_logger = Logger.getLogger(Upgrade430to431.class);
+
+    @Override
+    public String[] getUpgradableVersionRange() {
+        return new String[] {"4.3.0", "4.3.1"};
+    }
+
+    @Override
+    public String getUpgradedVersion() {
+        return "4.3.1";
+    }
+
+    @Override
+    public boolean supportsRollingUpgrade() {
+        return false;
+    }
+
+    @Override
+    public File[] getPrepareScripts() {
+        return null;
+    }
+
+    @Override
+    public void performDataMigration(Connection conn) {
+        updateVlanUris(conn);
+    }
+
+    private void updateVlanUris(Connection conn) {
+        s_logger.debug("updating vlan URIs");
+        Exception thrown = null;
+        PreparedStatement selectstatement = null;
+        ResultSet results = null;
+        try{
+            selectstatement = conn.prepareStatement("SELECT id, vlan_id FROM `cloud`.`vlan` where vlan_id not like '%:%'");
+            results = selectstatement.executeQuery();
+
+            while (results.next()) {
+                long id = results.getLong(1);
+                String vlan = results.getString(2);
+                if (vlan == null || "".equals(vlan)) {
+                    continue;
+                }
+                String vlanUri = BroadcastDomainType.Vlan.toUri(vlan).toString();
+                PreparedStatement updatestatement = conn.prepareStatement("update `cloud`.`vlan` set vlan_id=? where id=?");
+                try {
+                    updatestatement.setString(1, vlanUri);
+                    updatestatement.setLong(2, id);
+                    updatestatement.executeUpdate();
+                } catch (SQLException e) {
+                    thrown = new CloudRuntimeException("Unable to update vlan URI " + vlanUri + " for vlan record " + id, e);
+                } finally {
+                    try {
+                        updatestatement.close();
+                    } catch (Exception e) {
+                        if(thrown == null) {
+                            thrown =  new CloudRuntimeException("Unable to close update statement vlan URI " + vlanUri + " for vlan record " + id, e);
+                        } //else don't obfuscate the original exception
+                    }
+                }
+            }
+        } catch (SQLException e) {
+            if(thrown == null) {
+                thrown = new CloudRuntimeException("Unable to update vlan URIs ", e);
+            } //else don't obfuscate the original exception
+        }
+        finally
+        {
+            try {
+                if(results != null)
+                    results.close();
+            } catch (SQLException e) {
+                if(thrown == null) {
+                    thrown = new CloudRuntimeException("Unable to update vlan URIs ", e);
+                } //else don't obfuscate the original exception
+            }
+            try {
+                if (selectstatement != null)
+                    selectstatement.close();
+            } catch (SQLException e) {
+                if(thrown == null) {
+                    thrown = new CloudRuntimeException("Unable to update vlan URIs ", e);
+                } //else don't obfuscate the original exception
+            }
+        }
+        s_logger.debug("Done updateing vlan URIs");
+    }
+
+    @Override
+    public File[] getCleanupScripts() {
+        return null;
+    }
+
+}


[3/4] git commit: updated refs/heads/hotfix/4.4/upgradepath-431to441 to 062bec4

Posted by bh...@apache.org.
schema: add Upgrade431to440 that extends 430to440

This adds an upgrade path from 4.3.1 to 4.4.0, the implementation of which
simply extends the Upgrade430to440 as there was no schema change between 4.3.0
and 4.3.1

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


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

Branch: refs/heads/hotfix/4.4/upgradepath-431to441
Commit: 208399354fa82513e2fb70738cb6eee8454ea3a5
Parents: 0f84c9b
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Thu Sep 4 18:50:17 2014 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Thu Sep 4 22:45:10 2014 +0200

----------------------------------------------------------------------
 .../com/cloud/upgrade/dao/Upgrade431to440.java  | 39 ++++++++++++++++++++
 1 file changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/20839935/engine/schema/src/com/cloud/upgrade/dao/Upgrade431to440.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade431to440.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade431to440.java
new file mode 100644
index 0000000..98b52ac
--- /dev/null
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade431to440.java
@@ -0,0 +1,39 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.upgrade.dao;
+
+import org.apache.log4j.Logger;
+
+public class Upgrade431to440 extends Upgrade430to440 implements DbUpgrade {
+    final static Logger s_logger = Logger.getLogger(Upgrade431to440.class);
+
+    @Override
+    public String[] getUpgradableVersionRange() {
+        return new String[] {"4.3.1", "4.4.0"};
+    }
+
+    @Override
+    public String getUpgradedVersion() {
+        return "4.4.0";
+    }
+
+    @Override
+    public boolean supportsRollingUpgrade() {
+        return false;
+    }
+}