[jira] [Created] (CLOUDSTACK-10416) Schema upgrade from 4.0.0 to 4.1.0 error

2020-03-25 Thread ZHANGLEIJIE (Jira)
ZHANGLEIJIE created CLOUDSTACK-10416:


 Summary: Schema upgrade from 4.0.0 to 4.1.0 error 
 Key: CLOUDSTACK-10416
 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10416
 Project: CloudStack
  Issue Type: Improvement
  Security Level: Public (Anyone can view this level - this is the default.)
  Components: cloudstack-agent
Affects Versions: 4.1.1
Reporter: ZHANGLEIJIE


 Error executing: alter table host add column engine_state varchar(32) NOT NULL 
DEFAULT 'Disabled' COMMENT 'the engine state of the zone' 
2020-03-25 21:01:24,081 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:) 
java.sql.SQLSyntaxErrorException: Duplicate column name 'engine_state'
2020-03-25 21:01:24,082 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null) 
(logid:) Unable to execute upgrade script
java.sql.SQLSyntaxErrorException: Duplicate column name 'engine_state'
at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:185)
at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)
at 
com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:484)
at 
com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:582)
at 
com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:666)
at 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.checkIntegrity(CloudStackExtendedLifeCycle.java:65)
at 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.start(CloudStackExtendedLifeCycle.java:55)
at 
org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:183)
at 
org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:52)
at 
org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:358)
at 
org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:159)
at 
org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
at 
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:884)
at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552)
at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContext(DefaultModuleDefinitionSet.java:145)
at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet$2.with(DefaultModuleDefinitionSet.java:122)
at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:245)
at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:250)
at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:233)
at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContexts(DefaultModuleDefinitionSet.java:117)
at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.load(DefaultModuleDefinitionSet.java:79)
at 
org.apache.cloudstack.spring.module.factory.ModuleBasedContextFactory.loadModules(ModuleBasedContextFactory.java:37)
at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.init(CloudStackSpringContext.java:71)
at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.(CloudStackSpringContext.java:58)
at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.(CloudStackSpringContext.java:62)
at 
org.apache.cloudstack.spring.module.web.CloudStackContextLoaderListener.contextInitialized(CloudStackContextLoaderListener.java:52)
at 
org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:890)
at 
org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:532)
at 
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:853)
at 
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:344)
at 
org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1515)
at 
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1477)
at 
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:785)
at 
org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
at 
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
at 
org.eclipse.jetty.util.component.

[jira] [Updated] (CLOUDSTACK-10416) Schema upgrade from 4.0.0 to 4.1.0 error

2020-03-25 Thread ZHANGLEIJIE (Jira)


 [ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10416?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ZHANGLEIJIE updated CLOUDSTACK-10416:
-
Description: 
before do this I have been do 

alter table vm_template drop column `size`;
alter table vm_template drop column `state`;
ALTER table vm_template DROP COLUMN update_count;
ALTER TABLE vm_template DROP COLUMN updated;
alter table storage_pool DROP COLUMN storage_provider_id;
alter table storage_pool DROP COLUMN scope;
alter table template_spool_ref DROP COLUMN state;
alter table template_spool_ref DROP COLUMN update_count;
alter table volumes DROP COLUMN disk_type;
alter table volumes ADD CONSTRAINT `fk_volumes__account_id` FOREIGN KEY 
(`account_id`) REFERENCES `account` (`id`);
alter table vm_instance DROP column disk_offering_id;
alter table vm_instance DROP column cpu;
alter table vm_instance DROP column ram;
alter table vm_instance DROP column `owner`;
alter table vm_instance DROP column speed;
alter table vm_instance DROP column host_name;
alter table vm_instance DROP column display_name;
alter table vm_instance DROP column `desired_state`;
alter table data_center DROP column `owner`;
alter table data_center DROP column `created`;
alter table data_center DROP column lastUpdated;
alter table data_center DROP column engine_state;
alter table host_pod_ref DROP column `owner`;
alter table host_pod_ref DROP column created;
alter table host_pod_ref DROP column lastUpdated; 
alter table host_pod_ref DROP column engine_state;
alter table `host` DROP column `owner`;
alter table host DROP column lastUpdated;

but also have table column error , I don't know how many , so I give up

 Error executing: alter table host add column engine_state varchar(32) NOT NULL 
DEFAULT 'Disabled' COMMENT 'the engine state of the zone' 
2020-03-25 21:01:24,081 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:) 
java.sql.SQLSyntaxErrorException: Duplicate column name 'engine_state'
2020-03-25 21:01:24,082 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null) 
(logid:) Unable to execute upgrade script
java.sql.SQLSyntaxErrorException: Duplicate column name 'engine_state'
at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:185)
at com.cloud.utils.db.ScriptRunner.runScript(ScriptRunner.java:87)
at 
com.cloud.upgrade.DatabaseUpgradeChecker.runScript(DatabaseUpgradeChecker.java:484)
at 
com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:582)
at 
com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:666)
at 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.checkIntegrity(CloudStackExtendedLifeCycle.java:65)
at 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.start(CloudStackExtendedLifeCycle.java:55)
at 
org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:183)
at 
org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:52)
at 
org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:358)
at 
org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:159)
at 
org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
at 
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:884)
at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552)
at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContext(DefaultModuleDefinitionSet.java:145)
at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet$2.with(DefaultModuleDefinitionSet.java:122)
at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:245)
at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:250)
at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:233)
at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContexts(DefaultModuleDefinitionSet.java:117)
at 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.load(DefaultModuleDefinitionSet.java:79)
at 
org.apache.cloudstack.spring.module.factory.ModuleBasedContextFactory.loadModules(ModuleBasedContextFactory.java:37)
at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.init(CloudStackSpringContext.java:71)
at 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContex

[jira] [Updated] (CLOUDSTACK-10416) Schema upgrade from 4.0.0 to 4.1.0 error

2020-03-25 Thread ZHANGLEIJIE (Jira)


 [ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10416?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ZHANGLEIJIE updated CLOUDSTACK-10416:
-
Description: 
before do this I have been do 

alter table vm_template drop column `size`;
alter table vm_template drop column `state`;
ALTER table vm_template DROP COLUMN update_count;
ALTER TABLE vm_template DROP COLUMN updated;
alter table storage_pool DROP COLUMN storage_provider_id;
alter table storage_pool DROP COLUMN scope;
alter table template_spool_ref DROP COLUMN state;
alter table template_spool_ref DROP COLUMN update_count;
alter table volumes DROP COLUMN disk_type;
alter table volumes ADD CONSTRAINT `fk_volumes__account_id` FOREIGN KEY 
(`account_id`) REFERENCES `account` (`id`);
alter table vm_instance DROP column disk_offering_id;
alter table vm_instance DROP column cpu;
alter table vm_instance DROP column ram;
alter table vm_instance DROP column `owner`;
alter table vm_instance DROP column speed;
alter table vm_instance DROP column host_name;
alter table vm_instance DROP column display_name;
alter table vm_instance DROP column `desired_state`;
alter table data_center DROP column `owner`;
alter table data_center DROP column `created`;
alter table data_center DROP column lastUpdated;
alter table data_center DROP column engine_state;
alter table host_pod_ref DROP column `owner`;
alter table host_pod_ref DROP column created;
alter table host_pod_ref DROP column lastUpdated; 
alter table host_pod_ref DROP column engine_state;
alter table `host` DROP column `owner`;
alter table host DROP column lastUpdated;

but also have table column error , I don't know how many , so I give up

I restart cloudstack-management.service every time have this error
service cloudstack-management restart
then management-server.log out put

2020-03-25 21:01:20,926 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null) 
(logid:) Grabbing lock to check for database upgrade.
2020-03-25 21:01:20,974 DEBUG [c.c.u.d.VersionDaoImpl] (main:null) (logid:) 
Checking to see if the database is at a version before it was the version table 
is created
2020-03-25 21:01:20,996 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null) 
(logid:) DB version = 4.0.0 Code Version = 4.11.3.0
2020-03-25 21:01:20,997 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null) 
(logid:) Database upgrade must be performed from 4.0.0 to 4.11.3.0
2020-03-25 21:01:20,997 DEBUG [c.c.u.DatabaseUpgradeChecker] (main:null) 
(logid:) Running upgrade Upgrade40to41 to upgrade from 4.0.0-4.1.0 to 4.1.0
2020-03-25 21:01:21,003 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
Licensed to the Apache Software Foundation (ASF) under one
2020-03-25 21:01:21,004 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- or 
more contributor license agreements.  See the NOTICE file
2020-03-25 21:01:21,004 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
distributed with this work for additional information
2020-03-25 21:01:21,007 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
regarding copyright ownership.  The ASF licenses this file
2020-03-25 21:01:21,008 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- to 
you under the Apache License, Version 2.0 (the
2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
"License"); you may not use this file except in compliance
2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
with the License.  You may obtain a copy of the License at
2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --   
http://www.apache.org/licenses/LICENSE-2.0
2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
Unless required by applicable law or agreed to in writing,
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
software distributed under the License is distributed on an
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
KIND, either express or implied.  See the License for the
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
specific language governing permissions and limitations
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
under the License.
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --;
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
Schema upgrade from 4.0.0 to 4.1.0;
2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --;
2020-03-25 21:01:21,013 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) use 
cloud 
2020-03-25 21:01:21,016 DEBUG [c.c.u.d.ScriptRunner] (main:n

[jira] [Updated] (CLOUDSTACK-10416) Schema upgrade from 4.0.0 to 4.1.0 error

2020-03-25 Thread ZHANGLEIJIE (Jira)


 [ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10416?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ZHANGLEIJIE updated CLOUDSTACK-10416:
-
Attachment: management-server.log

> Schema upgrade from 4.0.0 to 4.1.0 error 
> -
>
> Key: CLOUDSTACK-10416
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10416
> Project: CloudStack
>  Issue Type: Improvement
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>  Components: cloudstack-agent
>Affects Versions: 4.1.1
>Reporter: ZHANGLEIJIE
>Priority: Major
> Attachments: management-server.log
>
>
> before do this I have been do 
> alter table vm_template drop column `size`;
> alter table vm_template drop column `state`;
> ALTER table vm_template DROP COLUMN update_count;
> ALTER TABLE vm_template DROP COLUMN updated;
> alter table storage_pool DROP COLUMN storage_provider_id;
> alter table storage_pool DROP COLUMN scope;
> alter table template_spool_ref DROP COLUMN state;
> alter table template_spool_ref DROP COLUMN update_count;
> alter table volumes DROP COLUMN disk_type;
> alter table volumes ADD CONSTRAINT `fk_volumes__account_id` FOREIGN KEY 
> (`account_id`) REFERENCES `account` (`id`);
> alter table vm_instance DROP column disk_offering_id;
> alter table vm_instance DROP column cpu;
> alter table vm_instance DROP column ram;
> alter table vm_instance DROP column `owner`;
> alter table vm_instance DROP column speed;
> alter table vm_instance DROP column host_name;
> alter table vm_instance DROP column display_name;
> alter table vm_instance DROP column `desired_state`;
> alter table data_center DROP column `owner`;
> alter table data_center DROP column `created`;
> alter table data_center DROP column lastUpdated;
> alter table data_center DROP column engine_state;
> alter table host_pod_ref DROP column `owner`;
> alter table host_pod_ref DROP column created;
> alter table host_pod_ref DROP column lastUpdated; 
> alter table host_pod_ref DROP column engine_state;
> alter table `host` DROP column `owner`;
> alter table host DROP column lastUpdated;
> but also have table column error , I don't know how many , so I give up
> I restart cloudstack-management.service every time have this error
> service cloudstack-management restart
> then management-server.log out put
> 2020-03-25 21:01:20,926 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null) 
> (logid:) Grabbing lock to check for database upgrade.
> 2020-03-25 21:01:20,974 DEBUG [c.c.u.d.VersionDaoImpl] (main:null) (logid:) 
> Checking to see if the database is at a version before it was the version 
> table is created
> 2020-03-25 21:01:20,996 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null) 
> (logid:) DB version = 4.0.0 Code Version = 4.11.3.0
> 2020-03-25 21:01:20,997 INFO  [c.c.u.DatabaseUpgradeChecker] (main:null) 
> (logid:) Database upgrade must be performed from 4.0.0 to 4.11.3.0
> 2020-03-25 21:01:20,997 DEBUG [c.c.u.DatabaseUpgradeChecker] (main:null) 
> (logid:) Running upgrade Upgrade40to41 to upgrade from 4.0.0-4.1.0 to 4.1.0
> 2020-03-25 21:01:21,003 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> Licensed to the Apache Software Foundation (ASF) under one
> 2020-03-25 21:01:21,004 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> or more contributor license agreements.  See the NOTICE file
> 2020-03-25 21:01:21,004 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> distributed with this work for additional information
> 2020-03-25 21:01:21,007 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> regarding copyright ownership.  The ASF licenses this file
> 2020-03-25 21:01:21,008 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> to you under the Apache License, Version 2.0 (the
> 2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> "License"); you may not use this file except in compliance
> 2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> with the License.  You may obtain a copy of the License at
> 2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
> 2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --  
>  http://www.apache.org/licenses/LICENSE-2.0
> 2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) --
> 2020-03-25 21:01:21,009 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> Unless required by applicable law or agreed to in writing,
> 2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> software distributed under the License is distributed on an
> 2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> 2020-03-25 21:01:21,010 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:) -- 
> KI