Fix vnc console on vCenter environment

- Configure vnc console on new section "[vnc]"
- Describe parameters
- Fix typos
- Update noop tests

Change-Id: I7152c5a35b4d20343225d81f2488ae26f86a4827
Closes-Bug: #1566287
Closes-Bug: #1565788
(cherry picked from commit c20429b4e5)
This commit is contained in:
Alexander Arzhanov 2016-06-06 16:10:19 +03:00
parent 3d8f1d5efc
commit 4b44acbc61
2 changed files with 115 additions and 52 deletions

View File

@ -1,38 +1,83 @@
# Copyright 2014 Mirantis, Inc.
# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# vmware::controller deploys nova-compute service and configures it for use
# with vmwareapi.VCDriver (vCenter server as hypervisor) on OpenStack controller
# nodes. Nova-compute is configured to work under Pacemaker supervision.
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# == Class: vmware::controller
#
# Deploys nova-compute service and configures it for use
# with vmwareapi.VCDriver (vCenter server as hypervisor)
# on OpenStack controller nodes. Nova-compute is configured
# to work under Pacemaker supervision.
#
# === Parameters
#
# [*vcenter_settings*]
# (optional) Computes hash in format of:
# Defaults to undef.
# Example:
# "[ {"availability_zone_name"=>"vcenter", "datastore_regex"=>".*",
# "service_name"=>"vm_cluster1", "target_node"=>"controllers",
# "vc_cluster"=>"Cluster1", "vc_host"=>"172.16.0.254",
# "vc_password"=>"Qwer!1234", "vc_user"=>"administrator@vsphere.local"},
# {"availability_zone_name"=>"vcenter", "datastore_regex"=>".*",
# "service_name"=>"vm_cluster2", "target_node"=>"node-65",
# "vc_cluster"=>"Cluster2", "vc_host"=>"172.16.0.254",
# "vc_password"=>"Qwer!1234", "vc_user"=>"administrator@vsphere.local"} ]"
#
# [*vcenter_host_ip*]
# (required) vCenter server hostname or IP address.
# Defaults to 10.10.10.10.
#
# [*vcenter_user*]
# (required) Username for authenticating with vCenter server.
# Defaults to user.
#
# [*vcenter_password*]
# (required) Password for authenticating with vCenter server.
# Defaults to password.
#
# [*vlan_interface*]
# (optional) VLAN interface on which networks will be provisioned
# if VLANManager is used for nova-network.
# Defaults to undef.
#
# [*vncproxy_host*]
# (optional) IP address on which VNC server will be listening on.
# Defaults to undef.
#
# [*vncproxy_protocol*]
# (optional) The protocol to communicate with the VNC proxy server.
# Defaults to http.
#
# [*vncproxy_port*]
# (optional) The port to communicate with the VNC proxy server.
# Defaults to 6080.
#
# [*vncproxy_path*]
# (optional) The path at the end of the uri for communication
# with the VNC proxy server.
# Defaults to "/vnc_auto.html".
#
# [*use_quantum*]
# (optional) Shows if neutron is enabled.
# Defaults to false.
#
# Modules needed:
# nova
#
# Limitations:
# Only one vCenter supported.
#
# Variables:
# vcenter_settings -
# vcenter_host_ip - vCenter server hostname or IP address
# vcenter_user - username for vCenter server
# vcenter_password - password for $vcenter_user
# vlan_interface - VLAN interface on which networks will be provisioned
# if VLANManager is used for nova-network
# vncproxy_host - IP address on which VNC server will be listening on
# vncproxy_protocol - the protocol to communicate with the VNC proxy server
# vncproxy_port - the port to communicate with the VNC proxy server
# vncproxy_path - the path at the end of the uri for communication
# with the VNC proxy server
# use_quantum - shows if neutron is enabled
# modules needed: nova
# limitations:
# - only one vcenter supported
class vmware::controller (
$vcenter_settings = undef,
$vcenter_host_ip = '10.10.10.10',
@ -46,7 +91,7 @@ class vmware::controller (
$use_quantum = false,
)
{
include nova::params
include ::nova::params
$vncproxy_base_url = "${vncproxy_protocol}://${vncproxy_host}:${vncproxy_port}${vncproxy_path}"
# Stubs from nova class in order to not include whole class
@ -60,8 +105,8 @@ class vmware::controller (
refreshonly => true,
}
package { 'nova-common':
ensure => 'installed',
name => 'binutils',
ensure => 'installed',
name => 'binutils',
}
}
@ -76,34 +121,34 @@ class vmware::controller (
}
service { 'nova-compute':
name => $::nova::params::compute_service_name,
ensure => 'stopped',
enable => false
name => $::nova::params::compute_service_name,
enable => false,
}
# Create nova-compute per vsphere cluster
# Create nova-compute per vSphere cluster.
create_resources(vmware::compute::ha, parse_vcenter_settings($vcenter_settings))
Package['nova-compute']->
Service['nova-compute']->
Vmware::Compute::Ha<||>->
class { 'vmware::network':
class { '::vmware::network':
use_quantum => $use_quantum,
}
# Enable metadata service on Controller node
# Set correct parameter for vnc access
# Enable metadata service on Controller node.
# Set correct parameter for vnc access.
nova_config {
'DEFAULT/enabled_apis': value => 'ec2,osapi_compute,metadata';
'DEFAULT/novncproxy_base_url': value => $vncproxy_base_url;
'DEFAULT/enabled_apis': value => 'ec2,osapi_compute,metadata';
'vnc/novncproxy_base_url': value => $vncproxy_base_url;
} -> Service['nova-compute']
# install cirros vmdk package
# Install cirros vmdk package.
package { 'cirros-testvmware':
ensure => present
ensure => present,
}
package { 'python-suds':
ensure => present
ensure => present,
}
}

View File

@ -8,16 +8,34 @@ manifest = 'vmware/vcenter.pp'
describe manifest do
shared_examples 'catalog' do
network_manager = Noop.hiera_structure('novanetwork_parameters/network_manager')
use_vcenter = Noop.hiera('use_vcenter', 'false')
ssl_hash = Noop.hiera_hash 'use_ssl', {}
vncproxy_protocol = 'https'
vncproxy_port = '6080'
vcnproxy_path = '/vnc_auto.html'
if network_manager == 'VlanManager'
it 'should declare vmware::controller with vlan_interface option set to vmnic0' do
should contain_class('vmware::controller').with(
'vlan_interface' => 'vmnic0',
)
end
if !ssl_hash.empty?
vncproxy_host = Noop.hiera_structure('use_ssl/nova_public_hostname')
elsif Noop.hiera_structure('public_ssl/services')
vncproxy_host = Noop.hiera_structure('public_ssl/hostname')
else
vncproxy_host = Noop.hiera('public_vip')
vncproxy_protocol = 'http'
end
if use_vcenter
it 'should properly configure vncproxy with (non-)ssl' do
should contain_class('vmware::controller').with(:vncproxy_host => vncproxy_host)
should contain_class('vmware::controller').with(:vncproxy_protocol => vncproxy_protocol)
should contain_class('vmware::controller').with(:vncproxy_port => vncproxy_port)
should contain_class('vmware::controller').with(:vncproxy_path => vcnproxy_path)
end
it 'should configure novncproxy_base_url setting' do
should contain_nova_config('vnc/novncproxy_base_url').with(
:value => "#{vncproxy_protocol}://#{vncproxy_host}:#{vncproxy_port}#{vcnproxy_path}"
)
end
end # end of use_vcenter
end # end of shared_examples
test_ubuntu_and_centos manifest