You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
try (PreparedStatementpstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null");
179
-
ResultSetrs = pstmt.executeQuery()
180
-
) {
181
-
while(rs.next()){
179
+
try (PreparedStatementpstmt = conn.prepareStatement("select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null"); ResultSetrs = pstmt.executeQuery()) {
for (finalMap.Entry<Hypervisor.HypervisorType, String> hypervisorAndTemplateName : NewTemplateNameList.entrySet()) {
243
255
s_logger.debug("Updating " + hypervisorAndTemplateName.getKey() + " System Vms");
244
-
try(PreparedStatementpstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = ? and removed is null order by id desc limit 1")) {
245
-
//Get 4.6.0 system Vm template Id for corresponding hypervisor
256
+
try (PreparedStatementpstmt = conn.prepareStatement("select id from `cloud`.`vm_template` where name = ? and removed is null order by id desc limit 1")) {
257
+
//Get 4.6.0 system Vm template Id for corresponding hypervisor
s_logger.error("updateSystemVmTemplates:Exception while getting ids of templates: "+e.getMessage());
264
+
} catch (finalSQLExceptione) {
265
+
s_logger.error("updateSystemVmTemplates:Exception while getting ids of templates: " + e.getMessage());
255
266
thrownewCloudRuntimeException("updateSystemVmTemplates:Exception while getting ids of templates", e);
256
267
}
257
268
258
269
// change template type to SYSTEM
259
270
if (templateId != -1) {
260
-
try(PreparedStatementtempl_type_pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");)
261
-
{
271
+
try (PreparedStatementtempl_type_pstmt = conn.prepareStatement("update `cloud`.`vm_template` set type='SYSTEM' where id = ?");) {
262
272
templ_type_pstmt.setLong(1, templateId);
263
273
templ_type_pstmt.executeUpdate();
264
-
}
265
-
catch (finalSQLExceptione)
266
-
{
267
-
s_logger.error("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system': "+e.getMessage());
274
+
} catch (finalSQLExceptione) {
275
+
s_logger.error("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system': " + e.getMessage());
268
276
thrownewCloudRuntimeException("updateSystemVmTemplates:Exception while updating template with id " + templateId + " to be marked as 'system'", e);
269
277
}
270
278
// update template ID of system Vms
271
-
try(PreparedStatementupdate_templ_id_pstmt = conn.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = ?");)
272
-
{
279
+
try(PreparedStatementupdate_templ_id_pstmt = conn
280
+
.prepareStatement("update `cloud`.`vm_instance` set vm_template_id = ? where type <> 'User' and hypervisor_type = ?");) {
s_logger.error("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to " + templateId + ": "+e.getMessage());
279
-
thrownewCloudRuntimeException("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to " + templateId, e);
284
+
} catch (finalExceptione) {
285
+
s_logger.error("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to " + templateId
286
+
+ ": " + e.getMessage());
287
+
thrownewCloudRuntimeException("updateSystemVmTemplates:Exception while setting template for " + hypervisorAndTemplateName.getKey().toString() + " to "
288
+
+ templateId, e);
280
289
}
281
-
// Change value of global configuration parameter router.template.* for the corresponding hypervisor
282
-
try(PreparedStatementupdate_pstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value = ? WHERE name = ?");) {
290
+
291
+
// Change value of global configuration parameter
292
+
// router.template.* for the corresponding hypervisor
293
+
try (PreparedStatementupdate_pstmt = conn.prepareStatement("UPDATE `cloud`.`configuration` SET value = ? WHERE name = ?");) {
s_logger.error("updateSystemVmTemplates:Exception while setting 'minreq.sysvmtemplate.version' to 4.6.0: " + e.getMessage());
312
+
thrownewCloudRuntimeException("updateSystemVmTemplates:Exception while setting 'minreq.sysvmtemplate.version' to 4.6.0", e);
290
313
}
291
314
} else {
292
-
if (hypervisorsListInUse.contains(hypervisorAndTemplateName.getKey())){
293
-
thrownewCloudRuntimeException("4.6.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. Cannot upgrade system Vms");
315
+
if (hypervisorsListInUse.contains(hypervisorAndTemplateName.getKey())){
316
+
thrownewCloudRuntimeException(getUpgradedVersion() + hypervisorAndTemplateName.getKey() + " SystemVm template not found. Cannot upgrade system Vms");
294
317
} else {
295
-
s_logger.warn("4.6.0 " + hypervisorAndTemplateName.getKey() + " SystemVm template not found. " + hypervisorAndTemplateName.getKey() + " hypervisor is not used, so not failing upgrade");
296
-
// Update the latest template URLs for corresponding hypervisor
297
-
try(PreparedStatementupdate_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");) {
.prepareStatement("UPDATE `cloud`.`vm_template` SET url = ? , checksum = ? WHERE hypervisor_type = ? AND type = 'SYSTEM' AND removed is null order by id desc limit 1");) {
s_logger.error("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type " + hypervisorAndTemplateName.getKey().toString() + ": "+e.getMessage());
305
-
thrownewCloudRuntimeException("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type " + hypervisorAndTemplateName.getKey().toString(), e);
328
+
} catch (finalSQLExceptione) {
329
+
s_logger.error("updateSystemVmTemplates:Exception while updating 'url' and 'checksum' for hypervisor type "
INSERT IGNORE INTO`cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `default_value`, `description`) VALUES ('Advanced', 'DEFAULT', 'ManagementServer', 'ovm3.heartbeat.timeout' , '180', '120', 'Timeout value to send to the checkheartbeat script for guarding the self fencing functionality on ovm3');
383
383
INSERT IGNORE INTO`cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `default_value`, `description`) VALUES ('Advanced', 'DEFAULT', 'ManagementServer', 'ovm3.heartbeat.interval' , '10', '1', 'Interval value the checkheartbeat script uses before triggering the timeout for ovm3');
0 commit comments