summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryanheven <yanheven@gmail.com>2015-01-29 10:18:09 +0800
committerMatt Riedemann <mriedem@us.ibm.com>2015-05-28 20:57:42 +0000
commit0f82c4376f6e6f3db02b3acd1eeb136d844ea87d (patch)
tree80fc67a5ca0184c8a35f47ff51f6d152bb918e81
parent7eee9fc8ac2ee1f3ed4cb6390875087737378c19 (diff)
downloadceilometer-0f82c4376f6e6f3db02b3acd1eeb136d844ea87d.tar.gz
fix the value of query_spec.maxSample to advoid to be zero
code before: VC_REAL_TIME_SAMPLING_INTERVAL = 20 samples_cnt = (int(duration / VC_REAL_TIME_SAMPLING_INTERVAL) if duration else 1) query_spec.maxSample = samples_cnt if we set the value of "interval" in /etc/ceilometer/pipline.yaml to less than 20,the value of "query_spec.maxSample" will be 0,which will cause problem when use it to send request to vsphere server Change-Id: Ibdb586109fe5334f3080539a40ff92badead837b Closes-Bug:#1415307 (cherry picked from commit 53fe9976cc48c3c301b74044bae6c23b8dbb1d63)
-rw-r--r--ceilometer/compute/virt/vmware/vsphere_operations.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/ceilometer/compute/virt/vmware/vsphere_operations.py b/ceilometer/compute/virt/vmware/vsphere_operations.py
index 2531e1af..ed5c2e02 100644
--- a/ceilometer/compute/virt/vmware/vsphere_operations.py
+++ b/ceilometer/compute/virt/vmware/vsphere_operations.py
@@ -206,7 +206,8 @@ class VsphereOperations(object):
query_spec.intervalId = VC_REAL_TIME_SAMPLING_INTERVAL
# We query all samples which are applicable over the specified duration
samples_cnt = (int(duration / VC_REAL_TIME_SAMPLING_INTERVAL)
- if duration else 1)
+ if duration and
+ duration >= VC_REAL_TIME_SAMPLING_INTERVAL else 1)
query_spec.maxSample = samples_cnt
perf_manager = session.vim.service_content.perfManager