1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[openstack|compute] Assert Timezone to UTC and fix format for OS on get_usage

Signed-off-by: Nelvin Driz <nelvindriz@live.com>
This commit is contained in:
Nelvin Driz 2012-05-28 18:13:00 +08:00
parent e82ad1631f
commit 6a2c9dafe7

View file

@ -5,8 +5,8 @@ module Fog
def get_usage(tenant_id, date_start, date_end) def get_usage(tenant_id, date_start, date_end)
params = Hash.new params = Hash.new
params[:start] = date_start.iso8601.gsub(/\+.*/, '') params[:start] = date_start.utc.iso8601.chop!
params[:end] = date_end.iso8601.gsub(/\+.*/, '') params[:end] = date_end.utc.iso8601.chop!
request( request(
:expects => [200, 203], :expects => [200, 203],
:method => 'GET', :method => 'GET',
@ -22,27 +22,27 @@ module Fog
response = Excon::Response.new response = Excon::Response.new
response.status = 200 response.status = 200
response.body = {"tenant_usage"=> response.body = {"tenant_usage"=>
{"total_memory_mb_usage" => 0.0, {"total_memory_mb_usage" => 0.0,
"total_vcpus_usage" => 0.0, "total_vcpus_usage" => 0.0,
"total_hours" => 0.0, "total_hours" => 0.0,
"tenant_id" => tenant_id, "tenant_id" => tenant_id,
"stop" => date_start, "stop" => date_start,
"start" => date_end, "start" => date_end,
"total_local_gb_usage" => 0.0, "total_local_gb_usage" => 0.0,
"server_usages" =>[{ "server_usages" =>[{
"hours" => 0.0, "hours" => 0.0,
"uptime" => 69180, "uptime" => 69180,
"local_gb" => 0, "local_gb" => 0,
"ended_at" => nil, "ended_at" => nil,
"name" => "test server", "name" => "test server",
"tenant_id" => tenant_id, "tenant_id" => tenant_id,
"vcpus" => 1, "vcpus" => 1,
"memory_mb" => 512, "memory_mb" => 512,
"state" => "active", "state" => "active",
"flavor" => "m1.tiny", "flavor" => "m1.tiny",
"started_at" => "2012-03-05 09:11:44" "started_at" => "2012-03-05 09:11:44"
} }
] ]
} }
} }
response response