Skip to content

Commit 181aa81

Browse files
committed
Use correct server's start time
When a machine is resized, rescued or evacuated the server's start_time (and the usages' start_time) is reset and it does not reflect anymore the time the instance was created. Instead of relying on that time, we move to use the server.created time. This solves the issue of negative accounting times, that happen when an instance has its start_time reset. Fixes #56
1 parent 6f68e12 commit 181aa81

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

caso/extract/nova.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def extract_for_project(self, project, extract_from, extract_to):
198198
records[instance_id].disk = usage["local_gb"]
199199

200200
# Start time must be the time when the machine was created
201-
started = dateutil.parser.parse(usage["started_at"])
201+
started = server_start
202202
records[instance_id].start_time = int(started.strftime("%s"))
203203

204204
# End time must ben the time when the machine was ended, but it may

0 commit comments

Comments
 (0)