ConfigurationServerImpl will insert missing records to resource_count table at management server startup. It is strange you meet some issues others do not meet.
2013/10/2 Indra Pramana <in...@sg.or.id> > Dear Animesh, Sanjay and all, > > Latest test that I and Abhinav done earlier this morning: > > - Abhinav tested upgrade from 4.1.1 to 4.2.0 on his lab and he noticed that > the additional resource_count types (total 4 of them: cpu, memory, > primary_storage and secondary_storage) were added automatically during DB > schema upgrade. > > Excerpts from his management-server.log file: > > ==== > 2013-10-01 23:56:46,318 DEBUG [cloud.server.ConfigurationServerImpl] > (Timer-2:null) resource_count table has records missing for some > domains...going to insert them > 2013-10-01 23:56:46,339 DEBUG [cloud.server.ConfigurationServerImpl] > (Timer-2:null) Inserting resource count of type cpu for domain id=1 > 2013-10-01 23:56:46,341 DEBUG [cloud.server.ConfigurationServerImpl] > (Timer-2:null) Inserting resource count of type memory for domain id=1 > 2013-10-01 23:56:46,349 DEBUG [cloud.server.ConfigurationServerImpl] > (Timer-2:null) Inserting resource count of type primary_storage for domain > id=1 > 2013-10-01 23:56:46,351 DEBUG [cloud.server.ConfigurationServerImpl] > (Timer-2:null) Inserting resource count of type secondary_storage for > domain id=1 > 2013-10-01 23:56:46,362 DEBUG [cloud.server.ConfigurationServerImpl] > (Timer-2:null) resource_count table has records missing for some > accounts...going to insert them > 2013-10-01 23:56:46,372 DEBUG [cloud.server.ConfigurationServerImpl] > (Timer-2:null) Inserting resource count of type cpu for account id=1 > 2013-10-01 23:56:46,379 DEBUG [cloud.server.ConfigurationServerImpl] > (Timer-2:null) Inserting resource count of type memory for account id=1 > 2013-10-01 23:56:46,381 DEBUG [cloud.server.ConfigurationServerImpl] > (Timer-2:null) Inserting resource count of type primary_storage for account > id=1 > 2013-10-01 23:56:46,388 DEBUG [cloud.server.ConfigurationServerImpl] > (Timer-2:null) Inserting resource count of type secondary_storage for > account id=1 > 2013-10-01 23:56:46,418 DEBUG [cloud.server.ConfigurationServerImpl] > (Timer-2:null) Inserting resource count of type cpu for account id=2 > 2013-10-01 23:56:46,420 DEBUG [cloud.server.ConfigurationServerImpl] > (Timer-2:null) Inserting resource count of type memory for account id=2 > 2013-10-01 23:56:46,428 DEBUG [cloud.server.ConfigurationServerImpl] > (Timer-2:null) Inserting resource count of type primary_storage for account > id=2 > 2013-10-01 23:56:46,429 DEBUG [cloud.server.ConfigurationServerImpl] > (Timer-2:null) Inserting resource count of type secondary_storage for > account id=2 > 2013-10-01 23:56:46,439 INFO [cloud.server.ConfigurationServerImpl] > (Timer-2:null) Processing updateSSLKeyStore > 2013-10-01 23:56:46,499 INFO [cloud.server.ConfigurationServerImpl] > (Timer-2:null) SSL keystore located at > /etc/cloudstack/management/cloud.keystore > ==== > > However, I didn't have the above during the DB schema upgrade. > > May I know which process triggers the above situation and leads to the > additional records to be inserted? Tried to go through the > /usr/share/cloudstack-management/setup/db/schema-410to420.sql script and > cannot find the above. > > Any reason why my upgrade didn't trigger the insertion of the additional > records? > > Urgently looking forward to your reply, thank you. > > Cheers. > > > > > On Wed, Oct 2, 2013 at 3:43 AM, Animesh Chaturvedi < > animesh.chaturv...@citrix.com> wrote: > > > Copying Sanjay > > > > Animesh > > > > > -----Original Message----- > > > From: Indra Pramana [mailto:in...@sg.or.id] > > > Sent: Tuesday, October 01, 2013 11:06 AM > > > To: dev@cloudstack.apache.org; us...@cloudstack.apache.org > > > Subject: Re: Unable to create instance after upgrading to CloudStack > > > 4.2.0 > > > > > > Dear all, > > > > > > Further investigation reveals that there might be some issues with the > > > schema upgrade. When we check the resource_count table for the account > > > ID: > > > > > > mysql> select * from resource_count where account_id=2; > > > +----+------------+-----------+-----------+-------+ > > > | id | account_id | domain_id | type | count | > > > +----+------------+-----------+-----------+-------+ > > > | 17 | 2 | NULL | user_vm | 30 | > > > | 18 | 2 | NULL | public_ip | 4 | > > > | 19 | 2 | NULL | volume | 40 | > > > | 20 | 2 | NULL | snapshot | 1 | > > > | 21 | 2 | NULL | template | 40 | > > > | 22 | 2 | NULL | project | 0 | > > > | 23 | 2 | NULL | network | 2 | > > > | 24 | 2 | NULL | vpc | 0 | > > > +----+------------+-----------+-----------+-------+ > > > > > > There's no 'primary_storage' type there. In comparison, Abhinav's > > > database contains the details: > > > > > > mysql> SELECT * FROM cloud.resource_count where account_id=2; > > > +----+------------+-----------+-------------------+-------------+ > > > | id | account_id | domain_id | type | count | > > > +----+------------+-----------+-------------------+-------------+ > > > | 17 | 2 | NULL | user_vm | 4 | > > > | 18 | 2 | NULL | public_ip | 1 | > > > | 19 | 2 | NULL | volume | 3 | > > > | 20 | 2 | NULL | snapshot | 3 | > > > | 21 | 2 | NULL | template | 1 | > > > | 22 | 2 | NULL | project | 0 | > > > | 23 | 2 | NULL | network | 2 | > > > | 24 | 2 | NULL | vpc | 1 | > > > | 33 | 2 | NULL | cpu | 2 | > > > | 34 | 2 | NULL | memory | 1536 | > > > | 35 | 2 | NULL | primary_storage | 8589934592 | > > > | 36 | 2 | NULL | secondary_storage | 27866955776 | > > > +----+------------+-----------+-------------------+-------------+ > > > > > > These types are missing from my resource_count table for each of the > > > accounts: > > > > > > | 33 | 2 | NULL | cpu | 2 | > > > | 34 | 2 | NULL | memory | 1536 | > > > | 35 | 2 | NULL | primary_storage | 8589934592 | > > > | 36 | 2 | NULL | secondary_storage | 27866955776 | > > > > > > I tried to re-do the schema upgrade manually pertaining to that > > > particular table, which is part of this section under: > > > > > > /usr/share/cloudstack-management/setup/db/schema-410to420.sql > > > > > > DROP VIEW IF EXISTS `cloud`.`account_view`; CREATE VIEW > > > `cloud`.`account_view` AS > > > > > > But I am still not able to get the four types (cpu, memory, > > > primary_storage, secondary_storage) to appear on my resource_count > > > table. > > > > > > Anyone can help? This is my third attempt to upgrade to 4.2.0 and I > > > don't want to revert back again now. > > > > > > Looking forward to your reply, thank you. > > > > > > Cheers. > > > > > > > > > > > > On Wed, Oct 2, 2013 at 12:49 AM, Indra Pramana <in...@sg.or.id> wrote: > > > > > > > Dear all, > > > > > > > > I am having problems of unable to create new instances after > upgrading > > > > to 4.2.0. The error message is: > > > > > > > > Failed to increment resource count of type primary_storage for > account > > > > id=2 > > > > > > > > Excerpt from management-server.log: > > > > > > > > ==== > > > > 2013-10-02 00:40:57,770 DEBUG [cloud.api.ApiServlet] > > > > (catalina-exec-15:null) ===START=== -- GET > > > > > command=queryAsyncJobResult&jobId=183063da-fb08-425b-8057-157e33320674 > > > > > &response=json&sessionkey=VEyky3f1rsQVfLVs9pGg2sXh60o%3D&_=13806456467 > > > > 39 > > > > 2013-10-02 00:40:57,785 DEBUG [cloud.api.ApiDispatcher] > > > > (catalina-exec-16:null) InfrastructureEntity name > > > > is:com.cloud.offering.ServiceOffering > > > > 2013-10-02 00:40:57,791 DEBUG [cloud.api.ApiDispatcher] > > > > (catalina-exec-16:null) ControlledEntity name > > > > is:com.cloud.template.VirtualMachineTemplate > > > > 2013-10-02 00:40:57,795 DEBUG [cloud.api.ApiDispatcher] > > > > (catalina-exec-16:null) ControlledEntity name > > > > is:com.cloud.network.Network > > > > 2013-10-02 00:40:57,798 DEBUG [cloud.api.ApiDispatcher] > > > > (catalina-exec-16:null) InfrastructureEntity name > > > > is:com.cloud.offering.DiskOffering > > > > 2013-10-02 00:40:57,813 DEBUG [cloud.network.NetworkModelImpl] > > > > (catalina-exec-16:null) Service SecurityGroup is not supported in the > > > > network id=238 > > > > 2013-10-02 00:40:57,828 DEBUG [cloud.api.ApiServlet] > > > > (catalina-exec-15:null) ===END=== -- GET > > > > > command=queryAsyncJobResult&jobId=183063da-fb08-425b-8057-157e33320674 > > > > > &response=json&sessionkey=VEyky3f1rsQVfLVs9pGg2sXh60o%3D&_=13806456467 > > > > 39 > > > > 2013-10-02 00:40:57,867 DEBUG [cloud.vm.UserVmManagerImpl] > > > > (catalina-exec-16:null) Allocating in the DB for vm > > > > 2013-10-02 00:40:57,887 DEBUG [cloud.vm.VirtualMachineManagerImpl] > > > > (catalina-exec-16:null) Allocating entries for VM: > > > > VM[User|Test-Upgrade-420] > > > > 2013-10-02 00:40:57,888 DEBUG [cloud.vm.VirtualMachineManagerImpl] > > > > (catalina-exec-16:null) Allocating nics for VM[User|Test-Upgrade-420] > > > > 2013-10-02 00:40:57,889 DEBUG [cloud.network.NetworkManagerImpl] > > > > (catalina-exec-16:null) Allocating nic for vm > > > > VM[User|Test-Upgrade-420] in network Ntwk[238|Guest|7] with requested > > > > profile NicProfile[0-0-null-null-null > > > > 2013-10-02 00:40:57,909 DEBUG [cloud.network.NetworkModelImpl] > > > > (catalina-exec-16:null) Service SecurityGroup is not supported in the > > > > network id=238 > > > > 2013-10-02 00:40:57,911 DEBUG [cloud.vm.VirtualMachineManagerImpl] > > > > (catalina-exec-16:null) Allocating disks for > VM[User|Test-Upgrade-420] > > > > 2013-10-02 00:40:57,930 ERROR > > > > [cloud.resourcelimit.ResourceLimitManagerImpl] > (catalina-exec-16:null) > > > > Failed to update resource count for account id=2 > > > > 2013-10-02 00:40:57,931 DEBUG [db.Transaction.Transaction] > > > > (catalina-exec-16:null) Rolling back the transaction: Time = 74 Name > = > > > > createVirtualMachine; called by > > > > > -Transaction.rollback:898-Transaction.removeUpTo:841-Transaction.close > > > > > :665-TransactionContextBuilder.interceptComplete:56-ComponentInstantia > > > > > tionPostProcessor$InterceptorDispatcher.intercept:131-ResourceLimitMan > > > > > agerImpl.incrementResourceCount:238-VolumeManagerImpl.allocateTemplate > > > > > dVolume:1477-VirtualMachineManagerImpl.allocate:386-ComponentInstantia > > > > > tionPostProcessor$InterceptorDispatcher.intercept:125-CloudOrchestrato > > > > > r.createVirtualMachine:214-UserVmManagerImpl.createVirtualMachine:2867 > > > > > -ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept:1 > > > > 25 > > > > 2013-10-02 00:40:57,978 ERROR [cloud.api.ApiServer] > > > > (catalina-exec-16:null) unhandled exception executing api command: > > > > deployVirtualMachine > > > > com.cloud.utils.exception.CloudRuntimeException: Failed to increment > > > > resource count of type primary_storage for account id=2 ==== > > > > > > > > Looking forward to your reply, thank you. > > > > > > > > Cheers. > > > > > > >