From 9fa3f92efd2d2db9a4cd5e50bfec0f522031bb63 Mon Sep 17 00:00:00 2001 From: prachi Date: Wed, 13 Apr 2011 17:58:37 -0700 Subject: [PATCH] Bug 9438 - [Cloud Stack Upgrade - 2.1.8 to 2.2.4] Secondary Storage VM could not start after stopping it - In the upgrade, new XenServer template entry was added in vm_template having id=100 - However we already have another System VM XenServer template downloaded in the upgrade process that gets different id. - SSVM could not start because the vm_instance's templateId after the upgrade was set to '100' with the assumption that the Xenserver template with id=100 will be used. Fix to upgrade script is: - we should not insert any entry in vm_template table for XenServer systemVM via the upgrade DB script. The latest XenServer template will get added in the upgrade process having name 'routing-xenserver-2.2.4'. - we should update the system VM's template_id in vminstance table to point to this ''routing-xenserver-2.2.4' template. --- setup/db/db/schema-21to22.sql | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup/db/db/schema-21to22.sql b/setup/db/db/schema-21to22.sql index 2e6271d4c0c..35627c19e35 100755 --- a/setup/db/db/schema-21to22.sql +++ b/setup/db/db/schema-21to22.sql @@ -949,8 +949,6 @@ INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest INSERT INTO `cloud`.`guest_os_hypervisor` (hypervisor_type, guest_os_name, guest_os_id) VALUES ('KVM', 'Other', 103); UPDATE `cloud`.`guest_os` SET name = display_name; -INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) - VALUES (100, 'routing-1', 'SystemVM Template (XenServer)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloud.com/releases/2.2.0/systemvm.vhd.bz2', 'c33dfaf0937b35c25ef6a0fdd98f24d3', 0, 'SystemVM Template (XenServer)', 'VHD', 15, 0, 1, 'XenServer'); INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) VALUES (3, 'routing-3', 'SystemVM Template (KVM)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloud.com/releases/2.2.0/systemvm.qcow2.bz2', 'ec463e677054f280f152fcc264255d2f', 0, 'SystemVM Template (KVM)', 'QCOW2', 15, 0, 1, 'KVM'); INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type) @@ -962,7 +960,7 @@ INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable) VALUES (7, 'centos53-x64', 'CentOS 5.3(64-bit) no GUI (vSphere)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloud.com/releases/2.2.0/CentOS5.3-x86_64.ova', 'f6f881b7f2292948d8494db837fe0f47', 0, 'CentOS 5.3(64-bit) no GUI (vSphere)', 'OVA', 12, 1, 1, 'VMware', 1); UPDATE vm_instance SET guest_os_id=15 where vm_template_id=1; -UPDATE vm_instance SET vm_template_id=100 where vm_template_id=1; +UPDATE vm_instance SET vm_template_id=(SELECT id FROM vm_template WHERE unique_name='routing-xenserver-2.2.4') where vm_template_id=1; ALTER TABLE `cloud`.`instance_group` ADD CONSTRAINT `fk_instance_group__account_id` FOREIGN KEY `fk_instance_group__account_id` (`account_id`) REFERENCES `account` (`id`);