Unable to execute upgrade script /xx/xx/schema-40to410.sql
问题背景: 在一个新装的操作系统上面安装CloudStack4.1.1,执行到cloudstack-setup-management之后,CloudStack开始启动服务中报错

根据以上日志显示,CloudStack程序发现其所在系统上面的CloudStack数据库实例的版本为4.0.0,而代码版本为4.1.1,所以必须进行数据库实例的升级,于是开始执行schema-40to410.sql 这个文件,打开该sql文件:/usr/share/cloudstack-management/setup/db/schema-40to410.sql,发现如下语句:
--;
-- Schema upgrade from 4.0.0 to 4.1.0;
--;
use cloud;
SET foreign_key_checks = 0;
alter table vm_template add size bigint unsigned;
alter table vm_template add state varchar(255);
alter table vm_template add update_count bigint unsigned;
alter table vm_template add updated datetime;
alter table storage_pool add storage_provider_id bigint unsigned;
alter table storage_pool add scope varchar(255);
alter table storage_pool modify id bigint unsigned AUTO_INCREMENT UNIQUE NOT NULL;
第一句修改表架构的就是对vm_template表增加一个size字段,但是毋庸置疑,我们安装的就是cloudstack4.1.1,根本不存在升级的问题

经过查阅,这是一个BUG,对我而言,这个BUG我也是第一次遇到,据说CloudStack4.2已经完整修复。
现阶段解决方法:
[root@CloudManager ~]# cloudstack-setup-d^Cabases cloud:1qaz2wsx@localhost --deploy-as=root:1qaz2wsx -e file -m 1qaz2wsx -k 1qaz2wsx
[root@CloudManager ~]# cloudstack-setup-management
以上两条命令执行两遍即可。
真乃神奇的BUG。
CloudStack 的详细介绍:请点这里
CloudStack 的下载地址:请点这里
相关阅读:
CloudStack编译环境XenServer启动系统虚拟机失败 http://www.linuxidc.com/Linux/2013-08/88694.htm
CloudStack 4.0.2 vRouter导致重启后状态不正常 http://www.linuxidc.com/Linux/2013-08/88474.htm
CloudStack部署手册 PDF清晰版 http://www.linuxidc.com/Linux/2013-06/86114.htm
CloudStack 4.0 + KVM 安装详细指南 http://www.linuxidc.com/Linux/2013-06/85750.htm
安装部署CloudStack 4.0企业私有云平台 http://www.linuxidc.com/Linux/2013-06/85748.htm
CloudStack安装部署与常见问题解决 http://www.linuxidc.com/Linux/2013-06/85746.htm
