Add support for VMware driver
This patch aims to add support for VMwareVCDriver. implements blueprint support-vmware-driver Change-Id: I22f15dfc9c9b0f27d06e64c23a6c5c8e921a71a9
This commit is contained in:
@@ -70,7 +70,7 @@ nova is a combination of Puppet manifest and ruby code to delivery configuration
|
||||
Limitations
|
||||
-----------
|
||||
|
||||
* Only supports libvirt and xenserver compute drivers.
|
||||
* Only supports libvirt, xenserver and vmware compute drivers.
|
||||
* Tested on EL and Debian derivatives.
|
||||
|
||||
Development
|
||||
|
81
manifests/compute/vmware.pp
Normal file
81
manifests/compute/vmware.pp
Normal file
@@ -0,0 +1,81 @@
|
||||
#
|
||||
# Configure the VMware compute driver for nova.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*host_ip*]
|
||||
# The IP address of the VMware vCenter server.
|
||||
#
|
||||
# [*host_username*]
|
||||
# The username for connection to VMware vCenter server.
|
||||
#
|
||||
# [*host_password*]
|
||||
# The password for connection to VMware vCenter server.
|
||||
#
|
||||
# [*cluster_name*]
|
||||
# The name of a vCenter cluster compute resource.
|
||||
#
|
||||
# [*api_retry_count*]
|
||||
# (optional) The number of times we retry on failures,
|
||||
# e.g., socket error, etc.
|
||||
# Defaults to 5.
|
||||
#
|
||||
# [*maximum_objects*]
|
||||
# (optional) The maximum number of ObjectContent data objects that should
|
||||
# be returned in a single result. A positive value will cause
|
||||
# the operation to suspend the retrieval when the count of
|
||||
# objects reaches the specified maximum. The server may still
|
||||
# limit the count to something less than the configured value.
|
||||
# Any remaining objects may be retrieved with additional requests.
|
||||
# Defaults to 100.
|
||||
#
|
||||
# [*task_poll_interval*]
|
||||
# (optional) The interval used for polling of remote tasks.
|
||||
# Defaults to 5.0
|
||||
#
|
||||
# [*use_linked_clone*]
|
||||
# (optional) Whether to use linked clone strategy while creating VM's.
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*wsdl_location*]
|
||||
# (optional) VIM Service WSDL Location e.g
|
||||
# http://<server>/vimService.wsdl. Optional over-ride to
|
||||
# default location for bug work-arounds.
|
||||
# Defaults to None.
|
||||
#
|
||||
|
||||
class nova::compute::vmware(
|
||||
$host_ip,
|
||||
$host_username,
|
||||
$host_password,
|
||||
$cluster_name,
|
||||
$api_retry_count=5,
|
||||
$maximum_objects=100,
|
||||
$task_poll_interval=5.0,
|
||||
$use_linked_clone=true,
|
||||
$wsdl_location=undef
|
||||
) {
|
||||
|
||||
nova_config {
|
||||
'DEFAULT/compute_driver': value => 'vmwareapi.VMwareVCDriver';
|
||||
'VMWARE/host_ip': value => $host_ip;
|
||||
'VMWARE/host_username': value => $host_username;
|
||||
'VMWARE/host_password': value => $host_password;
|
||||
'VMWARE/cluster_name': value => $cluster_name;
|
||||
'VMWARE/api_retry_count' : value => $api_retry_count;
|
||||
'VMWARE/maximum_objects' : value => $maximum_objects;
|
||||
'VMWARE/task_poll_interval' : value => $task_poll_interval;
|
||||
'VMWARE/use_linked_clone': value => $use_linked_clone;
|
||||
}
|
||||
|
||||
if $wsdl_location {
|
||||
nova_config {
|
||||
'VMWARE/wsdl_location' : value => $wsdl_location;
|
||||
}
|
||||
}
|
||||
|
||||
package { 'suds':
|
||||
ensure => present,
|
||||
provider => pip
|
||||
}
|
||||
}
|
52
spec/classes/nova_compute_vmware_spec.rb
Normal file
52
spec/classes/nova_compute_vmware_spec.rb
Normal file
@@ -0,0 +1,52 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'nova::compute::vmware' do
|
||||
|
||||
let :params do
|
||||
{:host_ip => '127.0.0.1',
|
||||
:host_username => 'root',
|
||||
:host_password => 'passw0rd',
|
||||
:cluster_name => 'cluster1'}
|
||||
end
|
||||
|
||||
let :optional_params do
|
||||
{:api_retry_count => 10,
|
||||
:maximum_objects => 100,
|
||||
:task_poll_interval => 10.5,
|
||||
:use_linked_clone => false,
|
||||
:wsdl_location => 'http://127.0.0.1:8080/vmware/SDK/wsdl/vim25/vimService.wsdl'}
|
||||
end
|
||||
|
||||
it 'configures vmwareapi in nova.conf' do
|
||||
should contain_nova_config('DEFAULT/compute_driver').with_value('vmwareapi.VMwareVCDriver')
|
||||
should contain_nova_config('VMWARE/host_ip').with_value(params[:host_ip])
|
||||
should contain_nova_config('VMWARE/host_username').with_value(params[:host_username])
|
||||
should contain_nova_config('VMWARE/host_password').with_value(params[:host_password])
|
||||
should contain_nova_config('VMWARE/cluster_name').with_value(params[:cluster_name])
|
||||
should contain_nova_config('VMWARE/api_retry_count').with_value(5)
|
||||
should contain_nova_config('VMWARE/maximum_objects').with_value(100)
|
||||
should contain_nova_config('VMWARE/task_poll_interval').with_value(5.0)
|
||||
should contain_nova_config('VMWARE/use_linked_clone').with_value(true)
|
||||
should_not contain_nova_config('VMWARE/wsdl_location')
|
||||
end
|
||||
|
||||
it 'installs vmwareapi with pip' do
|
||||
should contain_package('suds').with(
|
||||
:ensure => 'present',
|
||||
:provider => 'pip')
|
||||
end
|
||||
|
||||
context 'with optional parameters' do
|
||||
before :each do
|
||||
params.merge!(optional_params)
|
||||
end
|
||||
|
||||
it 'configures vmwareapi in nova.conf' do
|
||||
should contain_nova_config('VMWARE/api_retry_count').with_value(params[:api_retry_count])
|
||||
should contain_nova_config('VMWARE/maximum_objects').with_value(params[:maximum_objects])
|
||||
should contain_nova_config('VMWARE/task_poll_interval').with_value(params[:task_poll_interval])
|
||||
should contain_nova_config('VMWARE/use_linked_clone').with_value(false)
|
||||
should contain_nova_config('VMWARE/wsdl_location').with_value(params[:wsdl_location])
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user