mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-7593: in 450to451 upgrade path copy vm_details from template for vmware
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
df934c9541
commit
8e15070780
@ -74,6 +74,7 @@ public class Upgrade450to451 implements DbUpgrade {
|
|||||||
encryptKeyInKeyStore(conn);
|
encryptKeyInKeyStore(conn);
|
||||||
encryptIpSecPresharedKeysOfRemoteAccessVpn(conn);
|
encryptIpSecPresharedKeysOfRemoteAccessVpn(conn);
|
||||||
encryptStoragePoolUserInfo(conn);
|
encryptStoragePoolUserInfo(conn);
|
||||||
|
updateUserVmDetailsWithNicAdapterType(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void encryptKeyInKeyStore(Connection 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");
|
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.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user