cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: updated refs/heads/master to 44012dd
Date Mon, 02 Jun 2014 13:57:37 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master ab89eb106 -> 44012ddad


update vlan uris

Conflicts:
	engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java


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

Branch: refs/heads/master
Commit: 44012ddadfd73e76b3750e7ce1e6b4aa24d74796
Parents: ab89eb1
Author: Daan Hoogland <daan@onecht.net>
Authored: Fri May 30 22:32:37 2014 +0200
Committer: Daan Hoogland <daan@onecht.net>
Committed: Mon Jun 2 15:57:18 2014 +0200

----------------------------------------------------------------------
 .../com/cloud/upgrade/dao/Upgrade430to440.java  | 38 +++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/44012dda/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
index b7b6bc4..351b74a 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
@@ -26,6 +26,7 @@ import java.sql.SQLException;
 import org.apache.log4j.Logger;
 
 import com.cloud.network.Network;
+import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
 
@@ -62,7 +63,7 @@ public class Upgrade430to440 implements DbUpgrade {
         secondaryIpsAccountAndDomainIdsUpdate(conn);
         moveCidrsToTheirOwnTable(conn);
         addExtractTemplateAndVolumeColumns(conn);
-
+        updateVlanUris(conn);
     }
 
     private void addExtractTemplateAndVolumeColumns(Connection conn) {
@@ -284,6 +285,41 @@ public class Upgrade430to440 implements DbUpgrade {
         s_logger.debug("Done moving network acl item cidrs to a row per cidr");
     }
 
+    private void updateVlanUris(Connection conn) {
+        s_logger.debug("updating vlan URIs");
+        PreparedStatement pstmt = null;
+        ResultSet rs = null;
+        try {
+            pstmt = conn.prepareStatement("SELECT id, vlan_id FROM `cloud`.`vlan` where vlan_id
not like '%:%'");
+            rs = pstmt.executeQuery();
+            while (rs.next()) {
+                long id = rs.getLong(1);
+                String vlan = rs.getString(2);
+                if (vlan == null || "".equals(vlan)) {
+                    continue;
+                }
+                String vlanUri = BroadcastDomainType.Vlan.toUri(vlan).toString();
+                pstmt = conn.prepareStatement("update `cloud`.`vlan` set vlan_id=? where
id=?");
+                pstmt.setString(1, vlanUri);
+                pstmt.setLong(2, id);
+                pstmt.executeUpdate();
+            }
+        } catch (SQLException e) {
+            throw new CloudRuntimeException("Unable to update vlan URIs ", e);
+        } finally {
+            try {
+                if (rs != null) {
+                    rs.close();
+                }
+
+                if (pstmt != null) {
+                    pstmt.close();
+                }
+            } catch (SQLException e) {
+            }
+        }
+        s_logger.debug("Done updateing vlan URIs");
+    }
 
     @Override
     public File[] getCleanupScripts() {


Mime
View raw message