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。