You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by wi...@apache.org on 2015/04/15 10:05:32 UTC
[32/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784
CLOUDSTACK-7593: in 450to451 upgrade path copy vm_details from template for vmware
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
(cherry picked from commit 8e1507078052b8068b828d336f8d0358915047e1)
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/a70947f9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a70947f9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a70947f9
Branch: refs/heads/reporter
Commit: a70947f9b1a1e57ed79d082fae29061574df2a20
Parents: a07497b
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Mon Apr 13 15:34:27 2015 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Apr 13 15:47:59 2015 +0530
----------------------------------------------------------------------
.../com/cloud/upgrade/dao/Upgrade450to451.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a70947f9/engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java
index 89fe5ec..218f4ec 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade450to451.java
@@ -74,6 +74,7 @@ public class Upgrade450to451 implements DbUpgrade {
encryptKeyInKeyStore(conn);
encryptIpSecPresharedKeysOfRemoteAccessVpn(conn);
encryptStoragePoolUserInfo(conn);
+ updateUserVmDetailsWithNicAdapterType(conn);
}
private void encryptKeyInKeyStore(Connection conn) {
@@ -175,4 +176,21 @@ public class Upgrade450to451 implements DbUpgrade {
}
s_logger.debug("Done encrypting storage_pool's user_info column");
}
+
+ private void updateUserVmDetailsWithNicAdapterType(Connection conn) {
+ PreparedStatement insertPstmt = null;
+ try {
+ insertPstmt = conn.prepareStatement("INSERT INTO `cloud`.`user_vm_details`(vm_id,name,value,display) select v.id as vm_id, details.name, details.value, details.display from `cloud`.`vm_instance` as v, `cloud`.`vm_template_details` as details where v.removed is null and v.vm_template_id=details.template_id and details.name='nicAdapter' and details.template_id in (select id from `cloud`.`vm_template` where hypervisor_type = 'vmware') and v.id not in (select vm_id from `cloud`.`user_vm_details` where name='nicAdapter');");
+ insertPstmt.executeUpdate();
+ } catch (SQLException e) {
+ throw new CloudRuntimeException("Failed to update user_vm_details table with nicAdapter entries by copying from vm_template_detail table", e);
+ } finally {
+ try {
+ if (insertPstmt != null)
+ insertPstmt.close();
+ } catch (SQLException e) {
+ }
+ }
+ s_logger.debug("Done. Updated user_vm_details table with nicAdapter entries by copying from vm_template_detail table. This affects only VM/templates with hypervisor_type as VMware.");
+ }
}