role_id in account table shouldn't be null. If the upgrade was
successful, it should have updated it with proper mapping from
account type. (check the db upgrade log for any exceptions)

I suggest you do the update manually following the logic at
https://github.com/apache/cloudstack/blob/4.9/engine/schema/src/com/cloud/upgrade/dao/Upgrade481to490.java#L68-L92

Also check that roles and role_permissions tables have the
required data.

~ Rajani
http://cloudplatform.accelerite.com/

On August 16, 2016 at 7:10 PM, Stephan Seitz
(s.se...@secretresearchfacility.com) wrote:
Hi!

We've recently noticed cloudstack-usage is no longer able to
write
usage data into mysql. I assume this happened after updateing to
4.8.0.1 or 4.9 - we missed that error in our testsetup...

Here's the usage.log: http://pastebin.com/Zpvnw4xX

Finally it fails with following message:

ERROR [usage.dao.UsageDaoImpl] (Usage-Job-1:null) (logid:) error
saving
account to cloud_usage db

I've checked the changes between 4.8 and 4.9

https://fossies.org/diffs/apache-cloudstack/4.8.0.1-src_vs_4.9.0-src/en
gine/schema/src/com/cloud/usage/dao/UsageDaoImpl.java-diff.html

cloud_usage.account now shows role_id, but that table looks good
to me:

mysql> show create table account \G
*************************** 1. row ***************************
Table: account
Create Table: CREATE TABLE `account` (
`id` bigint(20) unsigned NOT NULL,
`account_name` varchar(100) DEFAULT NULL COMMENT 'an account
name set
by the creator of the account, defaults to username for single
accounts',
`uuid` varchar(40) DEFAULT NULL,
`type` int(1) unsigned NOT NULL,
`role_id` bigint(20) unsigned DEFAULT NULL,
`domain_id` bigint(20) unsigned DEFAULT NULL,
`state` varchar(10) NOT NULL DEFAULT 'enabled',
`removed` datetime DEFAULT NULL COMMENT 'date removed',
`cleanup_needed` tinyint(1) NOT NULL DEFAULT '0',
`network_domain` varchar(100) DEFAULT NULL COMMENT 'Network
domain
name of the Vms of the account',
`default_zone_id` bigint(20) unsigned DEFAULT NULL,
`default` int(1) unsigned NOT NULL DEFAULT '0' COMMENT '1 if
account
is default',
PRIMARY KEY (`id`),
UNIQUE KEY `uc_account__uuid` (`uuid`),
KEY `i_account__removed` (`removed`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec)

Having a look at that data, I'm a bit confused since uuid,
network_domain and default_zone_id are NULL for every account.

As an example:

mysql> select * from account limit 1 \G
*************************** 1. row ***************************
id: 1
account_name: system
uuid: NULL
type: 1
role_id: NULL
domain_id: 1
state: enabled
removed: NULL
cleanup_needed: 0
network_domain: NULL
default_zone_id: NULL
default: 0
1 row in set (0.00 sec)

I've already looked at plain SQL statements logged by the mysqld,
but
that's really messy and grepping for INSERT/UPDATE queries
defined in
UsageDaoImpl didn't show anything. Finally grepping for
'statistics' in
the raw sql-log doesn't result a line.

Could someone please shed some light how I could get the usage
service
collecting and reporting data again?

Thanks in advance!

cheers,

- Stephan

Reply via email to