Merge "Adapt synced Nova module for Fuel usage"
This commit is contained in:
commit
588439ba53
34
deployment/puppet/nova/files/libvirt_qemu.conf
Normal file
34
deployment/puppet/nova/files/libvirt_qemu.conf
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Master configuration file for the QEMU driver.
|
||||||
|
# All settings described here are optional - if omitted, sensible
|
||||||
|
# defaults are used.
|
||||||
|
|
||||||
|
# The user ID for QEMU processes run by the system instance.
|
||||||
|
user = "root"
|
||||||
|
|
||||||
|
# The group ID for QEMU processes run by the system instance.
|
||||||
|
group = "root"
|
||||||
|
|
||||||
|
# This is the basic set of devices allowed / required by
|
||||||
|
# all virtual machines.
|
||||||
|
#
|
||||||
|
# As well as this, any configured block backed disks,
|
||||||
|
# all sound device, and all PTY devices are allowed.
|
||||||
|
#
|
||||||
|
# This will only need setting if newer QEMU suddenly
|
||||||
|
# wants some device we don't already know about.
|
||||||
|
#
|
||||||
|
cgroup_device_acl = [
|
||||||
|
"/dev/null", "/dev/full", "/dev/zero",
|
||||||
|
"/dev/random", "/dev/urandom",
|
||||||
|
"/dev/ptmx", "/dev/kvm", "/dev/kqemu",
|
||||||
|
"/dev/rtc", "/dev/hpet", '/dev/net/tun',
|
||||||
|
]
|
||||||
|
|
||||||
|
# If clear_emulator_capabilities is enabled, libvirt will drop all
|
||||||
|
# privileged capabilities of the QEmu/KVM emulator. This is enabled by
|
||||||
|
# default.
|
||||||
|
#
|
||||||
|
# Warning: Disabling this option means that a compromised guest can
|
||||||
|
# exploit the privileges and possibly do damage to the host.
|
||||||
|
#
|
||||||
|
clear_emulator_capabilities = 0
|
@ -0,0 +1,23 @@
|
|||||||
|
Puppet::Type.type(:nova_floating).provide(:nova_manage) do
|
||||||
|
|
||||||
|
desc "Manage nova floating"
|
||||||
|
|
||||||
|
optional_commands :nova_manage => 'nova-manage'
|
||||||
|
|
||||||
|
def exists?
|
||||||
|
# Calculate num quads to grab for prefix
|
||||||
|
mask=resource[:network].sub(/.*\/([0-9][0-9]?)/, '\1').to_i
|
||||||
|
num_quads = 4 - mask / 8
|
||||||
|
prefix=resource[:network].sub(/(\.[0-9]{1,3}){#{num_quads}}(\/[0-9]{1,2})?$/, '') + "."
|
||||||
|
return nova_manage("floating", "list").match(/#{prefix}/)
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
nova_manage("floating", "create", resource[:network])
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
nova_manage("floating", "delete", resource[:network])
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -27,6 +27,7 @@ Puppet::Type.type(:nova_network).provide(:nova_manage) do
|
|||||||
{
|
{
|
||||||
# this needs to be converted from a project name to an id
|
# this needs to be converted from a project name to an id
|
||||||
:project => '--project_id',
|
:project => '--project_id',
|
||||||
|
:dns1 => '--dns1',
|
||||||
:dns2 => '--dns2',
|
:dns2 => '--dns2',
|
||||||
:gateway => '--gateway',
|
:gateway => '--gateway',
|
||||||
:bridge => '--bridge',
|
:bridge => '--bridge',
|
||||||
|
@ -0,0 +1,88 @@
|
|||||||
|
Puppet::Type.newtype(:nova_floating_range) do
|
||||||
|
|
||||||
|
@doc = 'Manage creation/deletion of nova floating ip ranges.'
|
||||||
|
|
||||||
|
ensurable
|
||||||
|
|
||||||
|
newparam(:name, :namevar => true) do
|
||||||
|
desc 'IP range ("192.168.1.1-192.168.1.55")'
|
||||||
|
|
||||||
|
validate do |value|
|
||||||
|
raise Puppet::Error, " #{value} does not look like IP range" unless value =~ /^(\d{1,3}\.){3}\d{1,3}-(\d{1,3}\.){3}\d{1,3}$/
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
newparam(:pool) do
|
||||||
|
desc 'Pool ranges'
|
||||||
|
|
||||||
|
defaultto 'nova'
|
||||||
|
end
|
||||||
|
|
||||||
|
newparam(:interface) do
|
||||||
|
# I don't know how use it
|
||||||
|
desc 'Interface for floating IP'
|
||||||
|
end
|
||||||
|
|
||||||
|
newparam(:username) do
|
||||||
|
desc 'authorization user'
|
||||||
|
|
||||||
|
munge do |value|
|
||||||
|
String value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
newparam(:api_key) do
|
||||||
|
desc 'authorization key'
|
||||||
|
|
||||||
|
munge do |value|
|
||||||
|
String value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
newparam(:auth_method) do
|
||||||
|
desc 'authorization password'
|
||||||
|
|
||||||
|
munge do |value|
|
||||||
|
String value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
newparam(:auth_url) do
|
||||||
|
desc 'URL to keystone authorization http://192.168.1.1:5000/v2.0/'
|
||||||
|
|
||||||
|
validate do |value|
|
||||||
|
raise Puppet::Error, "#{value} does not look like URL" unless value =~ /^https?:\/\/\S+:\d{1,5}\/v[\d\.]{1,5}\//
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
newparam(:authtenant_name) do
|
||||||
|
desc 'Tenant name'
|
||||||
|
|
||||||
|
munge do |value|
|
||||||
|
String value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
newparam(:api_retries) do
|
||||||
|
desc 'number of API reconnect retries'
|
||||||
|
|
||||||
|
validate do |value|
|
||||||
|
raise Puppet::Error, "#{value} does not look like numeric" unless value.is_a?(Integer) || value =~ /^\d+$/
|
||||||
|
end
|
||||||
|
|
||||||
|
munge do |value|
|
||||||
|
Integer value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
newparam(:service_type) do
|
||||||
|
desc 'Connection type :service_type parameter to "compute", "object-store", "volume" or "network" (defaults to "compute")'
|
||||||
|
|
||||||
|
defaultto 'compute'
|
||||||
|
|
||||||
|
munge do |value|
|
||||||
|
String value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -34,7 +34,12 @@ Puppet::Type.newtype(:nova_network) do
|
|||||||
newparam(:gateway) do
|
newparam(:gateway) do
|
||||||
end
|
end
|
||||||
|
|
||||||
|
newparam(:dns1) do
|
||||||
|
desc 'first dns server'
|
||||||
|
end
|
||||||
|
|
||||||
newparam(:dns2) do
|
newparam(:dns2) do
|
||||||
|
desc 'second dns server'
|
||||||
end
|
end
|
||||||
|
|
||||||
newparam(:vlan_start) do
|
newparam(:vlan_start) do
|
||||||
|
@ -60,6 +60,11 @@
|
|||||||
# (optional) Whether to use Neutron for networking of VMs
|
# (optional) Whether to use Neutron for networking of VMs
|
||||||
# Defaults to true
|
# Defaults to true
|
||||||
#
|
#
|
||||||
|
# [*install_bridge_utils*]
|
||||||
|
# (optional) Whether to install the bridge-utils package or not.
|
||||||
|
# Applicable only for cases when Neutron was disabled
|
||||||
|
# Defaults to true
|
||||||
|
#
|
||||||
# [*network_device_mtu*]
|
# [*network_device_mtu*]
|
||||||
# (optional) The MTU size for the interfaces managed by nova
|
# (optional) The MTU size for the interfaces managed by nova
|
||||||
# Defaults to undef
|
# Defaults to undef
|
||||||
@ -120,6 +125,7 @@ class nova::compute (
|
|||||||
$force_config_drive = false,
|
$force_config_drive = false,
|
||||||
$virtio_nic = false,
|
$virtio_nic = false,
|
||||||
$neutron_enabled = true,
|
$neutron_enabled = true,
|
||||||
|
$install_bridge_utils = true,
|
||||||
$network_device_mtu = undef,
|
$network_device_mtu = undef,
|
||||||
$instance_usage_audit = false,
|
$instance_usage_audit = false,
|
||||||
$instance_usage_audit_period = 'month',
|
$instance_usage_audit_period = 'month',
|
||||||
@ -151,7 +157,7 @@ class nova::compute (
|
|||||||
'DEFAULT/vnc_keymap': value => $vnc_keymap;
|
'DEFAULT/vnc_keymap': value => $vnc_keymap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if $neutron_enabled != true {
|
if $neutron_enabled != true and $install_bridge_utils {
|
||||||
# Install bridge-utils if we use nova-network
|
# Install bridge-utils if we use nova-network
|
||||||
package { 'bridge-utils':
|
package { 'bridge-utils':
|
||||||
ensure => present,
|
ensure => present,
|
||||||
|
@ -10,6 +10,26 @@
|
|||||||
# This define creates a service resource with title nova-${name} and
|
# This define creates a service resource with title nova-${name} and
|
||||||
# conditionally creates a package resource with title nova-${name}
|
# conditionally creates a package resource with title nova-${name}
|
||||||
#
|
#
|
||||||
|
# === Parameters:
|
||||||
|
#
|
||||||
|
# [*package_name*]
|
||||||
|
# (mandatory) The package name (for the generic_service)
|
||||||
|
#
|
||||||
|
# [*service_name*]
|
||||||
|
# (mandatory) The service name (for the generic_service)
|
||||||
|
#
|
||||||
|
# [*enabled*]
|
||||||
|
# (optional) Define if the service must be enabled or not
|
||||||
|
# Defaults to false.
|
||||||
|
#
|
||||||
|
# [*manage_service*]
|
||||||
|
# (optional) Manage or not the service (if a service_name is provided).
|
||||||
|
# Defaults to true.
|
||||||
|
#
|
||||||
|
# [*ensure_package*]
|
||||||
|
# (optional) Control the ensure parameter for the package ressource.
|
||||||
|
# Defaults to 'present'.
|
||||||
|
#
|
||||||
define nova::generic_service(
|
define nova::generic_service(
|
||||||
$package_name,
|
$package_name,
|
||||||
$service_name,
|
$service_name,
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
# Creates floating networks
|
# Creates floating networks
|
||||||
|
#
|
||||||
|
# === Parameters:
|
||||||
|
#
|
||||||
|
# [*network*]
|
||||||
|
# (mandatory) The network name to work on
|
||||||
|
#
|
||||||
define nova::manage::floating ( $network ) {
|
define nova::manage::floating ( $network ) {
|
||||||
|
|
||||||
File['/etc/nova/nova.conf'] -> Nova_floating[$name]
|
File['/etc/nova/nova.conf'] -> Nova_floating[$name]
|
||||||
|
@ -3,6 +3,10 @@
|
|||||||
# [*network*]
|
# [*network*]
|
||||||
# (required) IPv4 CIDR of network to create.
|
# (required) IPv4 CIDR of network to create.
|
||||||
#
|
#
|
||||||
|
# [*label*]
|
||||||
|
# (optional) The label of the network.
|
||||||
|
# Defaults to 'novanetwork'.
|
||||||
|
#
|
||||||
# [*num_networks*]
|
# [*num_networks*]
|
||||||
# (optional) Number of networks to split $network into.
|
# (optional) Number of networks to split $network into.
|
||||||
# Defaults to 1
|
# Defaults to 1
|
||||||
@ -19,13 +23,23 @@
|
|||||||
# (optional) Project that network should be associated with
|
# (optional) Project that network should be associated with
|
||||||
# Defaults to undef
|
# Defaults to undef
|
||||||
#
|
#
|
||||||
|
# [*dns1*]
|
||||||
|
# (optional) First DNS server
|
||||||
|
# Defaults to '8.8.8.8'
|
||||||
|
#
|
||||||
|
# [*dns2*]
|
||||||
|
# (optional) Second DNS server
|
||||||
|
# Defaults to '8.8.4.4'
|
||||||
|
#
|
||||||
define nova::manage::network (
|
define nova::manage::network (
|
||||||
$network,
|
$network,
|
||||||
$label = 'novanetwork',
|
$label = 'novanetwork',
|
||||||
$num_networks = 1,
|
$num_networks = 1,
|
||||||
$network_size = 255,
|
$network_size = 255,
|
||||||
$vlan_start = undef,
|
$vlan_start = undef,
|
||||||
$project = undef
|
$project = undef,
|
||||||
|
$dns1 = '8.8.8.8',
|
||||||
|
$dns2 = '8.8.4.4',
|
||||||
) {
|
) {
|
||||||
|
|
||||||
File['/etc/nova/nova.conf'] -> Nova_network[$name]
|
File['/etc/nova/nova.conf'] -> Nova_network[$name]
|
||||||
@ -39,6 +53,8 @@ define nova::manage::network (
|
|||||||
network_size => $network_size,
|
network_size => $network_size,
|
||||||
project => $project,
|
project => $project,
|
||||||
vlan_start => $vlan_start,
|
vlan_start => $vlan_start,
|
||||||
|
dns1 => $dns1,
|
||||||
|
dns2 => $dns2,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,10 @@
|
|||||||
# (optional) Whether to install and enable the service
|
# (optional) Whether to install and enable the service
|
||||||
# Defaults to true
|
# Defaults to true
|
||||||
#
|
#
|
||||||
|
# [*nameservers*]
|
||||||
|
# (optional) DNS servers
|
||||||
|
# Defaults to ['8.8.8.8', '8.8.4.4']
|
||||||
|
#
|
||||||
class nova::network(
|
class nova::network(
|
||||||
$private_interface = undef,
|
$private_interface = undef,
|
||||||
$fixed_range = '10.0.0.0/8',
|
$fixed_range = '10.0.0.0/8',
|
||||||
@ -71,7 +75,8 @@ class nova::network(
|
|||||||
$config_overrides = {},
|
$config_overrides = {},
|
||||||
$create_networks = true,
|
$create_networks = true,
|
||||||
$ensure_package = 'present',
|
$ensure_package = 'present',
|
||||||
$install_service = true
|
$install_service = true,
|
||||||
|
$nameservers = ['8.8.8.8', '8.8.4.4'],
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include ::nova::params
|
include ::nova::params
|
||||||
@ -111,6 +116,8 @@ class nova::network(
|
|||||||
num_networks => $num_networks,
|
num_networks => $num_networks,
|
||||||
network_size => $network_size,
|
network_size => $network_size,
|
||||||
vlan_start => $vlan_start,
|
vlan_start => $vlan_start,
|
||||||
|
dns1 => $nameservers[0],
|
||||||
|
dns2 => $nameservers[1],
|
||||||
}
|
}
|
||||||
if $floating_range {
|
if $floating_range {
|
||||||
nova::manage::floating { 'nova-vm-floating':
|
nova::manage::floating { 'nova-vm-floating':
|
||||||
|
@ -1,4 +1,14 @@
|
|||||||
# bridge.pp
|
# bridge.pp
|
||||||
|
#
|
||||||
|
# === Parameters:
|
||||||
|
#
|
||||||
|
# [*ip*]
|
||||||
|
# (mandatory) IP address of the bridge interface.
|
||||||
|
#
|
||||||
|
# [*netmask*]
|
||||||
|
# (optional) Netmask of the bridge interface.
|
||||||
|
# Defaults to '255.255.255.0' (/24).
|
||||||
|
#
|
||||||
define nova::network::bridge (
|
define nova::network::bridge (
|
||||||
$ip,
|
$ip,
|
||||||
$netmask = '255.255.255.0'
|
$netmask = '255.255.255.0'
|
||||||
|
@ -85,7 +85,8 @@ class nova::params {
|
|||||||
$compute_service_name = 'nova-compute'
|
$compute_service_name = 'nova-compute'
|
||||||
$conductor_service_name = 'nova-conductor'
|
$conductor_service_name = 'nova-conductor'
|
||||||
$consoleauth_service_name = 'nova-consoleauth'
|
$consoleauth_service_name = 'nova-consoleauth'
|
||||||
$libvirt_service_name = 'libvirt-bin'
|
# Workaround for bug LP #1469308
|
||||||
|
$libvirt_service_name = 'libvirtd'
|
||||||
$network_service_name = 'nova-network'
|
$network_service_name = 'nova-network'
|
||||||
$objectstore_service_name = 'nova-objectstore'
|
$objectstore_service_name = 'nova-objectstore'
|
||||||
$scheduler_service_name = 'nova-scheduler'
|
$scheduler_service_name = 'nova-scheduler'
|
||||||
@ -107,7 +108,9 @@ class nova::params {
|
|||||||
default: {
|
default: {
|
||||||
$spicehtml5proxy_package_name = 'nova-spiceproxy'
|
$spicehtml5proxy_package_name = 'nova-spiceproxy'
|
||||||
$spicehtml5proxy_service_name = 'nova-spiceproxy'
|
$spicehtml5proxy_service_name = 'nova-spiceproxy'
|
||||||
$vncproxy_package_name = 'nova-novncproxy'
|
# Workadroung for bug LP #1468230
|
||||||
|
#$vncproxy_package_name = 'nova-novncproxy'
|
||||||
|
$vncproxy_package_name = 'nova-consoleproxy'
|
||||||
# some of the services need to be started form the special upstart provider
|
# some of the services need to be started form the special upstart provider
|
||||||
$special_service_provider = 'upstart'
|
$special_service_provider = 'upstart'
|
||||||
$nova_log_group = 'adm'
|
$nova_log_group = 'adm'
|
||||||
|
@ -123,6 +123,20 @@ describe 'nova::compute' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with install_bridge_utils set to false' do
|
||||||
|
let :params do
|
||||||
|
{ :install_bridge_utils => false }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not install bridge-utils package for nova-network' do
|
||||||
|
is_expected.to_not contain_package('bridge-utils').with(
|
||||||
|
:ensure => 'present',
|
||||||
|
:before => 'Nova::Generic_service[compute]'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
context 'with vnc_enabled set to false' do
|
context 'with vnc_enabled set to false' do
|
||||||
let :params do
|
let :params do
|
||||||
{ :vnc_enabled => false }
|
{ :vnc_enabled => false }
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Puppet::Type.type(:nova_floating).provider(:nova_manage) do
|
||||||
|
|
||||||
|
let(:resource) { Puppet::Type.type(:nova_floating).new(:name => '192.168.1.1' ) }
|
||||||
|
let(:provider) { resource.provider }
|
||||||
|
|
||||||
|
describe "#create_by_name" do
|
||||||
|
it "should create floating" do
|
||||||
|
provider.parse().should == ["192.168.1.1", nil]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for net in ['10.0.0.1', '10.0.0.0/16'] do
|
||||||
|
describe "#create #{net}" do
|
||||||
|
it "should create floating for #{net}" do
|
||||||
|
resource[:network]= net
|
||||||
|
provider.expects(:nova_manage).with("floating", "create", net)
|
||||||
|
provider.create()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
describe "#destroy #{net}" do
|
||||||
|
it "should destroy floating for #{net}" do
|
||||||
|
resource[:network]= net
|
||||||
|
provider.expects(:nova_manage).with("floating", "delete", net)
|
||||||
|
provider.destroy()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
describe "#check masklen #{net}" do
|
||||||
|
it "should returns right values for #{net}" do
|
||||||
|
resource[:network]= net
|
||||||
|
/([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})(\/([0-9]{1,2}))?/ =~ net
|
||||||
|
provider.parse().should == [Regexp.last_match(1), Regexp.last_match(3)]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,33 @@
|
|||||||
|
require 'puppet'
|
||||||
|
require 'test/unit'
|
||||||
|
require 'mocha/setup'
|
||||||
|
require 'puppet/provider/nova_floating_range/nova_manage'
|
||||||
|
|
||||||
|
describe 'Puppet::Type.type(:nova_floating_range)' do
|
||||||
|
|
||||||
|
before :all do
|
||||||
|
type_class = Puppet::Type::Nova_floating_range.new(:name => '192.168.1.2-192.168.1.9')
|
||||||
|
@provider_class = Puppet::Type.type(:nova_floating_range).provider(:nova_manage).new(type_class)
|
||||||
|
# Mock for return existing ip addresses
|
||||||
|
floating_ip_info_mock = [OpenStack::Compute::FloatingIPInfo.new('address' => '192.168.1.2'),OpenStack::Compute::FloatingIPInfo.new('address' => '192.168.1.3')]
|
||||||
|
@provider_class.stubs(:connect).returns(true)
|
||||||
|
@provider_class.connect.stubs(:get_floating_ips_bulk).returns(floating_ip_info_mock)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'ip range should be correct splited' do
|
||||||
|
@provider_class.ip_range.should == ['192.168.1.2', '192.168.1.3', '192.168.1.4', '192.168.1.5', '192.168.1.6', '192.168.1.7', '192.168.1.8', '192.168.1.9']
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should correct calculate range and remove existing ips' do
|
||||||
|
@provider_class.operate_range.should == ['192.168.1.4', '192.168.1.5', '192.168.1.6', '192.168.1.7', '192.168.1.8', '192.168.1.9']
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should create cidr including first and last ip' do
|
||||||
|
@provider_class.mixed_range.should == ['192.168.1.4', '192.168.1.7', '192.168.1.8', '192.168.1.9', '192.168.1.4/30']
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should correct calculate intersection range ips' do
|
||||||
|
@provider_class.resource[:ensure] = :absent
|
||||||
|
@provider_class.operate_range.should == ['192.168.1.2', '192.168.1.3']
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,27 @@
|
|||||||
|
require 'puppet'
|
||||||
|
|
||||||
|
describe 'Puppet::Type.newtype(:nova_floating_range)' do
|
||||||
|
before :each do
|
||||||
|
@nova_floating_range = Puppet::Type.type(:nova_floating_range).new(:name => '10.0.0.1-10.0.0.254')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should not expect a name without ip range' do
|
||||||
|
expect {
|
||||||
|
Puppet::Type.type(:nova_floating_range).new(:name => 'foo')
|
||||||
|
}.to raise_error(Puppet::Error, /does not look/)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'pull should be "nova" by default' do
|
||||||
|
@nova_floating_range[:pool].should == 'nova'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'auth url should be url' do
|
||||||
|
expect { @nova_floating_range[:auth_url] = 'h ttp://192.168.1.1:5000/v2.0/'
|
||||||
|
}.to raise_error(Puppet::Error, /does not look/)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'api retries should be numeric' do
|
||||||
|
expect { @nova_floating_range[:api_retries] = '3b'
|
||||||
|
}.to raise_error(Puppet::Error, /does not look/)
|
||||||
|
end
|
||||||
|
end
|
26
deployment/puppet/nova/spec/unit/type/nova_floating_spec.rb
Normal file
26
deployment/puppet/nova/spec/unit/type/nova_floating_spec.rb
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
require 'puppet'
|
||||||
|
require 'puppet/type/nova_floating'
|
||||||
|
describe 'Puppet::Type.type(:nova_floating)' do
|
||||||
|
before :each do
|
||||||
|
@nova_floating = Puppet::Type.type(:nova_floating).new(:name => 'test_IP', :network => '192.168.1.2')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should accept valid IP address' do
|
||||||
|
@nova_floating[:network] = '192.168.1.1'
|
||||||
|
@nova_floating[:network] == '192.168.1.1'
|
||||||
|
end
|
||||||
|
it 'should accept valid CIDR subnet' do
|
||||||
|
@nova_floating[:network] = '192.168.1.0/24'
|
||||||
|
@nova_floating[:network] == '192.168.1.0/24'
|
||||||
|
end
|
||||||
|
it 'should not accept masklen more 2 didits' do
|
||||||
|
expect {
|
||||||
|
@nova_floating[:network] = '192.168.1.0/245'
|
||||||
|
}.to raise_error(Puppet::Error, /Invalid value/)
|
||||||
|
end
|
||||||
|
it 'should not accept invalid ensure values' do
|
||||||
|
expect {
|
||||||
|
@nova_floating[:network] = 'qweqweqweqwe'
|
||||||
|
}.to raise_error(Puppet::Error, /Invalid value/)
|
||||||
|
end
|
||||||
|
end
|
@ -267,7 +267,7 @@ The openstack::compute class deploys the following services:
|
|||||||
fixed_range => '10.0.0.0/24',
|
fixed_range => '10.0.0.0/24',
|
||||||
network_manager => 'nova.network.manager.FlatDHCPManager',
|
network_manager => 'nova.network.manager.FlatDHCPManager',
|
||||||
multi_host => false,
|
multi_host => false,
|
||||||
sql_connection => 'mysql://nova:nova_db_passwd@192.168.101.10/nova',
|
database_connection => 'mysql://nova:nova_db_passwd@192.168.101.10/nova',
|
||||||
rabbit_host => '192.168.101.10',
|
rabbit_host => '192.168.101.10',
|
||||||
glance_api_servers => '192.168.101.10:9292',
|
glance_api_servers => '192.168.101.10:9292',
|
||||||
vncproxy_host => '192.168.101.10',
|
vncproxy_host => '192.168.101.10',
|
||||||
|
@ -61,7 +61,7 @@ class openstack::compute (
|
|||||||
$nova_user_password,
|
$nova_user_password,
|
||||||
# Network
|
# Network
|
||||||
# DB
|
# DB
|
||||||
$sql_connection = false,
|
$database_connection = false,
|
||||||
# Nova
|
# Nova
|
||||||
$purge_nova_config = false,
|
$purge_nova_config = false,
|
||||||
# RPC
|
# RPC
|
||||||
@ -130,6 +130,7 @@ class openstack::compute (
|
|||||||
$libvirt_vif_driver = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver',
|
$libvirt_vif_driver = 'nova.virt.libvirt.vif.LibvirtGenericVIFDriver',
|
||||||
$storage_hash = {},
|
$storage_hash = {},
|
||||||
$neutron_settings = {},
|
$neutron_settings = {},
|
||||||
|
$install_bridge_utils = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -144,7 +145,6 @@ class openstack::compute (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$final_sql_connection = $sql_connection
|
|
||||||
$glance_connection = $glance_api_servers
|
$glance_connection = $glance_api_servers
|
||||||
|
|
||||||
case $::osfamily {
|
case $::osfamily {
|
||||||
@ -242,7 +242,7 @@ class openstack::compute (
|
|||||||
class { 'nova':
|
class { 'nova':
|
||||||
install_utilities => false,
|
install_utilities => false,
|
||||||
ensure_package => $::openstack_version['nova'],
|
ensure_package => $::openstack_version['nova'],
|
||||||
sql_connection => $sql_connection,
|
database_connection => $database_connection,
|
||||||
rpc_backend => $rpc_backend,
|
rpc_backend => $rpc_backend,
|
||||||
#FIXME(bogdando) we have to split amqp_hosts until all modules synced
|
#FIXME(bogdando) we have to split amqp_hosts until all modules synced
|
||||||
rabbit_hosts => split($amqp_hosts, ','),
|
rabbit_hosts => split($amqp_hosts, ','),
|
||||||
@ -259,7 +259,6 @@ class openstack::compute (
|
|||||||
service_down_time => $nova_service_down_time,
|
service_down_time => $nova_service_down_time,
|
||||||
notify_on_state_change => $notify_on_state_change,
|
notify_on_state_change => $notify_on_state_change,
|
||||||
memcached_servers => $memcached_addresses,
|
memcached_servers => $memcached_addresses,
|
||||||
nova_shell => '/bin/bash',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if str2bool($::is_virtual) {
|
if str2bool($::is_virtual) {
|
||||||
@ -288,6 +287,7 @@ class openstack::compute (
|
|||||||
vncproxy_host => $vncproxy_host,
|
vncproxy_host => $vncproxy_host,
|
||||||
#NOTE(bogdando) default became true in 4.0.0 puppet-nova (was false)
|
#NOTE(bogdando) default became true in 4.0.0 puppet-nova (was false)
|
||||||
neutron_enabled => ($network_provider == 'neutron'),
|
neutron_enabled => ($network_provider == 'neutron'),
|
||||||
|
install_bridge_utils => $install_bridge_utils,
|
||||||
instance_usage_audit => $instance_usage_audit,
|
instance_usage_audit => $instance_usage_audit,
|
||||||
instance_usage_audit_period => $instance_usage_audit_period,
|
instance_usage_audit_period => $instance_usage_audit_period,
|
||||||
}
|
}
|
||||||
@ -311,12 +311,12 @@ class openstack::compute (
|
|||||||
# modify the libvirt_disk_cachemodes in that case.
|
# modify the libvirt_disk_cachemodes in that case.
|
||||||
if ($storage_hash['ephemeral_ceph'] or $storage_hash['volumes_ceph']) {
|
if ($storage_hash['ephemeral_ceph'] or $storage_hash['volumes_ceph']) {
|
||||||
$disk_cachemodes = ['"network=writeback,block=none"']
|
$disk_cachemodes = ['"network=writeback,block=none"']
|
||||||
|
$libvirt_inject_partition = '-2'
|
||||||
} else {
|
} else {
|
||||||
if $::osfamily == 'RedHat' {
|
if $::osfamily == 'RedHat' {
|
||||||
nova_config { 'libvirt/inject_partition': value => '-1'; }
|
$libvirt_inject_partition = '-1'
|
||||||
}
|
} else {
|
||||||
else {
|
$libvirt_inject_partition = '1'
|
||||||
nova_config { 'libvirt/inject_partition': value => '1'; }
|
|
||||||
}
|
}
|
||||||
$disk_cachemodes = ['"file=directsync,block=none"']
|
$disk_cachemodes = ['"file=directsync,block=none"']
|
||||||
}
|
}
|
||||||
@ -326,6 +326,7 @@ class openstack::compute (
|
|||||||
libvirt_virt_type => $libvirt_type,
|
libvirt_virt_type => $libvirt_type,
|
||||||
libvirt_cpu_mode => $libvirt_cpu_mode,
|
libvirt_cpu_mode => $libvirt_cpu_mode,
|
||||||
libvirt_disk_cachemodes => $disk_cachemodes,
|
libvirt_disk_cachemodes => $disk_cachemodes,
|
||||||
|
libvirt_inject_partition => $libvirt_inject_partition,
|
||||||
vncserver_listen => $vncserver_listen,
|
vncserver_listen => $vncserver_listen,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ class openstack::nova::controller (
|
|||||||
quota_metadata_items => 1024,
|
quota_metadata_items => 1024,
|
||||||
quota_max_injected_files => 50,
|
quota_max_injected_files => 50,
|
||||||
quota_max_injected_file_content_bytes => 102400,
|
quota_max_injected_file_content_bytes => 102400,
|
||||||
quota_max_injected_file_path_bytes => 4096,
|
quota_injected_file_path_length => 4096,
|
||||||
quota_driver => $nova_quota_driver
|
quota_driver => $nova_quota_driver
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -314,6 +314,7 @@ class openstack::nova::controller (
|
|||||||
neutron_metadata_proxy_shared_secret => $neutron_metadata_proxy_shared_secret,
|
neutron_metadata_proxy_shared_secret => $neutron_metadata_proxy_shared_secret,
|
||||||
require => Package['nova-common'],
|
require => Package['nova-common'],
|
||||||
osapi_compute_workers => min($::processorcount + 0, 50 + 0),
|
osapi_compute_workers => min($::processorcount + 0, 50 + 0),
|
||||||
|
keystone_ec2_url => "http://${keystone_host}:5000/v2.0/ec2tokens",
|
||||||
}
|
}
|
||||||
|
|
||||||
# From legacy init.pp
|
# From legacy init.pp
|
||||||
@ -331,7 +332,6 @@ class openstack::nova::controller (
|
|||||||
nova_config {
|
nova_config {
|
||||||
'DEFAULT/allow_resize_to_same_host': value => true;
|
'DEFAULT/allow_resize_to_same_host': value => true;
|
||||||
'DEFAULT/api_paste_config': value => '/etc/nova/api-paste.ini';
|
'DEFAULT/api_paste_config': value => '/etc/nova/api-paste.ini';
|
||||||
'DEFAULT/keystone_ec2_url': value => "http://${keystone_host}:5000/v2.0/ec2tokens";
|
|
||||||
'keystone_authtoken/signing_dir': value => '/tmp/keystone-signing-nova';
|
'keystone_authtoken/signing_dir': value => '/tmp/keystone-signing-nova';
|
||||||
'keystone_authtoken/signing_dirname': value => '/tmp/keystone-signing-nova';
|
'keystone_authtoken/signing_dirname': value => '/tmp/keystone-signing-nova';
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ describe 'openstack::compute' do
|
|||||||
end
|
end
|
||||||
it {
|
it {
|
||||||
should contain_class('nova').with(
|
should contain_class('nova').with(
|
||||||
:sql_connection => false,
|
:database_connection => false,
|
||||||
:rabbit_host => false,
|
:rabbit_host => false,
|
||||||
:rabbit_userid => 'nova',
|
:rabbit_userid => 'nova',
|
||||||
:rabbit_password => 'rabbit_pw',
|
:rabbit_password => 'rabbit_pw',
|
||||||
@ -68,7 +68,7 @@ describe 'openstack::compute' do
|
|||||||
:private_interface => 'eth1',
|
:private_interface => 'eth1',
|
||||||
:internal_address => '127.0.0.1',
|
:internal_address => '127.0.0.1',
|
||||||
:public_interface => 'eth2',
|
:public_interface => 'eth2',
|
||||||
:sql_connection => 'mysql://user:passwd@host/name',
|
:database_connection => 'mysql://user:passwd@host/name',
|
||||||
:nova_user_password => 'nova_pass',
|
:nova_user_password => 'nova_pass',
|
||||||
:rabbit_host => 'my_host',
|
:rabbit_host => 'my_host',
|
||||||
:rabbit_password => 'my_rabbit_pw',
|
:rabbit_password => 'my_rabbit_pw',
|
||||||
@ -85,7 +85,7 @@ describe 'openstack::compute' do
|
|||||||
end
|
end
|
||||||
it {
|
it {
|
||||||
should contain_class('nova').with(
|
should contain_class('nova').with(
|
||||||
:sql_connection => 'mysql://user:passwd@host/name',
|
:database_connection => 'mysql://user:passwd@host/name',
|
||||||
:rabbit_host => 'my_host',
|
:rabbit_host => 'my_host',
|
||||||
:rabbit_userid => 'my_rabbit_user',
|
:rabbit_userid => 'my_rabbit_user',
|
||||||
:rabbit_password => 'my_rabbit_pw',
|
:rabbit_password => 'my_rabbit_pw',
|
||||||
|
@ -337,7 +337,7 @@ class { 'openstack::compute':
|
|||||||
network_manager => hiera('network_manager', undef),
|
network_manager => hiera('network_manager', undef),
|
||||||
network_config => hiera('network_config', {}),
|
network_config => hiera('network_config', {}),
|
||||||
multi_host => $multi_host,
|
multi_host => $multi_host,
|
||||||
sql_connection => "mysql://nova:${nova_hash[db_password]}@${management_vip}/nova?read_timeout=60",
|
database_connection => "mysql://nova:${nova_hash[db_password]}@${management_vip}/nova?read_timeout=60",
|
||||||
queue_provider => $queue_provider,
|
queue_provider => $queue_provider,
|
||||||
amqp_hosts => $amqp_hosts,
|
amqp_hosts => $amqp_hosts,
|
||||||
amqp_user => $rabbit_hash['user'],
|
amqp_user => $rabbit_hash['user'],
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
require 'shared-examples'
|
||||||
|
manifest = 'roles/compute.pp'
|
||||||
|
|
||||||
|
describe manifest do
|
||||||
|
shared_examples 'catalog' do
|
||||||
|
|
||||||
|
storage_hash = Noop.hiera_structure 'storage'
|
||||||
|
|
||||||
|
it 'should declare class nova::compute with install_bridge_utils set to false' do
|
||||||
|
should contain_class('nova::compute').with(
|
||||||
|
'install_bridge_utils' => false,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should configure libvirt_inject_partition for compute node' do
|
||||||
|
if storage_hash['ephemeral_ceph'] || storage_hash['volumes_ceph']
|
||||||
|
libvirt_inject_partition = '-2'
|
||||||
|
elsif facts[:operatingsystem] == 'CentOS'
|
||||||
|
libvirt_inject_partition = '-1'
|
||||||
|
else
|
||||||
|
libvirt_inject_partition = '1'
|
||||||
|
end
|
||||||
|
should contain_class('nova::compute::libvirt').with(
|
||||||
|
'libvirt_inject_partition' => libvirt_inject_partition,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end # end of shared_examples
|
||||||
|
|
||||||
|
test_ubuntu_and_centos manifest
|
||||||
|
end
|
@ -17,12 +17,13 @@ describe manifest do
|
|||||||
'allowed_hosts' => allowed_hosts,
|
'allowed_hosts' => allowed_hosts,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
#TODO: uncomment in keystone module adaptation patch
|
|
||||||
# allowed_hosts.each do |host|
|
allowed_hosts.each do |host|
|
||||||
# it "should define openstacklib::db::mysql::host_access for #{nova_db_dbname} DB for #{host}" do
|
it "should define openstacklib::db::mysql::host_access for #{nova_db_dbname} DB for #{host}" do
|
||||||
# should contain_openstacklib__db__mysql__host_access("#{nova_db_dbname}_#{host}")
|
should contain_openstacklib__db__mysql__host_access("#{nova_db_dbname}_#{host}")
|
||||||
# end
|
end
|
||||||
# end
|
end
|
||||||
|
|
||||||
end # end of shared_examples
|
end # end of shared_examples
|
||||||
test_ubuntu_and_centos manifest
|
test_ubuntu_and_centos manifest
|
||||||
end
|
end
|
||||||
|
@ -5,6 +5,13 @@ manifest = 'openstack-controller/openstack-controller.pp'
|
|||||||
describe manifest do
|
describe manifest do
|
||||||
shared_examples 'catalog' do
|
shared_examples 'catalog' do
|
||||||
|
|
||||||
|
service_endpoint = Noop.hiera 'service_endpoint'
|
||||||
|
if service_endpoint
|
||||||
|
keystone_host = service_endpoint
|
||||||
|
else
|
||||||
|
keystone_host = Noop.hiera 'management_vip'
|
||||||
|
end
|
||||||
|
|
||||||
# TODO All this stuff should be moved to shared examples controller* tests.
|
# TODO All this stuff should be moved to shared examples controller* tests.
|
||||||
|
|
||||||
# Nova config options
|
# Nova config options
|
||||||
@ -19,6 +26,26 @@ describe manifest do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
keystone_ec2_url = "http://#{keystone_host}:5000/v2.0/ec2tokens"
|
||||||
|
it 'should declare class nova::api with keystone_ec2_url' do
|
||||||
|
should contain_class('nova::api').with(
|
||||||
|
'keystone_ec2_url' => keystone_ec2_url,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should configure keystone_ec2_url for nova api service' do
|
||||||
|
should contain_nova_config('DEFAULT/keystone_ec2_url').with(
|
||||||
|
'value' => keystone_ec2_url,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should configure nova quota for injected file path length' do
|
||||||
|
should contain_class('nova::quota').with('quota_injected_file_path_length' => '4096')
|
||||||
|
should contain_nova_config('DEFAULT/quota_injected_file_path_length').with(
|
||||||
|
'value' => '4096',
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
end # end of shared_examples
|
end # end of shared_examples
|
||||||
|
|
||||||
test_ubuntu_and_centos manifest
|
test_ubuntu_and_centos manifest
|
||||||
|
@ -33,6 +33,18 @@ describe manifest do
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if !use_neutron
|
||||||
|
nameservers = Noop.hiera 'dns_nameservers'
|
||||||
|
if nameservers
|
||||||
|
it 'should declare nova::network with nameservers' do
|
||||||
|
should contain_class('nova::network').with(
|
||||||
|
'nameservers' => nameservers,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end # end of shared_examples
|
end # end of shared_examples
|
||||||
|
|
||||||
test_ubuntu_and_centos manifest
|
test_ubuntu_and_centos manifest
|
||||||
|
Loading…
Reference in New Issue
Block a user