From c09d2d69c72590c353efbfacc9733b88ec1a6f86 Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Fri, 24 Jun 2011 13:33:02 -0700 Subject: [PATCH] Split out compute from controller - split compute::libvirt from compute - moved network_manager and flat interface to nova class b/c they are shared by multiple components - added compute::libvirt --- manifests/compute.pp | 5 +---- manifests/compute/libvirt.pp | 12 ++++++++++++ manifests/compute/xenserver.pp | 5 +---- manifests/init.pp | 8 +++++++- manifests/network/flat.pp | 5 ----- manifests/network/flatdhcp.pp | 1 - tests/compute/libvirt.pp | 2 ++ 7 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 manifests/compute/libvirt.pp create mode 100644 tests/compute/libvirt.pp diff --git a/manifests/compute.pp b/manifests/compute.pp index acc668895..53058d030 100644 --- a/manifests/compute.pp +++ b/manifests/compute.pp @@ -4,15 +4,12 @@ class nova::compute( $api_server, $enabled = false, $api_port = 8773, - $aws_address = '169.254.169.254', - $libvirt_type = 'kvm' + $aws_address = '169.254.169.254' ) { Exec['post-nova_config'] ~> Service['nova-compute'] Exec['nova-db-sync'] ~> Service['nova-compute'] - nova_config { 'libvirt_type': value => $libvirt_type } - if $enabled { $service_ensure = 'running' } else { diff --git a/manifests/compute/libvirt.pp b/manifests/compute/libvirt.pp new file mode 100644 index 000000000..5aea5167e --- /dev/null +++ b/manifests/compute/libvirt.pp @@ -0,0 +1,12 @@ +class nova::compute::libvirt ( + $libvirt_type = 'kvm', + $flat_network_bridge = 'br100', + $flat_network_bridge_ip, + $flat_network_bridge_netmask +) { + nova_config { 'libvirt_type': value => $libvirt_type } + nova::network::bridge { $flat_network_bridge: + ip => $flat_network_bridge_ip, + netmask => $flat_network_bridge_netmask, + } +} diff --git a/manifests/compute/xenserver.pp b/manifests/compute/xenserver.pp index 123eea068..9b62a5d9b 100644 --- a/manifests/compute/xenserver.pp +++ b/manifests/compute/xenserver.pp @@ -5,10 +5,7 @@ class nova::compute::xenserver( $xenapi_connection_url, $xenapi_connection_username, $xenapi_connection_password, - $xenapi_inject_image=false, - $network_manager='nova.network.manager.FlatManager', - $flat_network_bridge='xenbr0', - $enabled=true + $xenapi_inject_image=false ) { class { 'nova::compute': diff --git a/manifests/init.pp b/manifests/init.pp index 12291b306..c992723e7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -14,7 +14,8 @@ class nova( $rabbit_port='5672', $rabbit_userid='guest', $rabbit_virtual_host='/', - # Following may need to be broken out to different nova services + $network_manager = 'nova.network.manager.FlatManager', + $flat_network_bridge = 'br100', $service_down_time = 60, $logdir = '/var/log/nova', $state_path = '/var/lib/nova', @@ -98,6 +99,11 @@ class nova( 'state_path': value => $state_path; 'lock_path': value => $lock_path; 'service_down_time': value => $service_down_time; + # These network entries wound up in the common + # config b/c they have to be set by both compute + # as well as controller. + 'network_manager': value => $network_manager; + 'flat_network_bridge': value => $flat_network_bridge; } exec { 'post-nova_config': diff --git a/manifests/network/flat.pp b/manifests/network/flat.pp index e3ccb4ca2..e599a0f35 100644 --- a/manifests/network/flat.pp +++ b/manifests/network/flat.pp @@ -11,11 +11,6 @@ class nova::network::flat ( enabled => $enabled, } - nova_config { - 'network_manager': value => 'nova.network.manager.FlatManager'; - 'flat_network_bridge': value => $flat_network_bridge; - } - # flatManager requires a network bridge be manually setup. if $configure_bridge { nova::network::bridge { $flat_network_bridge: diff --git a/manifests/network/flatdhcp.pp b/manifests/network/flatdhcp.pp index 60a2b6edf..e45e14f41 100644 --- a/manifests/network/flatdhcp.pp +++ b/manifests/network/flatdhcp.pp @@ -14,7 +14,6 @@ class nova::network::flatdhcp ( } nova_config { - 'network_manage': value => 'nova.network.manager.FlatDHCPManager'; 'public_interface': value => $public_interface; 'flat_interface': value => $flat_interface; 'flat_dhcp_start': value => $flat_dhcp_start; diff --git a/tests/compute/libvirt.pp b/tests/compute/libvirt.pp new file mode 100644 index 000000000..c5660ff4f --- /dev/null +++ b/tests/compute/libvirt.pp @@ -0,0 +1,2 @@ +$libvirt_hash = { 'nova::compute::libvirt' => {} } +create_resources( 'class', $libvirt_hash)