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/08/06 07:38:49 UTC
[1/3] git commit: updated refs/heads/4.4 to 7f34334
Repository: cloudstack
Updated Branches:
refs/heads/4.4 89041d235 -> 7f343344a
upgrade of systemvm templates
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/00c2696e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/00c2696e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/00c2696e
Branch: refs/heads/4.4
Commit: 00c2696e7a1d1930a4088af6fc085b523b0b3589
Parents: 8608321
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Aug 4 14:12:58 2014 +0200
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Aug 4 14:12:58 2014 +0200
----------------------------------------------------------------------
.../com/cloud/upgrade/dao/Upgrade440to441.java | 167 +++++++++++++++++++
1 file changed, 167 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/00c2696e/engine/schema/src/com/cloud/upgrade/dao/Upgrade440to441.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade440to441.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade440to441.java
index 497da8d..f06ceb9 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade440to441.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade440to441.java
@@ -19,9 +19,17 @@ package com.cloud.upgrade.dao;
import java.io.File;
import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
import org.apache.log4j.Logger;
+import com.cloud.hypervisor.Hypervisor;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script;
@@ -55,6 +63,165 @@ public class Upgrade440to441 implements DbUpgrade {
@Override
public void performDataMigration(Connection conn) {
+ updateSystemVmTemplates(conn);
+ }
+
+ @SuppressWarnings("serial")
+ private void updateSystemVmTemplates(Connection conn) {
+ s_logger.debug("Updating System Vm template IDs");
+ //Get all hypervisors in use
+ Set<Hypervisor.HypervisorType> hypervisorsListInUse = new HashSet<Hypervisor.HypervisorType>();
+ try(PreparedStatement pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null");
+ ResultSet rs = pstmt.executeQuery();
+ ) {
+ while(rs.next()){
+ switch (Hypervisor.HypervisorType.getType(rs.getString(1))) {
+ case XenServer: hypervisorsListInUse.add(Hypervisor.HypervisorType.XenServer);
+ break;
+ case KVM: hypervisorsListInUse.add(Hypervisor.HypervisorType.KVM);
+ break;
+ case VMware: hypervisorsListInUse.add(Hypervisor.HypervisorType.VMware);
+ break;
+ case Hyperv: hypervisorsListInUse.add(Hypervisor.HypervisorType.Hyperv);
+ break;
+ case LXC: hypervisorsListInUse.add(Hypervisor.HypervisorType.LXC);
+ break;
+ default: // we don't support system vms on other hypervisors (yet)
+ break;
+ }
+ }
+ } catch (SQLException e) {
+ s_logger.error("updateSystemVmTemplates:Exception while getting hypervisor types from clusters: "+e.getMessage());
+ throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting hypervisor types from clusters", e);
+ }
+
+ Map<Hypervisor.HypervisorType, String> NewTemplateNameList = new HashMap<Hypervisor.HypervisorType, String>(){
+ {
+ put(Hypervisor.HypervisorType.XenServer, "systemvm-xenserver-4.4");
+ put(Hypervisor.HypervisorType.VMware, "systemvm-vmware-4.4");
+ put(Hypervisor.HypervisorType.KVM, "systemvm-kvm-4.4");
+ put(Hypervisor.HypervisorType.LXC, "systemvm-lxc-4.4");
+ put(Hypervisor.HypervisorType.Hyperv, "systemvm-hyperv-4.4");
+ }
+ };
+
+ Map<Hypervisor.HypervisorType, String> routerTemplateConfigurationNames = new HashMap<Hypervisor.HypervisorType, String>(){
+ {
+ put(Hypervisor.HypervisorType.XenServer, "router.template.xen");
+ put(Hypervisor.HypervisorType.VMware, "router.template.vmware");
+ put(Hypervisor.HypervisorType.KVM, "router.template.kvm");
+ put(Hypervisor.HypervisorType.LXC, "router.template.lxc");
+ put(Hypervisor.HypervisorType.Hyperv, "router.template.hyperv");
+ }
+ };
+
+ Map<Hypervisor.HypervisorType, String> newTemplateUrl = new HashMap<Hypervisor.HypervisorType, String>(){
+ {
+ put(Hypervisor.HypervisorType.XenServer, "http://cloudstack.apt-get.eu/systemvm/4.4/systemvm64template-4.4.0-6-xen.vhd.bz2");
+ put(Hypervisor.HypervisorType.VMware, "http://cloudstack.apt-get.eu/systemvm/4.4/systemvm64template-4.4.0-6-vmware.ova");
+ put(Hypervisor.HypervisorType.KVM, "http://cloudstack.apt-get.eu/systemvm/4.4/systemvm64template-4.4.0-6-kvm.qcow2.bz2");
+ put(Hypervisor.HypervisorType.LXC, "http://cloudstack.apt-get.eu/systemvm/4.4/systemvm64template-4.4.0-6-kvm.qcow2.bz2");
+ put(Hypervisor.HypervisorType.Hyperv, "http://cloudstack.apt-get.eu/systemvm/4.4/systemvm64template-4.4.0-6-hyperv.vhd.bz2");
+ }
+ };
+
+ /*
+ c230704229bd101eacf83a39b4abb91e *systemvm64template-4.4.0-6-hyperv.vhd
+ 1c0bdb131e3b7ee753d014961fdd6eb0 *systemvm64template-4.4.0-6-hyperv.vhd.zip
+ 770a7d3b727ca15e511c33521ef5b8ba *systemvm64template-4.4.0-6-kvm.qcow2.bz2
+ 1623dea39777319337116439cd2dd379 *systemvm64template-4.4.0-6-vmware.ova
+ bd8d1fab55834254f3ee24181430568d *systemvm64template-4.4.0-6-vmware.vmdk.bz2
+ 7a8a6c4f8478147f1c6aa0d20f5e62b9 *systemvm64template-4.4.0-6-xen.vhd.bz2
+ */
+
+ Map<Hypervisor.HypervisorType, String> newTemplateChecksum = new HashMap<Hypervisor.HypervisorType, String>(){
+ {
+ put(Hypervisor.HypervisorType.XenServer, "7a8a6c4f8478147f1c6aa0d20f5e62b9");
+ put(Hypervisor.HypervisorType.VMware, "1623dea39777319337116439cd2dd379");
+ put(Hypervisor.HypervisorType.KVM, "770a7d3b727ca15e511c33521ef5b8ba");
+ put(Hypervisor.HypervisorType.LXC, "770a7d3b727ca15e511c33521ef5b8ba");
+ put(Hypervisor.HypervisorType.Hyperv, "1c0bdb131e3b7ee753d014961fdd6eb0");
+ }
+ };
+
+ for (Map.Entry<Hypervisor.HypervisorType, String> hypervisorAndTemplateName : NewTemplateNameList.entrySet()){
+ s_logger.debug("Updating " + hypervisorAndTemplateName.getKey() + " System Vms");
+ try (PreparedStatement pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = ? and removed is null order by id desc limit 1");)
+ {
+ //Get 4.4.0 system Vm template Id for corresponding hypervisor
+ long templateId = -1;
+ pstmt.setString(1, hypervisorAndTemplateName.getValue());
+ try(ResultSet rs = pstmt.executeQuery();)
+ {
+ if(rs.next()) {
+ templateId = rs.getLong(1);
+ }
+ }catch (SQLException e)
+ {
+ s_logger.error("updateSystemVmTemplates:Exception while getting ids of templates: "+e.getMessage());
+ throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting ids of templates", e);
+ }
+
+ // change template type to SYSTEM
+ if (templateId != -1)
+ {
+ try(PreparedStatement templ_type_pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");)
+ {
+ templ_type_pstmt.setLong(1, templateId);
+ templ_type_pstmt.executeUpdate();
+ }
+ catch (SQLException e)
+ {
+ s_logger.error("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system': "+e.getMessage());
+ throw new CloudRuntimeException("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system'", e);
+ }
+ // update template ID of system Vms
+ try(PreparedStatement update_templ_id_pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = ?");)
+ {
+ update_templ_id_pstmt.setLong(1, templateId);
+ update_templ_id_pstmt.setString(2, hypervisorAndTemplateName.getKey().toString());
+ update_templ_id_pstmt.executeUpdate();
+ }catch (Exception e)
+ {
+ s_logger.error("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to " + templateId + ": "+e.getMessage());
+ throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to " + templateId, e);
+ }
+
+ // Change value of global configuration parameter router.template.* for the corresponding hypervisor
+ try(PreparedStatement update_pstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value = ? WHERE name = ?");) {
+ update_pstmt.setString(1, hypervisorAndTemplateName.getValue());
+ update_pstmt.setString(2, routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()));
+ update_pstmt.executeUpdate();
+ }catch (SQLException e)
+ {
+ s_logger.error("updateSystemVmTemplates:Exception while setting " + routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()) + " to " + hypervisorAndTemplateName.getValue() + ": "+e.getMessage());
+ throw new CloudRuntimeException("updateSystemVmTemplates:Exception while setting " + routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()) + " to " + hypervisorAndTemplateName.getValue(), e);
+ }
+
+ } else {
+ if (hypervisorsListInUse.contains(hypervisorAndTemplateName.getKey())){
+ throw new CloudRuntimeException("4.4.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. Cannot upgrade system Vms");
+ } else {
+ s_logger.warn("4.4.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. " + hypervisorAndTemplateName.getKey() + " hypervisor is not used, so not failing upgrade");
+ // Update the latest template URLs for corresponding hypervisor
+ try(PreparedStatement update_templ_url_pstmt = conn.prepareStatement("UPDATE `cloud`.`vm_template` SET url = ? , checksum = ? WHERE hypervisor_type = ? AND type = 'SYSTEM' AND removed is null order by id desc limit 1");) {
+ update_templ_url_pstmt.setString(1, newTemplateUrl.get(hypervisorAndTemplateName.getKey()));
+ update_templ_url_pstmt.setString(2, newTemplateChecksum.get(hypervisorAndTemplateName.getKey()));
+ update_templ_url_pstmt.setString(3, hypervisorAndTemplateName.getKey().toString());
+ update_templ_url_pstmt.executeUpdate();
+ }catch (SQLException e)
+ {
+ s_logger.error("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type " + hypervisorAndTemplateName.getKey().toString() + ": "+e.getMessage());
+ throw new CloudRuntimeException("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type " + hypervisorAndTemplateName.getKey().toString(), e);
+ }
+ }
+ }
+ } catch (SQLException e) {
+ s_logger.error("updateSystemVmTemplates:Exception while getting ids of templates: "+e.getMessage());
+ throw new CloudRuntimeException("updateSystemVmTemplates:Exception while getting ids of templates", e);
+ }
+ }
+ s_logger.debug("Updating System Vm Template IDs Complete");
}
@Override
[3/3] git commit: updated refs/heads/4.4 to 7f34334
Posted by da...@apache.org.
Merge remote-tracking branch 'origin/hotfix/4.4-svm-upgrade' into 4.4
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7f343344
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7f343344
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7f343344
Branch: refs/heads/4.4
Commit: 7f343344a117ff54ee120a1ee37fd4c9b90f83bd
Parents: 89041d2 21a6a69
Author: Daan Hoogland <da...@onecht.net>
Authored: Wed Aug 6 07:38:00 2014 +0200
Committer: Daan Hoogland <da...@onecht.net>
Committed: Wed Aug 6 07:38:00 2014 +0200
----------------------------------------------------------------------
.../com/cloud/upgrade/dao/Upgrade421to430.java | 158 ------------------
.../com/cloud/upgrade/dao/Upgrade440to441.java | 167 +++++++++++++++++++
2 files changed, 167 insertions(+), 158 deletions(-)
----------------------------------------------------------------------
[2/3] git commit: updated refs/heads/4.4 to 7f34334
Posted by da...@apache.org.
remove update to 4.3 templates for 4.4
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/21a6a699
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/21a6a699
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/21a6a699
Branch: refs/heads/4.4
Commit: 21a6a6993e1ac73a1f4e790e0b004377f5ffd708
Parents: 00c2696
Author: Daan Hoogland <da...@onecht.net>
Authored: Tue Aug 5 17:48:58 2014 +0200
Committer: Daan Hoogland <da...@onecht.net>
Committed: Tue Aug 5 17:48:58 2014 +0200
----------------------------------------------------------------------
.../com/cloud/upgrade/dao/Upgrade421to430.java | 158 -------------------
1 file changed, 158 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/21a6a699/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java
index 50822a3..1ab462a 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade421to430.java
@@ -24,15 +24,10 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
-import com.cloud.hypervisor.Hypervisor;
import com.cloud.utils.crypt.DBEncryptionUtil;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script;
@@ -70,7 +65,6 @@ public class Upgrade421to430 implements DbUpgrade {
encryptLdapConfigParams(conn);
encryptImageStoreDetails(conn);
upgradeMemoryOfSsvmOffering(conn);
- updateSystemVmTemplates(conn);
}
private void upgradeMemoryOfSsvmOffering(Connection conn) {
@@ -195,158 +189,6 @@ public class Upgrade421to430 implements DbUpgrade {
}
- private void updateSystemVmTemplates(Connection conn) {
- s_logger.debug("Updating System Vm template IDs");
- try{
- //Get all hypervisors in use
- Set<Hypervisor.HypervisorType> hypervisorsListInUse = new HashSet<Hypervisor.HypervisorType>();
- try(PreparedStatement pstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null");
- ResultSet rs = pstmt.executeQuery();
- ) {
- while(rs.next()){
- switch (Hypervisor.HypervisorType.getType(rs.getString(1))) {
- case XenServer: hypervisorsListInUse.add(Hypervisor.HypervisorType.XenServer);
- break;
- case KVM: hypervisorsListInUse.add(Hypervisor.HypervisorType.KVM);
- break;
- case VMware: hypervisorsListInUse.add(Hypervisor.HypervisorType.VMware);
- break;
- case Hyperv: hypervisorsListInUse.add(Hypervisor.HypervisorType.Hyperv);
- break;
- case LXC: hypervisorsListInUse.add(Hypervisor.HypervisorType.LXC);
- break;
- }
- }
- } catch (Exception e) {
- s_logger.error("updateSystemVmTemplates:Exception:"+e.getMessage());
- throw new CloudRuntimeException("updateSystemVmTemplates:Exception:"+e.getMessage(), e);
- }
-
- Map<Hypervisor.HypervisorType, String> NewTemplateNameList = new HashMap<Hypervisor.HypervisorType, String>(){
- { put(Hypervisor.HypervisorType.XenServer, "systemvm-xenserver-4.3");
- put(Hypervisor.HypervisorType.VMware, "systemvm-vmware-4.3");
- put(Hypervisor.HypervisorType.KVM, "systemvm-kvm-4.3");
- put(Hypervisor.HypervisorType.LXC, "systemvm-lxc-4.3");
- put(Hypervisor.HypervisorType.Hyperv, "systemvm-hyperv-4.3");
- }
- };
-
- Map<Hypervisor.HypervisorType, String> routerTemplateConfigurationNames = new HashMap<Hypervisor.HypervisorType, String>(){
- { put(Hypervisor.HypervisorType.XenServer, "router.template.xen");
- put(Hypervisor.HypervisorType.VMware, "router.template.vmware");
- put(Hypervisor.HypervisorType.KVM, "router.template.kvm");
- put(Hypervisor.HypervisorType.LXC, "router.template.lxc");
- put(Hypervisor.HypervisorType.Hyperv, "router.template.hyperv");
- }
- };
-
- Map<Hypervisor.HypervisorType, String> newTemplateUrl = new HashMap<Hypervisor.HypervisorType, String>(){
- { put(Hypervisor.HypervisorType.XenServer, "http://download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-xen.vhd.bz2");
- put(Hypervisor.HypervisorType.VMware, "http://download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-vmware.ova");
- put(Hypervisor.HypervisorType.KVM, "http://download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-kvm.qcow2.bz2");
- put(Hypervisor.HypervisorType.LXC, "http://download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-kvm.qcow2.bz2");
- put(Hypervisor.HypervisorType.Hyperv, "http://download.cloud.com/templates/4.3/systemvm64template-2013-12-23-hyperv.vhd.bz2");
- }
- };
-
- Map<Hypervisor.HypervisorType, String> newTemplateChecksum = new HashMap<Hypervisor.HypervisorType, String>(){
- { put(Hypervisor.HypervisorType.XenServer, "74b92f031cc5c2089ee89efb81344dcf");
- put(Hypervisor.HypervisorType.VMware, "ef593a061f3b7594ab0bfd9b0ed0a0d4");
- put(Hypervisor.HypervisorType.KVM, "85a1bed07bf43cbf022451cb2ecae4ff");
- put(Hypervisor.HypervisorType.LXC, "85a1bed07bf43cbf022451cb2ecae4ff");
- put(Hypervisor.HypervisorType.Hyperv, "5df45ee6ebe1b703a8805f4e1f4d0818");
- }
- };
-
- for (Map.Entry<Hypervisor.HypervisorType, String> hypervisorAndTemplateName : NewTemplateNameList.entrySet()){
- s_logger.debug("Updating " + hypervisorAndTemplateName.getKey() + " System Vms");
- try (PreparedStatement pstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = ? and removed is null order by id desc limit 1");)
- {
- //Get 4.3.0 system Vm template Id for corresponding hypervisor
- long templateId = -1;
- pstmt.setString(1, hypervisorAndTemplateName.getValue());
- try(ResultSet rs = pstmt.executeQuery();)
- {
- if(rs.next()) {
- templateId = rs.getLong(1);
- }
- }catch (Exception e)
- {
- s_logger.error("updateSystemVmTemplates:Exception:"+e.getMessage());
- throw new CloudRuntimeException("updateSystemVmTemplates:Exception:"+e.getMessage(), e);
- }
-// // Mark the old system templates as removed
-// pstmt = conn.prepareStatement("UPDATE `cloud`.`vm_template` SET removed = now() WHERE hypervisor_type = ? AND type = 'SYSTEM' AND removed is null");
-// pstmt.setString(1, hypervisorAndTemplateName.getKey().toString());
-// pstmt.executeUpdate();
-// pstmt.close();
- // change template type to SYSTEM
- if (templateId != -1)
- {
- try(PreparedStatement templ_type_pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");)
- {
- templ_type_pstmt.setLong(1, templateId);
- templ_type_pstmt.executeUpdate();
- }
- catch (Exception e)
- {
- s_logger.error("updateSystemVmTemplates:Exception:"+e.getMessage());
- throw new CloudRuntimeException("updateSystemVmTemplates:Exception:"+e.getMessage(), e);
- }
- // update templete ID of system Vms
- try(PreparedStatement update_templ_id_pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = ?");)
- {
- update_templ_id_pstmt.setLong(1, templateId);
- update_templ_id_pstmt.setString(2, hypervisorAndTemplateName.getKey().toString());
- update_templ_id_pstmt.executeUpdate();
- }catch (Exception e)
- {
- s_logger.error("updateSystemVmTemplates:Exception:"+e.getMessage());
- throw new CloudRuntimeException("updateSystemVmTemplates:Exception:"+e.getMessage(), e);
- }
-
- // Change value of global configuration parameter router.template.* for the corresponding hypervisor
- try(PreparedStatement update_pstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value = ? WHERE name = ?");) {
- update_pstmt.setString(1, hypervisorAndTemplateName.getValue());
- update_pstmt.setString(2, routerTemplateConfigurationNames.get(hypervisorAndTemplateName.getKey()));
- update_pstmt.executeUpdate();
- }catch (Exception e)
- {
- s_logger.error("updateSystemVmTemplates:Exception:"+e.getMessage());
- throw new CloudRuntimeException("updateSystemVmTemplates:Exception:"+e.getMessage(), e);
- }
-
- } else {
- if (hypervisorsListInUse.contains(hypervisorAndTemplateName.getKey())){
- throw new CloudRuntimeException("4.3.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. Cannot upgrade system Vms");
- } else {
- s_logger.warn("4.3.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. " + hypervisorAndTemplateName.getKey() + " hypervisor is not used, so not failing upgrade");
- // Update the latest template URLs for corresponding hypervisor
- try(PreparedStatement update_templ_url_pstmt = conn.prepareStatement("UPDATE `cloud`.`vm_template` SET url = ? , checksum = ? WHERE hypervisor_type = ? AND type = 'SYSTEM' AND removed is null order by id desc limit 1");) {
- update_templ_url_pstmt.setString(1, newTemplateUrl.get(hypervisorAndTemplateName.getKey()));
- update_templ_url_pstmt.setString(2, newTemplateChecksum.get(hypervisorAndTemplateName.getKey()));
- update_templ_url_pstmt.setString(3, hypervisorAndTemplateName.getKey().toString());
- update_templ_url_pstmt.executeUpdate();
- }catch (Exception e)
- {
- s_logger.error("updateSystemVmTemplates:Exception:"+e.getMessage());
- throw new CloudRuntimeException("updateSystemVmTemplates:Exception:"+e.getMessage(), e);
- }
- }
- }
- } catch (SQLException e) {
- s_logger.error("updateSystemVmTemplates:Exception:"+e.getMessage());
- throw new CloudRuntimeException("Error while updating "+ hypervisorAndTemplateName.getKey() +" systemVm template", e);
- }
- }
- s_logger.debug("Updating System Vm Template IDs Complete");
- }
- catch (Exception e) {
- s_logger.error("updateSystemVmTemplates:Exception:"+e.getMessage());
- throw new CloudRuntimeException("updateSystemVmTemplates:Exception:"+e.getMessage(), e);
- }
- }
-
private void encryptImageStoreDetails(Connection conn) {
s_logger.debug("Encrypting image store details");
try (PreparedStatement sel_image_store_det_pstmt = conn.prepareStatement("select id, value from `cloud`.`image_store_details` where name = 'key' or name = 'secretkey'");