Refactor vnc code

This commit refactors the vnc implementation.

Refactors vnc related parameters to be coupled with
the services that need them. I am not entirely sure
about which service novncproxy_base is coupled with
so it is still defined in the nova class.

Adds the class nova::consoleauth.

Refactor vncproxy to install from source.
This commit is contained in:
Dan Bode 2012-04-23 16:53:57 -07:00
parent c14249480e
commit 8fe43360fb
7 changed files with 87 additions and 18 deletions

View File

@ -183,11 +183,14 @@ class { 'nova::cert':
}
class { 'nova::compute':
enabled => true,
enabled => true,
vnc_enabled => true,
vncserver_proxyclient_address => '127.0.0.1',
}
class { 'nova::compute::libvirt':
libvirt_type => 'qemu',
libvirt_type => 'qemu',
vncserver_listen => '127.0.0.1',
}
nova::network::bridge { 'br100':

View File

@ -1,8 +1,11 @@
#schedulee this class should probably never be declared except
# from the virtualization implementation of the compute node
class nova::compute(
$enabled = false
) inherits nova {
$enabled = false,
$vnc_enabled = true,
$vncserver_proxyclient_address = '127.0.0.1',
$novncproxy_base_url = 'http://127.0.0.1:6080/vnc_auto.htm'
) {
nova::generic_service { 'compute':
enabled => $enabled,
@ -11,4 +14,10 @@ class nova::compute(
before => Exec['networking-refresh']
}
# config for vnc proxy
nova_config {
'vnc_enabled': value => $vnc_enabled;
'vncserver_proxyclient_address': value => $vncserver_proxyclient_address;
}
}

View File

@ -1,5 +1,6 @@
class nova::compute::libvirt (
$libvirt_type = 'kvm'
$libvirt_type = 'kvm',
$vncserver_listen = '127.0.0.1'
) inherits nova::compute{
include nova::params
@ -29,4 +30,5 @@ class nova::compute::libvirt (
nova_config { 'libvirt_type': value => $libvirt_type }
nova_config { 'connection_type': value => 'libvirt' }
nova_config { 'vncserver_listen': value => $vncserver_listen }
}

19
manifests/consoleauth.pp Normal file
View File

@ -0,0 +1,19 @@
#
# Installs and configures consoleauth service
#
# The consoleauth service is required for vncproxy auth
# for Horizon
#
class nova::consoleauth(
$enabled = false
) {
include nova::params
nova::generic_service { 'consoleauth':
enabled => $enabled,
package_name => $::nova::params::consoleauth_package_name,
service_name => $::nova::params::consoleauth_service_name,
}
}

View File

@ -35,8 +35,6 @@ class nova(
$admin_tenant_name = 'services',
$admin_user = 'nova',
$admin_password = 'passw0rd',
$vncserver_listen = '127.0.0.1',
$vncserver_proxyclient_address = '127.0.0.1',
$novncproxy_base_url = 'http://127.0.0.1:6080/vnc_auto.htm'
) inherits nova::params {
@ -167,8 +165,7 @@ class nova(
'multi_host': value => $multi_host_networking;
'root_helper': value => $root_helper;
'auth_strategy': value => $auth_strategy;
'vncserver_listen': value => $vncserver_listen;
'vncserver_proxyclient_address': value => $vncserver_proxyclient_address;
# vnc config
'novncproxy_base_url': value => $novncproxy_base_url;
}

View File

@ -9,6 +9,7 @@ class nova::params {
$cert_package_name = false
$common_package_name = 'openstack-nova'
$compute_package_name = false
$consoleauth_package_name = false
$doc_package_name = 'openstack-nova-doc'
$network_package_name = false
$objectstore_package_name = false
@ -20,6 +21,7 @@ class nova::params {
$api_service_name = 'openstack-nova-api'
$cert_service_name = 'openstack-nova-cert'
$compute_service_name = 'openstack-nova-compute'
$consoleauth_service_name = 'openstack-nova-consoleauth'
$network_service_name = 'openstack-nova-network'
$objectstore_service_name = 'openstack-nova-objectstore'
$scheduler_service_name = 'openstack-nova-scheduler'
@ -38,6 +40,7 @@ class nova::params {
$cert_package_name = 'nova-cert'
$common_package_name = 'nova-common'
$compute_package_name = 'nova-compute'
$consoleauth_package_name = 'nova-consoleauth'
$doc_package_name = 'nova-doc'
$network_package_name = 'nova-network'
$objectstore_package_name = 'nova-objectstore'
@ -49,6 +52,7 @@ class nova::params {
$api_service_name = 'nova-api'
$cert_service_name = 'nova-cert'
$compute_service_name = 'nova-compute'
$consoleauth_service_name = 'nova-consoleauth'
$network_service_name = 'nova-network'
$objectstore_service_name = 'nova-objectstore'
$scheduler_service_name = 'nova-scheduler'

View File

@ -1,13 +1,48 @@
class nova::vncproxy(
$package_name = $::nova::params::vncproxy_package_name
) {
class nova::vncproxy() {
if($package_name) {
package { 'nova-vncproxy':
name => $package_name,
ensure => present,
before => Exec['initial-db-sync'],
}
# TODO make this work on Fedora
# See http://nova.openstack.org/runnova/vncconsole.html for more details.
package{ "noVNC":
ensure => purged,
}
file { '/etc/init.d/nova-novncproxy':
ensure => present,
source => 'puppet:///modules/openstack/nova/nova-novncproxy.init',
mode => 0750,
}
# this temporary upstart script needs to be removed
file { '/etc/init/nova-novncproxy.conf':
ensure => present,
content =>
'
description "nova noVNC Proxy server"
author "Etienne Pelletier <epelletier@morphlabs.com>"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [016]
respawn
exec su -s /bin/bash -c "exec /var/lib/nova/noVNC/utils/nova-novncproxy --flagfile=/etc/nova/nova.conf --web=/var/lib/nova/noVNC" nova
',
mode => 0750,
}
# TODO this is terrifying, it is grabbing master
# I should at least check out a branch
vcsrepo { '/var/lib/nova/noVNC':
ensure => latest,
provider => git,
source => 'https://github.com/cloudbuilders/noVNC.git',
revision => 'HEAD',
require => Package['git','nova-api'],
}
service { 'novncproxy':
provider => upstart,
require => Vcsrepo['/var/lib/nova/noVNC']
}
}