Skip to content

Commit fc8606d

Browse files
author
Daan Hoogland
committed
do not fail when hyporvisor type is present without new template
1 parent 53859a6 commit fc8606d

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

engine/schema/src/com/cloud/upgrade/dao/Upgrade440to441.java

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -180,21 +180,17 @@ private void updateSystemVmTemplates(Connection conn) {
180180
}
181181

182182
} else {
183-
if (hypervisorsListInUse.contains(hypervisorAndTemplateName.getKey())){
184-
throw new CloudRuntimeException("4.4.2 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. Cannot upgrade system Vms");
185-
} else {
186-
s_logger.warn("4.4.2 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. " + hypervisorAndTemplateName.getKey() + " hypervisor is not used, so not failing upgrade");
187-
// Update the latest template URLs for corresponding hypervisor
188-
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");) {
189-
update_templ_url_pstmt.setString(1, newTemplateUrl.get(hypervisorAndTemplateName.getKey()));
190-
update_templ_url_pstmt.setString(2, "");
191-
update_templ_url_pstmt.setString(3, hypervisorAndTemplateName.getKey().toString());
192-
update_templ_url_pstmt.executeUpdate();
193-
}catch (SQLException e)
194-
{
195-
s_logger.error("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type " + hypervisorAndTemplateName.getKey().toString() + ": "+e.getMessage());
196-
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type " + hypervisorAndTemplateName.getKey().toString(), e);
197-
}
183+
s_logger.warn("4.4.2 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. " + hypervisorAndTemplateName.getKey() + " hypervisor is not used, not failing upgrade");
184+
// Update the latest template URLs for corresponding hypervisor
185+
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");) {
186+
update_templ_url_pstmt.setString(1, newTemplateUrl.get(hypervisorAndTemplateName.getKey()));
187+
update_templ_url_pstmt.setString(2, "");
188+
update_templ_url_pstmt.setString(3, hypervisorAndTemplateName.getKey().toString());
189+
update_templ_url_pstmt.executeUpdate();
190+
}catch (SQLException e)
191+
{
192+
s_logger.error("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type " + hypervisorAndTemplateName.getKey().toString() + ": "+e.getMessage());
193+
throw new CloudRuntimeException("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type " + hypervisorAndTemplateName.getKey().toString(), e);
198194
}
199195
}
200196
} catch (SQLException e) {

0 commit comments

Comments
 (0)