Support VMware hypervisor inspector

1. If the compute driver is vmwareapi.VMwareESXDriver or
vmwareapi.VMwareVCDriver, set the hypervisor_inspector to vsphere and
add vmware section in conf file.
2. Reuse the vmware related attribute from compute cookbooks since
ceilometer need monitor the same vsphere.
3. Update the testcases

Closes-Bug: #1351619
Change-Id: Ie67e84e5695bd5f9ceaa6ed6682cfe33f7ed0b68
This commit is contained in:
gengjh 2014-08-02 22:44:59 +08:00
parent c9f8ffd4da
commit 4529146a83
8 changed files with 42 additions and 2 deletions

View File

@ -2,6 +2,9 @@ openstack-telemetry Cookbook CHANGELG
==============================
This file is used to list changes made in each version of the openstack-metering cookbook.
## 10.0.1
* Support vmware hypervisor
## 10.0.0
* Upgrading to Juno

View File

@ -97,6 +97,7 @@ License and Author
| **Author** | Ionut Artarisi (<iartarisi@suse.cz>) |
| **Author** | Eric Zhou (<zyouzhou@cn.ibm.com>) |
| **Author** | Chen Zhiwei (<zhiwchen@cn.ibm.com>) |
| **Author** | David Geng (<gengjh@cn.ibm.com>) |
| | |
| **Copyright** | Copyright (c) 2013, Opscode, Inc. |
| **Copyright** | Copyright (c) 2013, AT&T Services, Inc. |

View File

@ -47,6 +47,8 @@ default['openstack']['telemetry']['sample_source'] = 'openstack'
case node['openstack']['compute']['driver']
when 'libvirt.LibvirtDriver'
default['openstack']['telemetry']['hypervisor_inspector'] = 'libvirt'
when 'vmwareapi.VMwareESXDriver', 'vmwareapi.VMwareVCDriver'
default['openstack']['telemetry']['hypervisor_inspector'] = 'vsphere'
else
default['openstack']['telemetry']['hypervisor_inspector'] = nil
end

View File

@ -4,7 +4,7 @@ maintainer_email 'cookbooks@lists.tfoundry.com'
license 'Apache 2.0'
description 'The OpenStack Metering service Ceilometer.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '10.0.0'
version '10.0.1'
recipe 'openstack-telemetry::agent-central', 'Installs agent central service.'
recipe 'openstack-telemetry::agent-compute', 'Installs agent compute service.'

View File

@ -81,6 +81,10 @@ directory node['openstack']['telemetry']['conf_dir'] do
action :create
end
if node['openstack']['telemetry']['hypervisor_inspector'] == 'vsphere'
vmware_host_pass = get_secret node['openstack']['compute']['vmware']['secret_name']
end
template node['openstack']['telemetry']['conf'] do
source 'ceilometer.conf.erb'
owner node['openstack']['telemetry']['user']
@ -100,6 +104,7 @@ template node['openstack']['telemetry']['conf'] do
service_user: service_user,
metering_secret: metering_secret,
api_bind_host: telemetry_api_bind.host,
api_bind_port: telemetry_api_bind.port
api_bind_port: telemetry_api_bind.port,
vmware_host_pass: vmware_host_pass
)
end

View File

@ -195,6 +195,20 @@ describe 'openstack-telemetry::common' do
expect(chef_run).to render_file(file.name).with_content(
/^port = 9999$/)
end
it 'has vmware section' do
node.set['openstack']['compute']['driver'] = 'vmwareapi.VMwareVCDriver'
[
/^host_ip = $/,
/^host_username = $/,
/^host_password = vmware_secret_name$/,
/^task_poll_interval = 0.5$/,
/^api_retry_count = 10$/
].each do |line|
expect(chef_run).to render_file(file.name).with_content(line)
end
end
end
end
end

View File

@ -41,6 +41,9 @@ shared_context 'telemetry-stubs' do
Chef::Recipe.any_instance.stub(:get_secret)
.with('openstack_metering_secret')
.and_return('metering_secret')
Chef::Recipe.any_instance.stub(:get_secret)
.with('openstack_vmware_secret_name')
.and_return 'vmware_secret_name'
Chef::Application.stub(:fatal!)
end
end

View File

@ -77,3 +77,15 @@ signing_dir = <%= node["openstack"]["telemetry"]["api"]["auth"]["cache_dir"] %>
[publisher_rpc]
metering_secret = <%= @metering_secret %>
<% if node["openstack"]["telemetry"]["hypervisor_inspector"] == 'vsphere'%>
[vmware]
host_ip = <%= node['openstack']['compute']['vmware']['host_ip'] %>
host_username = <%= node['openstack']['compute']['vmware']['host_username'] %>
host_password = <%= @vmware_host_pass %>
task_poll_interval = <%= node['openstack']['compute']['vmware']['task_poll_interval'] %>
api_retry_count = <%= node['openstack']['compute']['vmware']['api_retry_count'] %>
<% if node['openstack']['compute']['vmware']['wsdl_location'] %>
wsdl_location = <%= node['openstack']['compute']['vmware']['wsdl_location'] %>
<% end %>
<% end %>