hello,
there are two problems.please help me.
*********************************************************************************
the first problem, something with the datetime in table usage_vm_instance。
i noticed that the datetime in usage_vm_instance is wrong。i think maybe there
is a timezone problem。
the status 1:
mysql> select * from usage_vm_instance where vm_instance_id=76;
+------------+---------+------------+----------------+---------+---------------------+-------------+-----------------+---------------------+----------+
| usage_type | zone_id | account_id | vm_instance_id | vm_name |
service_offering_id | template_id | hypervisor_type | start_date |
end_date |
+------------+---------+------------+----------------+---------+---------------------+-------------+-----------------+---------------------+----------+
| 1 | 1 | 2 | 76 | abc2 |
1 | 225 | VMware | 2012-10-31 03:43:04 | NULL |
| 2 | 1 | 2 | 76 | abc2 |
1 | 225 | VMware | 2012-10-31 03:41:09 | NULL |
+------------+---------+------------+----------------+---------+---------------------+-------------+-----------------+---------------------+----------+
2 rows in set (0.00 sec)
then,i stopped this vm in 2012-11-01 15:00(maybe in 14:40--15:20,i forgot the
actual time )。And start it 5 minutes later。
the status 2:
mysql> select * from usage_vm_instance where vm_instance_id=85;
+------------+---------+------------+----------------+---------+---------------------+-------------+-----------------+---------------------
+---------------------+
| usage_type | zone_id | account_id | vm_instance_id | vm_name |
service_offering_id | template_id | hypervisor_type | start_date |
end_date
|
+------------+---------+------------+----------------+---------+---------------------+-------------+-----------------+---------------------
+---------------------+
| 1 | 1 | 2 | 85 | lin1 |
1 | 230 | VMware | 2012-10-31 09:04:03 | 2012-11-01
07:44:34 |
| 1 | 1 | 2 | 85 | lin1 |
1 | 230 | VMware | 2012-11-01 07:50:49 | NULL
|
| 2 | 1 | 2 | 85 | lin1 |
1 | 230 | VMware | 2012-10-31 09:02:14 | NULL
|
+------------+---------+------------+----------------+---------+---------------------+-------------+-----------------+---------------------
+---------------------+
3 rows in set (0.00 sec)
The end_date in line1 and the start_date in line2 is 2012-11-01
07:xx:xx。these two time is wrong。please help me where is the problem。
i provide you some things to analyse this。if there is something wrong with
usage_server or mysql?
(1)timezone in mysql and system:
mysql> show global variables like '%time_zone%';
+------------------+--------+
| Variable_name | Value |
+------------------+--------+
| system_time_zone | CST |
| time_zone | SYSTEM |
+------------------+--------+
2 rows in set (0.00 sec)
[root@cloudmanager ~]# date
Thu Nov 1 17:20:54 CST 2012
(2)i did a test
mysql> desc shijian;
+-------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| sj | datetime | YES | | NULL | |
+-------+----------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql> delete from shijian;
Query OK, 2 rows affected (0.00 sec)
mysql> insert into shijian values(1,now());
Query OK, 1 row affected (0.00 sec)
mysql> select * from shijian;
+------+---------------------+
| id | sj |
+------+---------------------+
| 1 | 2012-11-01 17:22:40 |
+------+---------------------+
1 row in set (0.00 sec)
[root@cloudmanager ~]# date
Thu Nov 1 17:23:03 CST 2012
the datetime in table shijian is right。but the datetime in table
usage_vm_instance is wrong。
(3)the global settings in cloudstack
usage.aggregation.timezone Asia/Shanghai
usage.execution.timezone Asia/Shanghai
usage.stats.job.aggregation.range 60
usage.stats.job.exec.time 11:22
expunge.delay 3600
expunge.interval 3600
*********************************************************************************
the second problem
i knew the variable expunge.delay and expunge.interval。and i knew the
diference between usage_type=1 and usage_type=2。but i don't know the end_date
in usage_vm_instance。
(1)the time i click button destroy。(in that time,the vm is not destroyed
because expunge.delay)。
(2)some secondes later(expunge.delay),in that time the vm is actually
destroyed。
the end_date is (1) or (2)?
thanks。