You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cloudstack.apache.org by Practical XenServer <pr...@gmail.com> on 2020/06/05 04:05:48 UTC

cloudstack-management fails: com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the database

After successfully installing and starting Version 4.14 of the Management
server on a *fresh* installation of CentOS-7: The management server halts
after accessing the WWW interface for the first time...

2020-06-05 03:30:20,067 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
Error executing: alter table vm_template add size bigint unsigned
2020-06-05 03:30:20,068 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
2020-06-05 03:30:20,070 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null)
(logid:) Unable to execute upgrade script
java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
...SNIP...
Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
...SNIP...
        ... 50 more
2020-06-05 03:30:20,099 DEBUG [c.c.u.d.T.Transaction] (main:null) (logid:)
Rolling back the transaction: Time = 35 Name =  Upgrade; called by
-TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-TransactionLegacy.close:657-DatabaseUpgradeChecker.upgrade:271-DatabaseUpgradeChecker.check:340-CloudStackExtendedLifeCycle.checkIntegrity:65-CloudStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:182-DefaultLifecycleProcessor.access$200:53-DefaultLifecycleProcessor$LifecycleGroup.start:360-DefaultLifecycleProcessor.startBeans:158-DefaultLifecycleProcessor.onRefresh:122
2020-06-05 03:30:20,100 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
(main:null) (logid:) Exception encountered during context initialization -
cancelling refresh attempt:
org.springframework.context.ApplicationContextException: Failed to start
bean 'cloudStackLifeCycle'; nested exception is
com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
database
2020-06-05 03:30:20,102 WARN  [o.e.j.w.WebAppContext] (main:null) (logid:)
Failed startup of context o.e.j.w.WebAppContext@d23e042
{/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{/usr/share/cloudstack-management/webapp}
org.springframework.context.ApplicationContextException: Failed to start
bean 'cloudStackLifeCycle'; nested exception is
com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
database
...SNIP...
Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
...SNIP...
        ... 50 more
2020-06-05 03:30:20,099 DEBUG [c.c.u.d.T.Transaction] (main:null) (logid:)
Rolling back the transaction: Time = 35 Name =  Upgrade; called by
-TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-TransactionLegacy.close:657-DatabaseUpgradeChecker.upgrade:271-DatabaseUpgradeChecker.check:340-CloudStackExtendedLifeCycle.checkIntegrity:65-CloudStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:182-DefaultLifecycleProcessor.access$200:53-DefaultLifecycleProcessor$LifecycleGroup.start:360-DefaultLifecycleProcessor.startBeans:158-DefaultLifecycleProcessor.onRefresh:122
2020-06-05 03:30:20,100 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
(main:null) (logid:) Exception encountered during context initialization -
cancelling refresh attempt:
org.springframework.context.ApplicationContextException: Failed to start
bean 'cloudStackLifeCycle'; nested exception is
com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
database
2020-06-05 03:30:20,102 WARN  [o.e.j.w.WebAppContext] (main:null) (logid:)
Failed startup of context o.e.j.w.WebAppContext@d23e042
{/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{/usr/share/cloudstack-management/webapp}
org.springframework.context.ApplicationContextException: Failed to start
bean 'cloudStackLifeCycle'; nested exception is
com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
database

Restarting the service causes *slightly* different error messages in
/var/log/cloudstack/management/management-server.log but they're still
pretty much the same as the previous (i.e., "Unable to upgrade the
database"):

2020-06-05 03:44:44,641 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
Error executing: alter table vm_template add size bigint unsigned
2020-06-05 03:44:44,642 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
2020-06-05 03:44:44,643 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null)
(logid:) Unable to execute upgrade script
java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
...SNIP...
2020-06-05 03:44:44,655 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null)
(logid:) Unable to upgrade the database
com.cloud.utils.exception.CloudRuntimeException: Unable to execute upgrade
script
...SNIP...
Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
...SNIP...
        ... 50 more
2020-06-05 03:44:44,669 DEBUG [c.c.u.d.T.Transaction] (main:null) (logid:)
Rolling back the transaction: Time = 34 Name =  Upgrade; called by
-TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-TransactionLegacy.close:657-DatabaseUpgradeChecker.upgrade:271-DatabaseUpgradeChecker.check:340-CloudStackExtendedLifeCycle.checkIntegrity:65-CloudStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:182-DefaultLifecycleProcessor.access$200:53-DefaultLifecycleProcessor$LifecycleGroup.start:360-DefaultLifecycleProcessor.startBeans:158-DefaultLifecycleProcessor.onRefresh:122
2020-06-05 03:44:44,672 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
(main:null) (logid:) Exception encountered during context initialization -
cancelling refresh attempt:
org.springframework.context.ApplicationContextException: Failed to start
bean 'cloudStackLifeCycle'; nested exception is
com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
database
2020-06-05 03:44:44,674 WARN  [o.e.j.w.WebAppContext] (main:null) (logid:)
Failed startup of context o.e.j.w.WebAppContext@d23e042
{/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{/usr/share/cloudstack-management/webapp}
org.springframework.context.ApplicationContextException: Failed to start
bean 'cloudStackLifeCycle'; nested exception is
com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
database
...SNIP...
Caused by: com.cloud.utils.exception.CloudRuntimeException: Unable to
upgrade the database
...SNIP...
        ... 47 more
Caused by: com.cloud.utils.exception.CloudRuntimeException: Unable to
execute upgrade script
...SNIP...
        ... 48 more
Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
...SNIP...
        ... 50 more
2020-06-05 03:44:44,676 INFO  [o.e.j.s.h.ContextHandler] (main:null)
(logid:) Started o.e.j.s.h.MovedContextHandler@7ce69770{/,null,AVAILABLE}
2020-06-05 03:44:44,693 INFO  [o.e.j.s.AbstractConnector] (main:null)
(logid:) Started ServerConnector@7ea9e1e2{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
2020-06-05 03:44:44,694 INFO  [o.e.j.s.Server] (main:null) (logid:) Started
@6322ms

Meanwhile: The WWW interface has gone from the CloudStack Sign-in Page to...
HTTP ERROR 503 Service Unavailable
URI: /client/
STATUS: 503
MESSAGE: Service Unavailable
SERVLET: -

*Using a script:* I've re-installed CentOS twice - *for a total of three
attempts* - and gotten the same result.

What might be causing this?

TIA,
Eric Pretorious
Portland, Oregon

Re: cloudstack-management fails: com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the database

Posted by Practical XenServer <pr...@gmail.com>.
*FYI:* The solution was a simple one! After setting up
cloudstack-management (/cloudstack-setup-databases &&
usr/bin/cloudstack-setup-management): I simply watched the manager's log
file /var/log/cloudstack/management/management-server.log and waited for
cloudstack-management to stop spewing log messages about "upgrading the
database".

After that: I was able to access the UI and begin configuring CloudStack!

HTH,
Eric P.
Portland, Oregon

On Fri, Jun 5, 2020 at 3:49 AM Paul Angus <pa...@shapeblue.com> wrote:

> Hi Eric,
>
> This sounds like you had a failed install/upgrade and then tried again.
> The second time, CloudStack came to adding a column ('size'), but found
> that it was already there and stopped.
>
>
> paul.angus@shapeblue.com
> www.shapeblue.com
> 3 London Bridge Street,  3rd floor, News Building, London  SE1 9SGUK
> @shapeblue
>
>
>
>
> -----Original Message-----
> From: Practical XenServer <pr...@gmail.com>
> Sent: 05 June 2020 05:43
> To: users@cloudstack.apache.org
> Subject: Re: cloudstack-management fails:
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
> database
>
> *In one about "Unable to upgrade the database" message on the list*:
> Someone else had inquired about whether or not mysql-connector-python had
> been installed. I found that it was installed as a dependency while
> installing the cloudstack-management package...
>
> [root@san-1 ~]# yum list installed | grep 'cloud\|mysql'
> cloudstack-common.x86_64           4.14.0.0-1.el7
>  @cloudstack
> cloudstack-management.x86_64       4.14.0.0-1.el7
>  @cloudstack
> mysql-connector-python.x86_64      8.0.20-1.el7
>  @mysql-connectors-community
> mysql-connector-python-cext.x86_64 8.0.20-1.el7
> @mysql-connectors-community
> mysql80-community-release.noarch   el7-3
> installed
>
> *In another message about "*Unable to upgrade the database*" on the list*:
> One person recommended completely removing the database and creating it
> anew.
>
> So I dropped the CloudStack database and re-created it using the
> /usr/bin/cloudstack-setup-databases tool:
>
> /usr/bin/cloudstack-setup-databases cloudstack:#########@localhost
> --deploy-as=root:#########
>
> And, *at least initially*, this seems to have repaired the situation.
>
> I will update the list with my efforts to add a host *once I'm able to
> install/configure an agent reliably*.
>
> Eric P.
> Portland, Oregon
>
> On Fri, Jun 5, 2020 at 5:05 AM Practical XenServer <
> practicalxenserver@gmail.com> wrote:
>
> > After successfully installing and starting Version 4.14 of the
> > Management server on a *fresh* installation of CentOS-7: The
> > management server halts after accessing the WWW interface for the first
> time...
> >
> > 2020-06-05 03:30:20,067 ERROR [c.c.u.d.ScriptRunner] (main:null)
> > (logid:) Error executing: alter table vm_template add size bigint
> > unsigned
> > 2020-06-05 03:30:20,068 ERROR [c.c.u.d.ScriptRunner] (main:null)
> > (logid:)
> > java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> > 2020-06-05 03:30:20,070 ERROR [c.c.u.DatabaseUpgradeChecker]
> > (main:null)
> > (logid:) Unable to execute upgrade script
> > java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> > ...SNIP...
> > Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> > ...SNIP...
> >         ... 50 more
> > 2020-06-05 03:30:20,099 DEBUG [c.c.u.d.T.Transaction] (main:null)
> > (logid:) Rolling back the transaction: Time = 35 Name =  Upgrade;
> > called by
> > -TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-Trans
> > actionLegacy.close:657-DatabaseUpgradeChecker.upgrade:271-DatabaseUpgr
> > adeChecker.check:340-CloudStackExtendedLifeCycle.checkIntegrity:65-Clo
> > udStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:18
> > 2-DefaultLifecycleProcessor.access$200:53-DefaultLifecycleProcessor$Li
> > fecycleGroup.start:360-DefaultLifecycleProcessor.startBeans:158-Defaul
> > tLifecycleProcessor.onRefresh:122
> > 2020-06-05 03:30:20,100 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
> > (main:null) (logid:) Exception encountered during context
> > initialization - cancelling refresh attempt:
> > org.springframework.context.ApplicationContextException: Failed to
> > start bean 'cloudStackLifeCycle'; nested exception is
> > com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
> > database
> > 2020-06-05 03:30:20,102 WARN  [o.e.j.w.WebAppContext] (main:null)
> > (logid:) Failed startup of context o.e.j.w.WebAppContext@d23e042
> > {/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{
> > /usr/share/cloudstack-management/webapp}
> > org.springframework.context.ApplicationContextException: Failed to
> > start bean 'cloudStackLifeCycle'; nested exception is
> > com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
> > database ...SNIP...
> > Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> > ...SNIP...
> >         ... 50 more
> > 2020-06-05 03:30:20,099 DEBUG [c.c.u.d.T.Transaction] (main:null)
> > (logid:) Rolling back the transaction: Time = 35 Name =  Upgrade;
> > called by
> > -TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-Trans
> > actionLegacy.close:657-DatabaseUpgradeChecker.upgrade:271-DatabaseUpgr
> > adeChecker.check:340-CloudStackExtendedLifeCycle.checkIntegrity:65-Clo
> > udStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:18
> > 2-DefaultLifecycleProcessor.access$200:53-DefaultLifecycleProcessor$Li
> > fecycleGroup.start:360-DefaultLifecycleProcessor.startBeans:158-Defaul
> > tLifecycleProcessor.onRefresh:122
> > 2020-06-05 03:30:20,100 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
> > (main:null) (logid:) Exception encountered during context
> > initialization - cancelling refresh attempt:
> > org.springframework.context.ApplicationContextException: Failed to
> > start bean 'cloudStackLifeCycle'; nested exception is
> > com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
> > database
> > 2020-06-05 03:30:20,102 WARN  [o.e.j.w.WebAppContext] (main:null)
> > (logid:) Failed startup of context o.e.j.w.WebAppContext@d23e042
> > {/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{
> > /usr/share/cloudstack-management/webapp}
> > org.springframework.context.ApplicationContextException: Failed to
> > start bean 'cloudStackLifeCycle'; nested exception is
> > com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
> > database
> >
> > Restarting the service causes *slightly* different error messages in
> > /var/log/cloudstack/management/management-server.log but they're still
> > pretty much the same as the previous (i.e., "Unable to upgrade the
> > database"):
> >
> > 2020-06-05 03:44:44,641 ERROR [c.c.u.d.ScriptRunner] (main:null)
> > (logid:) Error executing: alter table vm_template add size bigint
> > unsigned
> > 2020-06-05 03:44:44,642 ERROR [c.c.u.d.ScriptRunner] (main:null)
> > (logid:)
> > java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> > 2020-06-05 03:44:44,643 ERROR [c.c.u.DatabaseUpgradeChecker]
> > (main:null)
> > (logid:) Unable to execute upgrade script
> > java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> > ...SNIP...
> > 2020-06-05 03:44:44,655 ERROR [c.c.u.DatabaseUpgradeChecker]
> > (main:null)
> > (logid:) Unable to upgrade the database
> > com.cloud.utils.exception.CloudRuntimeException: Unable to execute
> > upgrade script ...SNIP...
> > Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> > ...SNIP...
> >         ... 50 more
> > 2020-06-05 03:44:44,669 DEBUG [c.c.u.d.T.Transaction] (main:null)
> > (logid:) Rolling back the transaction: Time = 34 Name =  Upgrade;
> > called by
> > -TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-Trans
> > actionLegacy.close:657-DatabaseUpgradeChecker.upgrade:271-DatabaseUpgr
> > adeChecker.check:340-CloudStackExtendedLifeCycle.checkIntegrity:65-Clo
> > udStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:18
> > 2-DefaultLifecycleProcessor.access$200:53-DefaultLifecycleProcessor$Li
> > fecycleGroup.start:360-DefaultLifecycleProcessor.startBeans:158-Defaul
> > tLifecycleProcessor.onRefresh:122
> > 2020-06-05 03:44:44,672 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
> > (main:null) (logid:) Exception encountered during context
> > initialization - cancelling refresh attempt:
> > org.springframework.context.ApplicationContextException: Failed to
> > start bean 'cloudStackLifeCycle'; nested exception is
> > com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
> > database
> > 2020-06-05 03:44:44,674 WARN  [o.e.j.w.WebAppContext] (main:null)
> > (logid:) Failed startup of context o.e.j.w.WebAppContext@d23e042
> > {/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{
> > /usr/share/cloudstack-management/webapp}
> > org.springframework.context.ApplicationContextException: Failed to
> > start bean 'cloudStackLifeCycle'; nested exception is
> > com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
> > database ...SNIP...
> > Caused by: com.cloud.utils.exception.CloudRuntimeException: Unable to
> > upgrade the database ...SNIP...
> >         ... 47 more
> > Caused by: com.cloud.utils.exception.CloudRuntimeException: Unable to
> > execute upgrade script ...SNIP...
> >         ... 48 more
> > Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> > ...SNIP...
> >         ... 50 more
> > 2020-06-05 03:44:44,676 INFO  [o.e.j.s.h.ContextHandler] (main:null)
> > (logid:) Started
> > o.e.j.s.h.MovedContextHandler@7ce69770{/,null,AVAILABLE}
> > 2020-06-05 03:44:44,693 INFO  [o.e.j.s.AbstractConnector] (main:null)
> > (logid:) Started ServerConnector@7ea9e1e2{HTTP/1.1,[http/1.1]}{
> > 0.0.0.0:8080}
> > 2020-06-05 03:44:44,694 INFO  [o.e.j.s.Server] (main:null) (logid:)
> > Started @6322ms
> >
> > Meanwhile: The WWW interface has gone from the CloudStack Sign-in Page
> > to...
> > HTTP ERROR 503 Service Unavailable
> > URI: /client/
> > STATUS: 503
> > MESSAGE: Service Unavailable
> > SERVLET: -
> >
> > *Using a script:* I've re-installed CentOS twice - *for a total of
> > three
> > attempts* - and gotten the same result.
> >
> > What might be causing this?
> >
> > TIA,
> > Eric Pretorious
> > Portland, Oregon
> >
>

RE: cloudstack-management fails: com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the database

Posted by Paul Angus <pa...@shapeblue.com>.
Hi Eric,

This sounds like you had a failed install/upgrade and then tried again.  The second time, CloudStack came to adding a column ('size'), but found that it was already there and stopped.


paul.angus@shapeblue.comĀ 
www.shapeblue.com
3 London Bridge Street,  3rd floor, News Building, London  SE1 9SGUK
@shapeblue
  
 


-----Original Message-----
From: Practical XenServer <pr...@gmail.com> 
Sent: 05 June 2020 05:43
To: users@cloudstack.apache.org
Subject: Re: cloudstack-management fails: com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the database

*In one about "Unable to upgrade the database" message on the list*:
Someone else had inquired about whether or not mysql-connector-python had been installed. I found that it was installed as a dependency while installing the cloudstack-management package...

[root@san-1 ~]# yum list installed | grep 'cloud\|mysql'
cloudstack-common.x86_64           4.14.0.0-1.el7
 @cloudstack
cloudstack-management.x86_64       4.14.0.0-1.el7
 @cloudstack
mysql-connector-python.x86_64      8.0.20-1.el7
 @mysql-connectors-community
mysql-connector-python-cext.x86_64 8.0.20-1.el7  @mysql-connectors-community
mysql80-community-release.noarch   el7-3
installed

*In another message about "*Unable to upgrade the database*" on the list*:
One person recommended completely removing the database and creating it anew.

So I dropped the CloudStack database and re-created it using the /usr/bin/cloudstack-setup-databases tool:

/usr/bin/cloudstack-setup-databases cloudstack:#########@localhost --deploy-as=root:#########

And, *at least initially*, this seems to have repaired the situation.

I will update the list with my efforts to add a host *once I'm able to install/configure an agent reliably*.

Eric P.
Portland, Oregon

On Fri, Jun 5, 2020 at 5:05 AM Practical XenServer < practicalxenserver@gmail.com> wrote:

> After successfully installing and starting Version 4.14 of the 
> Management server on a *fresh* installation of CentOS-7: The 
> management server halts after accessing the WWW interface for the first time...
>
> 2020-06-05 03:30:20,067 ERROR [c.c.u.d.ScriptRunner] (main:null) 
> (logid:) Error executing: alter table vm_template add size bigint 
> unsigned
> 2020-06-05 03:30:20,068 ERROR [c.c.u.d.ScriptRunner] (main:null) 
> (logid:)
> java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> 2020-06-05 03:30:20,070 ERROR [c.c.u.DatabaseUpgradeChecker] 
> (main:null)
> (logid:) Unable to execute upgrade script
> java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> ...SNIP...
> Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> ...SNIP...
>         ... 50 more
> 2020-06-05 03:30:20,099 DEBUG [c.c.u.d.T.Transaction] (main:null) 
> (logid:) Rolling back the transaction: Time = 35 Name =  Upgrade; 
> called by
> -TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-Trans
> actionLegacy.close:657-DatabaseUpgradeChecker.upgrade:271-DatabaseUpgr
> adeChecker.check:340-CloudStackExtendedLifeCycle.checkIntegrity:65-Clo
> udStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:18
> 2-DefaultLifecycleProcessor.access$200:53-DefaultLifecycleProcessor$Li
> fecycleGroup.start:360-DefaultLifecycleProcessor.startBeans:158-Defaul
> tLifecycleProcessor.onRefresh:122
> 2020-06-05 03:30:20,100 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
> (main:null) (logid:) Exception encountered during context 
> initialization - cancelling refresh attempt:
> org.springframework.context.ApplicationContextException: Failed to 
> start bean 'cloudStackLifeCycle'; nested exception is
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the 
> database
> 2020-06-05 03:30:20,102 WARN  [o.e.j.w.WebAppContext] (main:null) 
> (logid:) Failed startup of context o.e.j.w.WebAppContext@d23e042 
> {/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{
> /usr/share/cloudstack-management/webapp}
> org.springframework.context.ApplicationContextException: Failed to 
> start bean 'cloudStackLifeCycle'; nested exception is
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the 
> database ...SNIP...
> Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> ...SNIP...
>         ... 50 more
> 2020-06-05 03:30:20,099 DEBUG [c.c.u.d.T.Transaction] (main:null) 
> (logid:) Rolling back the transaction: Time = 35 Name =  Upgrade; 
> called by
> -TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-Trans
> actionLegacy.close:657-DatabaseUpgradeChecker.upgrade:271-DatabaseUpgr
> adeChecker.check:340-CloudStackExtendedLifeCycle.checkIntegrity:65-Clo
> udStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:18
> 2-DefaultLifecycleProcessor.access$200:53-DefaultLifecycleProcessor$Li
> fecycleGroup.start:360-DefaultLifecycleProcessor.startBeans:158-Defaul
> tLifecycleProcessor.onRefresh:122
> 2020-06-05 03:30:20,100 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
> (main:null) (logid:) Exception encountered during context 
> initialization - cancelling refresh attempt:
> org.springframework.context.ApplicationContextException: Failed to 
> start bean 'cloudStackLifeCycle'; nested exception is
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the 
> database
> 2020-06-05 03:30:20,102 WARN  [o.e.j.w.WebAppContext] (main:null) 
> (logid:) Failed startup of context o.e.j.w.WebAppContext@d23e042 
> {/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{
> /usr/share/cloudstack-management/webapp}
> org.springframework.context.ApplicationContextException: Failed to 
> start bean 'cloudStackLifeCycle'; nested exception is
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the 
> database
>
> Restarting the service causes *slightly* different error messages in 
> /var/log/cloudstack/management/management-server.log but they're still 
> pretty much the same as the previous (i.e., "Unable to upgrade the
> database"):
>
> 2020-06-05 03:44:44,641 ERROR [c.c.u.d.ScriptRunner] (main:null) 
> (logid:) Error executing: alter table vm_template add size bigint 
> unsigned
> 2020-06-05 03:44:44,642 ERROR [c.c.u.d.ScriptRunner] (main:null) 
> (logid:)
> java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> 2020-06-05 03:44:44,643 ERROR [c.c.u.DatabaseUpgradeChecker] 
> (main:null)
> (logid:) Unable to execute upgrade script
> java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> ...SNIP...
> 2020-06-05 03:44:44,655 ERROR [c.c.u.DatabaseUpgradeChecker] 
> (main:null)
> (logid:) Unable to upgrade the database
> com.cloud.utils.exception.CloudRuntimeException: Unable to execute 
> upgrade script ...SNIP...
> Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> ...SNIP...
>         ... 50 more
> 2020-06-05 03:44:44,669 DEBUG [c.c.u.d.T.Transaction] (main:null) 
> (logid:) Rolling back the transaction: Time = 34 Name =  Upgrade; 
> called by
> -TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-Trans
> actionLegacy.close:657-DatabaseUpgradeChecker.upgrade:271-DatabaseUpgr
> adeChecker.check:340-CloudStackExtendedLifeCycle.checkIntegrity:65-Clo
> udStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:18
> 2-DefaultLifecycleProcessor.access$200:53-DefaultLifecycleProcessor$Li
> fecycleGroup.start:360-DefaultLifecycleProcessor.startBeans:158-Defaul
> tLifecycleProcessor.onRefresh:122
> 2020-06-05 03:44:44,672 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
> (main:null) (logid:) Exception encountered during context 
> initialization - cancelling refresh attempt:
> org.springframework.context.ApplicationContextException: Failed to 
> start bean 'cloudStackLifeCycle'; nested exception is
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the 
> database
> 2020-06-05 03:44:44,674 WARN  [o.e.j.w.WebAppContext] (main:null) 
> (logid:) Failed startup of context o.e.j.w.WebAppContext@d23e042 
> {/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{
> /usr/share/cloudstack-management/webapp}
> org.springframework.context.ApplicationContextException: Failed to 
> start bean 'cloudStackLifeCycle'; nested exception is
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the 
> database ...SNIP...
> Caused by: com.cloud.utils.exception.CloudRuntimeException: Unable to 
> upgrade the database ...SNIP...
>         ... 47 more
> Caused by: com.cloud.utils.exception.CloudRuntimeException: Unable to 
> execute upgrade script ...SNIP...
>         ... 48 more
> Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> ...SNIP...
>         ... 50 more
> 2020-06-05 03:44:44,676 INFO  [o.e.j.s.h.ContextHandler] (main:null)
> (logid:) Started 
> o.e.j.s.h.MovedContextHandler@7ce69770{/,null,AVAILABLE}
> 2020-06-05 03:44:44,693 INFO  [o.e.j.s.AbstractConnector] (main:null)
> (logid:) Started ServerConnector@7ea9e1e2{HTTP/1.1,[http/1.1]}{
> 0.0.0.0:8080}
> 2020-06-05 03:44:44,694 INFO  [o.e.j.s.Server] (main:null) (logid:) 
> Started @6322ms
>
> Meanwhile: The WWW interface has gone from the CloudStack Sign-in Page 
> to...
> HTTP ERROR 503 Service Unavailable
> URI: /client/
> STATUS: 503
> MESSAGE: Service Unavailable
> SERVLET: -
>
> *Using a script:* I've re-installed CentOS twice - *for a total of 
> three
> attempts* - and gotten the same result.
>
> What might be causing this?
>
> TIA,
> Eric Pretorious
> Portland, Oregon
>

Re: cloudstack-management fails: com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the database

Posted by Practical XenServer <pr...@gmail.com>.
*In one about "Unable to upgrade the database" message on the list*:
Someone else had inquired about whether or not mysql-connector-python had
been installed. I found that it was installed as a dependency while
installing the cloudstack-management package...

[root@san-1 ~]# yum list installed | grep 'cloud\|mysql'
cloudstack-common.x86_64           4.14.0.0-1.el7
 @cloudstack
cloudstack-management.x86_64       4.14.0.0-1.el7
 @cloudstack
mysql-connector-python.x86_64      8.0.20-1.el7
 @mysql-connectors-community
mysql-connector-python-cext.x86_64 8.0.20-1.el7
 @mysql-connectors-community
mysql80-community-release.noarch   el7-3
installed

*In another message about "*Unable to upgrade the database*" on the list*:
One person recommended completely removing the database and creating it
anew.

So I dropped the CloudStack database and re-created it using the
/usr/bin/cloudstack-setup-databases tool:

/usr/bin/cloudstack-setup-databases cloudstack:#########@localhost
--deploy-as=root:#########

And, *at least initially*, this seems to have repaired the situation.

I will update the list with my efforts to add a host *once I'm able to
install/configure an agent reliably*.

Eric P.
Portland, Oregon

On Fri, Jun 5, 2020 at 5:05 AM Practical XenServer <
practicalxenserver@gmail.com> wrote:

> After successfully installing and starting Version 4.14 of the Management
> server on a *fresh* installation of CentOS-7: The management server halts
> after accessing the WWW interface for the first time...
>
> 2020-06-05 03:30:20,067 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
> Error executing: alter table vm_template add size bigint unsigned
> 2020-06-05 03:30:20,068 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
> java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> 2020-06-05 03:30:20,070 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null)
> (logid:) Unable to execute upgrade script
> java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> ...SNIP...
> Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> ...SNIP...
>         ... 50 more
> 2020-06-05 03:30:20,099 DEBUG [c.c.u.d.T.Transaction] (main:null) (logid:)
> Rolling back the transaction: Time = 35 Name =  Upgrade; called by
> -TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-TransactionLegacy.close:657-DatabaseUpgradeChecker.upgrade:271-DatabaseUpgradeChecker.check:340-CloudStackExtendedLifeCycle.checkIntegrity:65-CloudStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:182-DefaultLifecycleProcessor.access$200:53-DefaultLifecycleProcessor$LifecycleGroup.start:360-DefaultLifecycleProcessor.startBeans:158-DefaultLifecycleProcessor.onRefresh:122
> 2020-06-05 03:30:20,100 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
> (main:null) (logid:) Exception encountered during context initialization -
> cancelling refresh attempt:
> org.springframework.context.ApplicationContextException: Failed to start
> bean 'cloudStackLifeCycle'; nested exception is
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
> database
> 2020-06-05 03:30:20,102 WARN  [o.e.j.w.WebAppContext] (main:null) (logid:)
> Failed startup of context o.e.j.w.WebAppContext@d23e042
> {/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{/usr/share/cloudstack-management/webapp}
> org.springframework.context.ApplicationContextException: Failed to start
> bean 'cloudStackLifeCycle'; nested exception is
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
> database
> ...SNIP...
> Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> ...SNIP...
>         ... 50 more
> 2020-06-05 03:30:20,099 DEBUG [c.c.u.d.T.Transaction] (main:null) (logid:)
> Rolling back the transaction: Time = 35 Name =  Upgrade; called by
> -TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-TransactionLegacy.close:657-DatabaseUpgradeChecker.upgrade:271-DatabaseUpgradeChecker.check:340-CloudStackExtendedLifeCycle.checkIntegrity:65-CloudStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:182-DefaultLifecycleProcessor.access$200:53-DefaultLifecycleProcessor$LifecycleGroup.start:360-DefaultLifecycleProcessor.startBeans:158-DefaultLifecycleProcessor.onRefresh:122
> 2020-06-05 03:30:20,100 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
> (main:null) (logid:) Exception encountered during context initialization -
> cancelling refresh attempt:
> org.springframework.context.ApplicationContextException: Failed to start
> bean 'cloudStackLifeCycle'; nested exception is
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
> database
> 2020-06-05 03:30:20,102 WARN  [o.e.j.w.WebAppContext] (main:null) (logid:)
> Failed startup of context o.e.j.w.WebAppContext@d23e042
> {/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{/usr/share/cloudstack-management/webapp}
> org.springframework.context.ApplicationContextException: Failed to start
> bean 'cloudStackLifeCycle'; nested exception is
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
> database
>
> Restarting the service causes *slightly* different error messages in
> /var/log/cloudstack/management/management-server.log but they're still
> pretty much the same as the previous (i.e., "Unable to upgrade the
> database"):
>
> 2020-06-05 03:44:44,641 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
> Error executing: alter table vm_template add size bigint unsigned
> 2020-06-05 03:44:44,642 ERROR [c.c.u.d.ScriptRunner] (main:null) (logid:)
> java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> 2020-06-05 03:44:44,643 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null)
> (logid:) Unable to execute upgrade script
> java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> ...SNIP...
> 2020-06-05 03:44:44,655 ERROR [c.c.u.DatabaseUpgradeChecker] (main:null)
> (logid:) Unable to upgrade the database
> com.cloud.utils.exception.CloudRuntimeException: Unable to execute upgrade
> script
> ...SNIP...
> Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> ...SNIP...
>         ... 50 more
> 2020-06-05 03:44:44,669 DEBUG [c.c.u.d.T.Transaction] (main:null) (logid:)
> Rolling back the transaction: Time = 34 Name =  Upgrade; called by
> -TransactionLegacy.rollback:890-TransactionLegacy.removeUpTo:833-TransactionLegacy.close:657-DatabaseUpgradeChecker.upgrade:271-DatabaseUpgradeChecker.check:340-CloudStackExtendedLifeCycle.checkIntegrity:65-CloudStackExtendedLifeCycle.start:55-DefaultLifecycleProcessor.doStart:182-DefaultLifecycleProcessor.access$200:53-DefaultLifecycleProcessor$LifecycleGroup.start:360-DefaultLifecycleProcessor.startBeans:158-DefaultLifecycleProcessor.onRefresh:122
> 2020-06-05 03:44:44,672 WARN  [o.a.c.s.m.c.ResourceApplicationContext]
> (main:null) (logid:) Exception encountered during context initialization -
> cancelling refresh attempt:
> org.springframework.context.ApplicationContextException: Failed to start
> bean 'cloudStackLifeCycle'; nested exception is
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
> database
> 2020-06-05 03:44:44,674 WARN  [o.e.j.w.WebAppContext] (main:null) (logid:)
> Failed startup of context o.e.j.w.WebAppContext@d23e042
> {/client,file:///usr/share/cloudstack-management/webapp/,UNAVAILABLE}{/usr/share/cloudstack-management/webapp}
> org.springframework.context.ApplicationContextException: Failed to start
> bean 'cloudStackLifeCycle'; nested exception is
> com.cloud.utils.exception.CloudRuntimeException: Unable to upgrade the
> database
> ...SNIP...
> Caused by: com.cloud.utils.exception.CloudRuntimeException: Unable to
> upgrade the database
> ...SNIP...
>         ... 47 more
> Caused by: com.cloud.utils.exception.CloudRuntimeException: Unable to
> execute upgrade script
> ...SNIP...
>         ... 48 more
> Caused by: java.sql.SQLSyntaxErrorException: Duplicate column name 'size'
> ...SNIP...
>         ... 50 more
> 2020-06-05 03:44:44,676 INFO  [o.e.j.s.h.ContextHandler] (main:null)
> (logid:) Started o.e.j.s.h.MovedContextHandler@7ce69770{/,null,AVAILABLE}
> 2020-06-05 03:44:44,693 INFO  [o.e.j.s.AbstractConnector] (main:null)
> (logid:) Started ServerConnector@7ea9e1e2{HTTP/1.1,[http/1.1]}{
> 0.0.0.0:8080}
> 2020-06-05 03:44:44,694 INFO  [o.e.j.s.Server] (main:null) (logid:)
> Started @6322ms
>
> Meanwhile: The WWW interface has gone from the CloudStack Sign-in Page
> to...
> HTTP ERROR 503 Service Unavailable
> URI: /client/
> STATUS: 503
> MESSAGE: Service Unavailable
> SERVLET: -
>
> *Using a script:* I've re-installed CentOS twice - *for a total of three
> attempts* - and gotten the same result.
>
> What might be causing this?
>
> TIA,
> Eric Pretorious
> Portland, Oregon
>