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/07/30 13:06:12 UTC
[1/2] git commit: updated refs/heads/4.4 to 3dc0a64
Repository: cloudstack
Updated Branches:
refs/heads/4.4 27c0246e7 -> 3dc0a64b3
update vlan uris
Conflicts:
engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
(cherry picked from commit 44012ddadfd73e76b3750e7ce1e6b4aa24d74796)
(cherry picked from commit 0329bebac5aa7dd68d7d9350d3a2cc609ce5e4a9)
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/91489501
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/91489501
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/91489501
Branch: refs/heads/4.4
Commit: 91489501f55a9749c88d175a63745aa4c6b147b1
Parents: 27c0246
Author: Daan Hoogland <da...@onecht.net>
Authored: Fri May 30 22:32:37 2014 +0200
Committer: Daan Hoogland <da...@onecht.net>
Committed: Wed Jul 30 13:03:29 2014 +0200
----------------------------------------------------------------------
----------------------------------------------------------------------
[2/2] git commit: updated refs/heads/4.4 to 3dc0a64
Posted by da...@apache.org.
try-with-resource to prevent resource leaks
(cherry picked from commit 39f775c38126bb25a0418f82196caaba463f8c1c)
(cherry picked from commit fc52e641d8f69d8c0b552119203b0a2bc58e488f)
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/3dc0a64b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3dc0a64b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3dc0a64b
Branch: refs/heads/4.4
Commit: 3dc0a64b3e67ec16f25fc19b6ab0dd6f158daa6f
Parents: 9148950
Author: Daan Hoogland <da...@onecht.net>
Authored: Fri Jun 6 17:28:07 2014 +0200
Committer: Daan Hoogland <da...@onecht.net>
Committed: Wed Jul 30 13:05:50 2014 +0200
----------------------------------------------------------------------
.../com/cloud/upgrade/dao/Upgrade430to440.java | 30 +++++++++-----------
1 file changed, 13 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3dc0a64b/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 09ac6fe..7226ca7 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to440.java
@@ -68,28 +68,25 @@ public class Upgrade430to440 implements DbUpgrade {
private void addExtractTemplateAndVolumeColumns(Connection conn) {
- PreparedStatement pstmt = null;
- ResultSet rs = null;
- try {
+ try (PreparedStatement selectTemplateInfostmt = conn.prepareStatement("SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'cloud' AND TABLE_NAME = 'template_store_ref' AND COLUMN_NAME = 'download_url_created'");
+ ResultSet templateInfoResults = selectTemplateInfostmt.executeQuery();
+ PreparedStatement addDownloadUrlCreatedToTemplateStorerefstatement = conn.prepareStatement("ALTER TABLE `cloud`.`template_store_ref` ADD COLUMN `download_url_created` datetime");
+ PreparedStatement addDownloadUrlToTemplateStorerefstatement = conn.prepareStatement("ALTER TABLE `cloud`.`template_store_ref` ADD COLUMN `download_url` varchar(255)");
+ PreparedStatement selectVolumeInfostmt = conn.prepareStatement("SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'cloud' AND TABLE_NAME = 'volume_store_ref' AND COLUMN_NAME = 'download_url_created'");
+ ResultSet volumeInfoResults = selectVolumeInfostmt.executeQuery();
+ PreparedStatement addDownloadUrlCreatedToVolumeStorerefstatement = conn.prepareStatement("ALTER TABLE `cloud`.`volume_store_ref` ADD COLUMN `download_url_created` datetime");
+ ) {
// Add download_url_created, download_url to template_store_ref
- pstmt = conn.prepareStatement("SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'cloud' AND TABLE_NAME = 'template_store_ref' AND COLUMN_NAME = 'download_url_created'");
- rs = pstmt.executeQuery();
- if (!rs.next()) {
- pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`template_store_ref` ADD COLUMN `download_url_created` datetime");
- pstmt.executeUpdate();
-
- pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`template_store_ref` ADD COLUMN `download_url` varchar(255)");
- pstmt.executeUpdate();
+ if (!templateInfoResults.next()) {
+ addDownloadUrlCreatedToTemplateStorerefstatement.executeUpdate();
+ addDownloadUrlToTemplateStorerefstatement.executeUpdate();
}
// Add download_url_created to volume_store_ref - note download_url already exists
- pstmt = conn.prepareStatement("SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'cloud' AND TABLE_NAME = 'volume_store_ref' AND COLUMN_NAME = 'download_url_created'");
- rs = pstmt.executeQuery();
- if (!rs.next()) {
- pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`volume_store_ref` ADD COLUMN `download_url_created` datetime");
- pstmt.executeUpdate();
+ if (!volumeInfoResults.next()) {
+ addDownloadUrlCreatedToVolumeStorerefstatement.executeUpdate();
}
} catch (SQLException e) {
@@ -97,7 +94,6 @@ public class Upgrade430to440 implements DbUpgrade {
}
}
-
private void secondaryIpsAccountAndDomainIdsUpdate(Connection conn) {
String secondIpsSql = "SELECT id, vmId, network_id, account_id, domain_id, ip4_address FROM `cloud`.`nic_secondary_ips`";