You can try this. Restore your DB backup, register SSVM template and run the 
following against your MySQL DB before starting the  upgrade.

ALTER TABLE `cloud`.`project_account`
 ADD CONSTRAINT `fk_project_account__account_id` FOREIGN KEY(`account_id`) 
REFERENCES `account`(`id`) ON DELETE CASCADE ,
 ADD CONSTRAINT `uc_project_account__project_id_account_id_user_id` UNIQUE 
(`project_id`, `account_id`, `user_id`) ;


If it still fails capture and  post full management server log.


Thanks,
Sergey

On 12/26/20, 2:27 AM, "Hean Seng" <heans...@gmail.com> wrote:

    I restore the backup db, and reregister the system template using
    cloud-install-sys-tmplt
    , it sill getting error.

    stemVm template not found. Ovm3 hypervisor is not used, so not failing
    upgrade

    2020-12-26 10:11:37,713 DEBUG [c.c.u.d.Upgrade41400to41500] (main:null)
    (logid:) Updating KVM System Vms

    2020-12-26 10:11:37,720 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null)
    (logid:) Unable to upgrade the database

    com.cloud.utils.exception.CloudRuntimeException: 4.15.0.0KVM SystemVm
    template not found. Cannot upgrade system Vms

    at
    
com.cloud.upgrade.dao.Upgrade41400to41500.updateSystemVmTemplates(Upgrade41400to41500.java:214)

    at
    
com.cloud.upgrade.dao.Upgrade41400to41500.performDataMigration(Upgrade41400to41500.java:70)

    On Sat, Dec 26, 2020 at 5:48 PM Hean Seng <heans...@gmail.com> wrote:

    > For first time I upgrade and start the MGMT server , it show
    > following error:
    >
    > 2020-12-26 09:02:32,499 DEBUG [c.c.u.d.Upgrade41400to41500] (main:null)
    > (logid:) Updating System Vm template IDs
    >
    > 2020-12-26 09:02:32,503 DEBUG [c.c.u.d.Upgrade41400to41500] (main:null)
    > (logid:) Updating KVM System Vms
    >
    > 2020-12-26 09:02:32,511 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null)
    > (logid:) Unable to upgrade the database
    >
    > com.cloud.utils.exception.CloudRuntimeException: 4.15.0.0KVM SystemVm
    > template not found. Cannot upgrade system Vms
    >
    > at
    > 
com.cloud.upgrade.dao.Upgrade41400to41500.updateSystemVmTemplates(Upgrade41400to41500.java:214)
    >
    > at
    > 
com.cloud.upgrade.dao.Upgrade41400to41500.performDataMigration(Upgrade41400to41500.java:70)
    >
    > at
    > 
com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:262)
    >
    > at
    > 
com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:342)
    >
    > at
    > 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.checkIntegrity(CloudStackExtendedLifeCycle.java:64)
    >
    > at
    > 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.start(CloudStackExtendedLifeCycle.java:54)
    >
    > at
    > 
org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182)
    >
    > at
    > 
org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53)
    >
    > at
    > 
org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360)
    >
    > at
    > 
org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158)
    >
    > at
    > 
org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122)
    >
    > at
    > 
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:894)
    >
    > at
    > 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
    >
    > at
    > 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContext(DefaultModuleDefinitionSet.java:144)
    >
    > at
    > 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet$2.with(DefaultModuleDefinitionSet.java:121)
    >
    > at
    > 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:244)
    >
    > at
    > 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:249)
    >
    > at
    > 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.withModule(DefaultModuleDefinitionSet.java:232)
    >
    > at
    > 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContexts(DefaultModuleDefinitionSet.java:116)
    >
    > at
    > 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.load(DefaultModuleDefinitionSet.java:78)
    >
    > at
    > 
org.apache.cloudstack.spring.module.factory.ModuleBasedContextFactory.loadModules(ModuleBasedContextFactory.java:37)
    >
    > at
    > 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.init(CloudStackSpringContext.java:70)
    >
    > at
    > 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.<init>(CloudStackSpringContext.java:57)
    >
    > at
    > 
org.apache.cloudstack.spring.module.factory.CloudStackSpringContext.<init>(CloudStackSpringContext.java:61)
    >
    > at
    > 
org.apache.cloudstack.spring.module.web.CloudStackContextLoaderListener.contextInitialized(CloudStackContextLoaderListener.java:51)
    >
    > at
    > 
org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:933)
    >
    > at
    > 
org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:553)
    >
    > at
    > 
org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:892)
    >
    > at
    > 
org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:356)
    >
    > at
    > 
org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1445)
    >
    > at
    > 
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1409)
    >
    > at
    > 
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:825)
    >
    > at
    > 
org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:275)
    >
    > at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)
    >
    > at
    > 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
    >
    > at
    > 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
    >
    > at
    > 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
    >
    > at
    > 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
    >
    > at
    > 
org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:425)
    >
    > at
    > 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
    >
    > at
    > 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
    >
    > at
    > 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
    >
    > at
    > 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
    >
    > at
    > 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
    >
    > at
    > 
org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
    >
    > at org.eclipse.jetty.server.Server.start(Server.java:407)
    >
    > at
    > 
org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
    >
    > at
    > 
org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
    >
    > at org.eclipse.jetty.server.Server.doStart(Server.java:371)
    >
    > at
    > 
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
    >
    > at org.apache.cloudstack.ServerDaemon.start(ServerDaemon.java:188)
    >
    > at org.apache.cloudstack.ServerDaemon.main(ServerDaemon.java:104)
    >
    > 2020-12-26 09:02:32,530 DEBUG [c.c.u.d.T.Transaction] (main:null) (logid:)
    > Rolling back the transaction: Time = 109257 Name =  Upgrade; called by
    > 
-TransactionLegacy.rollback:888-TransactionLegacy.removeUpTo:831-TransactionLegacy.close:655-DatabaseUpgradeChecker.upgrade:273-DatabaseUpgradeChecker.check:342-CloudStackExtendedLifeCycle.checkIntegrity:64-CloudStackExtendedLifeCycle.start:54-DefaultLifecycleProcessor.doStart:182-DefaultLifecycleProcessor.access$200:53-DefaultLifecycleProcessor$LifecycleGroup.start:360-DefaultLifecycleProcessor.startBeans:158-DefaultLifecycleProcessor.onRefresh:122
    >
    >
    > after I found the error on system template,  (before i do mgmt upgrade, i
    > do upload system tempate 4.15 at GUI ) ,  I restart again the MGMT server,
    > and it show the error in prevous reply.
    >
    >
    >
    > On Sat, Dec 26, 2020 at 5:39 PM Hean Seng <heans...@gmail.com> wrote:
    >
    >> I. am trying to run the upgrade on my test environment,  it seem getting
    >> error after finish upgrade and restart mgmt server:
    >>
    >> 020-12-26 09:33:56,338 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    >> --;
    >>
    >> 2020-12-26 09:33:56,338 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    >> -- Project roles
    >>
    >> 2020-12-26 09:33:56,339 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    >> CREATE TABLE IF NOT EXISTS `cloud`.`project_role` (   `id` bigint(20)
    >> unsigned NOT NULL AUTO_INCREMENT,   `uuid` varchar(255) UNIQUE,   `name`
    >> varchar(255) COMMENT 'unique name of the dynamic project role',   
`removed`
    >> datetime COMMENT 'date removed',   `description` text COMMENT
    >> 'description of the project role',   `project_id` bigint(20) unsigned
    >> COMMENT 'Id of the project to which the role belongs',   PRIMARY KEY
    >> (`id`),   KEY `i_project_role__name` (`name`),   UNIQUE KEY (`name`,
    >> `project_id`),   CONSTRAINT `fk_project_role__project_id` FOREIGN
    >> KEY(`project_id`) REFERENCES `projects`(`id`) ON DELETE CASCADE )
    >> ENGINE=InnoDB DEFAULT CHARSET=utf8
    >>
    >> 2020-12-26 09:33:56,340 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    >> -- Project role permissions table
    >>
    >> 2020-12-26 09:33:56,340 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    >> CREATE TABLE IF NOT EXISTS `cloud`.`project_role_permissions` (   `id`
    >> bigint(20) unsigned NOT NULL AUTO_INCREMENT,   `uuid` varchar(255)
    >> UNIQUE,   `project_id` bigint(20) unsigned NOT NULL COMMENT 'id of the
    >> role',   `project_role_id` bigint(20) unsigned NOT NULL COMMENT 'id of
    >> the role',   `rule` varchar(255) NOT NULL COMMENT 'rule for the role,
    >> api name or wildcard',   `permission` varchar(255) NOT NULL COMMENT
    >> 'access authority, allow or deny',   `description` text COMMENT
    >> 'description of the rule',   `sort_order` bigint(20) unsigned NOT NULL
    >> DEFAULT 0 COMMENT 'permission sort order',   PRIMARY KEY (`id`),   KEY
    >> `fk_project_role_permissions__project_role_id` (`project_role_id`),   KEY
    >> `i_project_role_permissions__sort_order` (`sort_order`),   UNIQUE KEY
    >> (`project_role_id`, `rule`),   CONSTRAINT
    >> `fk_project_role_permissions__project_id` FOREIGN KEY(`project_id`)
    >> REFERENCES `projects`(`id`) ON DELETE CASCADE,   CONSTRAINT
    >> `fk_project_role_permissions__project_role_id` FOREIGN KEY
    >> (`project_role_id`) REFERENCES `project_role` (`id`) ON DELETE CASCADE )
    >> ENGINE=InnoDB DEFAULT CHARSET=utf8
    >>
    >> 2020-12-26 09:33:56,341 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    >> -- Alter project accounts table to include user_id and project_role_id 
for
    >> role based users in projects
    >>
    >> 2020-12-26 09:33:56,341 DEBUG [c.c.u.d.ScriptRunner] (main:null) (logid:)
    >> ALTER TABLE `cloud`.`project_account`  ADD COLUMN `user_id` bigint
    >> unsigned COMMENT 'ID of user to be added to the project' AFTER 
`account_id`,
    >> ADD CONSTRAINT `fk_project_account__user_id` FOREIGN KEY
    >> `fk_project_account__user_id`(`user_id`) REFERENCES `user`(`id`) ON 
DELETE
    >> CASCADE,  ADD COLUMN `project_role_id` bigint unsigned COMMENT 'Project
    >> role id' AFTER `project_account_id`,  ADD CONSTRAINT
    >> `fk_project_account__project_role_id` FOREIGN KEY (`project_role_id`)
    >> REFERENCES `project_role` (`id`) ON DELETE SET NULL,  DROP FOREIGN KEY
    >> `fk_project_account__account_id`,  DROP INDEX `account_id`
    >>
    >> 2020-12-26 09:33:56,361 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
    >> Error executing: ALTER TABLE `cloud`.`project_account`  ADD COLUMN
    >> `user_id` bigint unsigned COMMENT 'ID of user to be added to the project'
    >> AFTER `account_id`,  ADD CONSTRAINT `fk_project_account__user_id`
    >> FOREIGN KEY `fk_project_account__user_id`(`user_id`) REFERENCES
    >> `user`(`id`) ON DELETE CASCADE,  ADD COLUMN `project_role_id` bigint
    >> unsigned COMMENT 'Project role id' AFTER `project_account_id`,  ADD
    >> CONSTRAINT `fk_project_account__project_role_id` FOREIGN KEY
    >> (`project_role_id`) REFERENCES `project_role` (`id`) ON DELETE SET NULL,
    >> DROP FOREIGN KEY `fk_project_account__account_id`,  DROP INDEX
    >> `account_id`
    >>
    >> 2020-12-26 09:33:56,362 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
    >> java.sql.SQLSyntaxErrorException: Can't DROP
    >> 'fk_project_account__account_id'; check that column/key exists
    >>
    >> 2020-12-26 09:33:56,364 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null)
    >> (logid:) Unable to execute upgrade script
    >>
    >> java.sql.SQLSyntaxErrorException: Can't DROP
    >> 'fk_project_account__account_id'; check that column/key exists
    >>
    >> 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:203)
    >>
    >> at
    >> 
com.cloud.upgrade.DatabaseUpgradeChecker.upgrade(DatabaseUpgradeChecker.java:258)
    >>
    >> at
    >> 
com.cloud.upgrade.DatabaseUpgradeChecker.check(DatabaseUpgradeChecker.java:342)
    >>
    >> at
    >> 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.checkIntegrity(CloudStackExtendedLifeCycle.java:64)
    >>
    >> at
    >> 
org.apache.cloudstack.spring.lifecycle.CloudStackExtendedLifeCycle.start(CloudStackExtendedLifeCycle.java:54)
    >>
    >> at
    >> 
org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182)
    >>
    >> at
    >> 
org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53)
    >>
    >> at
    >> 
org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360)
    >>
    >> at
    >> 
org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158)
    >>
    >> at
    >> 
org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122)
    >>
    >> at
    >> 
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:894)
    >>
    >> at
    >> 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553)
    >>
    >> at
    >> 
org.apache.cloudstack.spring.module.model.impl.DefaultModuleDefinitionSet.loadContext(DefaultModuleDefinitionSet.java:144)
    >>
    >> at or
    >>
    >> On Thu, Dec 24, 2020 at 11:14 AM Rohit Yadav <rohit.ya...@shapeblue.com>
    >> wrote:
    >>
    >>>
    >>> All,
    >>>
    >>> Here are the convenience packages build from 4.15.0.0-RC3 if you don't
    >>> want to build CloudStack from the source artifacts:
    >>>
    >>> Packages: (Debian, CentOS7, and CentOS8)
    >>> http://download.cloudstack.org/testing/4.15.0.0-rc3/
    >>>
    >>> 4.15 systemvmtemplate:
    >>> http://download.cloudstack.org/systemvm/4.15/
    >>>
    >>> Build from the master branch of
    >>> https://github.com/apache/cloudstack-documentation (if/after voting
    >>> passes, we'll update and publish the docs):
    >>> http://docs.cloudstack.apache.org/en/master/upgrading/
    >>>
    >>> Additional notes:
    >>>   *   The new UI is bundled within the cloudstack-management package and
    >>> is shipped as the default UI served at <host:8080>/client, old UI will 
be
    >>> served via <host:8080>/client/legacy. Most users don't need to do any
    >>> separate installation or perform an installation step.
    >>>   *   We've added support for CentOS8 with 4.15 but CentOS8 will EOL in
    >>> Dec 2021 (https://wiki.centos.org/About/Product).
    >>>
    >>>
    >>> Regards.
    >>>
    >>> ________________________________
    >>> From: Daan Hoogland <daan.hoogl...@gmail.com>
    >>> Sent: Wednesday, December 23, 2020 23:13
    >>> To: users <users@cloudstack.apache.org>; dev 
<d...@cloudstack.apache.org>
    >>> Subject: [VOTE] Apache Cloudstack 4.15.0.0 and UI [RC3]
    >>>
    >>> LS,
    >>> After fixing another few blockers, we have an RC3, The changes (other
    >>> than
    >>> bundling) are mostly interesting for those working with templates and on
    >>> vmware.
    >>>
    >>> We are voting for the new UI and the main code.
    >>>
    >>> The candidate release branch is 4.15.0.0-RC20201223T1632. The UI is 
still
    >>> separate but as agreed upon before this will be merged in coming
    >>> releases,
    >>> at least from a version management point of view.
    >>> I've created a 4.15.0.0 release candidate, with the following artifacts
    >>> up
    >>> for a vote:Git Branches:
    >>> main code:
    >>>
    >>> 
https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=shortlog;h=refs/heads/4.15.0.0-RC20201223T1632
    >>> <
    >>> 
https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;a=shortlog;h=refs/heads/4.15.0.0-RC20201214T1124
    >>> >
    >>> ui code:
    >>> <
    >>> 
https://git-wip-us.apache.org/repos/asf?p=cloudstack-primate.git;a=shortlog;h=refs/tags/1.0
    >>> >
    >>>
    >>> 
https://git-wip-us.apache.org/repos/asf?p=cloudstack-primate.git;a=tag;h=refs/tags/1.0
    >>> and Commit SH:
    >>> main code: 01b3e361c7bb81fd1ea822faddd6594e52bb00c1
    >>> ui code: 0593302dd53ac3203d3ab43b62d890605910f3e1
    >>>
    >>> Source release (checksums and signatures are available at the same
    >>> location):
    >>> https://dist.apache.org/repos/dist/dev/cloudstack/4.15.0.0/ (rev. 45059)
    >>> PGP release keys (signed using 7975062401944786):
    >>> https://dist.apache.org/repos/dist/release/cloudstack/KEYSVote will be
    >>> open
    >>> for (at least) 72 hours.For sanity in tallying the vote, can PMC members
    >>> please be sure to indicate "(binding)" with their vote?[ ] +1 approve
    >>> [ ] +0 no opinion
    >>> [ ] -1 disapprove (and reason why)
    >>>
    >>> I will work with community members to provide convenience packaging over
    >>> the next few days.
    >>> The documentation repo will be updated as we move along.
    >>>
    >>>
    >>>
    >>> --
    >>> Daan
    >>>
    >>> rohit.ya...@shapeblue.com
    >>> www.shapeblue.com
    >>> 3 London Bridge Street,  3rd floor, News Building, London  SE1 9SGUK
    >>> @shapeblue
    >>>
    >>>
    >>>
    >>>
    >>
    >> --
    >> Regards,
    >> Hean Seng
    >>
    >
    >
    > --
    > Regards,
    > Hean Seng
    >


    -- 
    Regards,
    Hean Seng

Reply via email to