You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/06/02 15:53:29 UTC
git commit: updated refs/heads/4.4 to e249038
Repository: cloudstack
Updated Branches:
refs/heads/4.4 426c8741b -> e249038ee
update vlan uris
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e249038e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e249038e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e249038e
Branch: refs/heads/4.4
Commit: e249038ee54e72e1028acfd9c6ce36074f8867a7
Parents: 426c874
Author: Daan Hoogland <da...@onecht.net>
Authored: Fri May 30 22:32:37 2014 +0200
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jun 2 15:53:18 2014 +0200
----------------------------------------------------------------------
.../com/cloud/upgrade/dao/Upgrade430to440.java | 37 ++++++++++++++++++++
1 file changed, 37 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e249038e/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 da71d44..546c09c 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;
@@ -61,6 +62,7 @@ public class Upgrade430to440 implements DbUpgrade {
public void performDataMigration(Connection conn) {
secondaryIpsAccountAndDomainIdsUpdate(conn);
moveCidrsToTheirOwnTable(conn);
+ updateVlanUris(conn);
}
@@ -251,6 +253,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() {