Transform sample_cnt type to int

Duration is seconds from current time, and sample_cnt on
the basis of duration. So sample_cnt always not a int, but
we need sample_cnt as a int type.

Closes-Bug:#1330330

Change-Id: I89e1768523384e24c3a0b8b76f4fa04a123248f9
This commit is contained in:
sh.huang 2014-06-17 08:37:36 +08:00
parent 303a1ce704
commit 2866266a54

View File

@ -204,8 +204,8 @@ class VsphereOperations(object):
query_spec.metricId = [metric_id]
query_spec.intervalId = VC_REAL_TIME_SAMPLING_INTERVAL
# We query all samples which are applicable over the specified duration
samples_cnt = (duration / VC_REAL_TIME_SAMPLING_INTERVAL if duration
else 1)
samples_cnt = (int(duration / VC_REAL_TIME_SAMPLING_INTERVAL)
if duration else 1)
query_spec.maxSample = samples_cnt
perf_manager = session.vim.service_content.perfManager