checking Nova integration work 5/26/11
This commit is contained in:
parent
35933a2616
commit
e2eaf1313d
|
@ -0,0 +1,33 @@
|
||||||
|
require 'puppet/provider/parsedfile'
|
||||||
|
|
||||||
|
novaconf = "/etc/nova/nova.conf"
|
||||||
|
|
||||||
|
Puppet::Type.type(:nova_config).provide(
|
||||||
|
:parsed,
|
||||||
|
:parent => Puppet::Provider::ParsedFile,
|
||||||
|
:default_target => novaconf,
|
||||||
|
:filetype => :flat
|
||||||
|
) do
|
||||||
|
|
||||||
|
confine :exists => novaconf
|
||||||
|
text_line :comment, :match => /^\s*#/;
|
||||||
|
text_line :blank, :match => /^\s*$/;
|
||||||
|
|
||||||
|
record_line :parsed,
|
||||||
|
:fields => %w{line},
|
||||||
|
:match => /--(.*)/ ,
|
||||||
|
:post_parse => proc { |hash|
|
||||||
|
Puppet.debug("nova config line:#{hash[:line]} has been parsed")
|
||||||
|
if hash[:line] =~ /(\S+)\s*=\s*(\S+)/
|
||||||
|
hash[:name]=$1
|
||||||
|
hash[:value]=$2
|
||||||
|
else
|
||||||
|
raise Puppet::Error, "Invalid line: #{hash[:line]}"
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
def self.to_line(hash)
|
||||||
|
"--#{hash[:name]}=#{hash[:value]}"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,24 @@
|
||||||
|
Puppet::Type.newtype(:nova_config) do
|
||||||
|
|
||||||
|
ensurable
|
||||||
|
|
||||||
|
newparam(:name, :namevar => true) do
|
||||||
|
newvalues(/\S+/)
|
||||||
|
end
|
||||||
|
|
||||||
|
newproperty(:value) do
|
||||||
|
newvalues(/\S+/)
|
||||||
|
end
|
||||||
|
|
||||||
|
newproperty(:target) do
|
||||||
|
desc "Path to our nova config file"
|
||||||
|
defaultto {
|
||||||
|
if @resource.class.defaultprovider.ancestors.include?(Puppet::Provider::ParsedFile)
|
||||||
|
@resource.class.defaultprovider.default_target
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
|
@ -2,6 +2,7 @@ class nova::all(
|
||||||
$xenapi_connection_url,
|
$xenapi_connection_url,
|
||||||
$xenapi_connection_username,
|
$xenapi_connection_username,
|
||||||
$xenapi_connection_password,
|
$xenapi_connection_password,
|
||||||
|
$xenapi_inject_image = 'false',
|
||||||
$sql_connection,
|
$sql_connection,
|
||||||
$network_manager,
|
$network_manager,
|
||||||
$image_service,
|
$image_service,
|
||||||
|
@ -9,7 +10,6 @@ class nova::all(
|
||||||
$nodaemon = 'undef',
|
$nodaemon = 'undef',
|
||||||
$flat_network_bridge = 'xenbr0',
|
$flat_network_bridge = 'xenbr0',
|
||||||
$connection_type = 'xenapi',
|
$connection_type = 'xenapi',
|
||||||
$xenapi_inject_image = 'false',
|
|
||||||
$rescue_timeout = '86400',
|
$rescue_timeout = '86400',
|
||||||
$allow_admin_api = 'true',
|
$allow_admin_api = 'true',
|
||||||
$xenapi_inject_image = 'false',
|
$xenapi_inject_image = 'false',
|
||||||
|
@ -43,4 +43,10 @@ class nova::all(
|
||||||
class { "nova::network": isServiceEnabled => false }
|
class { "nova::network": isServiceEnabled => false }
|
||||||
class { "nova::objectstore": isServiceEnabled => false }
|
class { "nova::objectstore": isServiceEnabled => false }
|
||||||
class { "nova::scheduler": isServiceEnabled => false }
|
class { "nova::scheduler": isServiceEnabled => false }
|
||||||
|
class { 'nova::db':
|
||||||
|
password => 'password',
|
||||||
|
name => 'nova',
|
||||||
|
user => 'nova',
|
||||||
|
host => 'localhost',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,24 @@
|
||||||
class nova::compute( $isServiceEnabled=false ) inherits nova {
|
class nova::compute(
|
||||||
|
$enabled = false,
|
||||||
|
$nova_config = '/etc/nova/nova.conf'
|
||||||
|
) {
|
||||||
|
|
||||||
|
Nova_config<| |>~>Service['nova_compute']
|
||||||
|
|
||||||
|
if $enabled {
|
||||||
|
$service_ensure = 'running'
|
||||||
|
} else {
|
||||||
|
$service_ensure = 'stopped'
|
||||||
|
}
|
||||||
|
|
||||||
package { "nova-compute":
|
package { "nova-compute":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
require => Package["python-greenlet"]
|
require => Class['nova']
|
||||||
}
|
}
|
||||||
|
|
||||||
service { "nova-compute":
|
service { "nova-compute":
|
||||||
ensure => $isServiceEnabled,
|
ensure => $service_ensure,
|
||||||
|
enable => $enabled,
|
||||||
require => Package["nova-compute"],
|
require => Package["nova-compute"],
|
||||||
subscribe => File["/etc/nova/nova.conf"]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
class nova::compute::xenserver(
|
||||||
|
$enabled = false
|
||||||
|
$xenapi_connection_url,
|
||||||
|
$xenapi_connection_username,
|
||||||
|
$xenapi_connection_password,
|
||||||
|
$xenapi_inject_image=false,
|
||||||
|
) inherits nova {
|
||||||
|
|
||||||
|
class { 'nova::compute':
|
||||||
|
enabled => $enabled,
|
||||||
|
}
|
||||||
|
|
||||||
|
nova_config { 'xenapi_connection_url':
|
||||||
|
value => $xenapi_connection_url,
|
||||||
|
}
|
||||||
|
nova_config { 'xenapi_connection_username':
|
||||||
|
value => $xenapi_connection_username,
|
||||||
|
}
|
||||||
|
nova_config { 'xenapi_connection_password':
|
||||||
|
value => $xenapi_connection_password,
|
||||||
|
}
|
||||||
|
nova_config { 'xenapi_inject_image':
|
||||||
|
value => $xenapi_inject_image,
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
class nova::db(
|
class nova::db(
|
||||||
$db_pw,
|
$password,
|
||||||
$db_user = 'nova'
|
$name = 'nova',
|
||||||
$db_name = 'nova',
|
$user = 'nova',
|
||||||
$db_host => 'localhost'
|
$host = 'localhost'
|
||||||
) {
|
) {
|
||||||
mysql::db { $db_name:
|
mysql::db { $name:
|
||||||
db_user => $db_user,
|
user => $user,
|
||||||
db_pw => $db_pw,
|
password => $password,
|
||||||
db_hostname => $db_hostname,
|
host => $host,
|
||||||
# I may want to inject some sql
|
# I may want to inject some sql
|
||||||
# sql='',
|
# sql='',
|
||||||
require => Class['mysql::server']
|
require => Class['mysql::server'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
class nova( $novaConfHash ) {
|
class nova(
|
||||||
|
$verbose = false,
|
||||||
|
$nodaemon = false,
|
||||||
|
sql_connection,
|
||||||
|
# just for network?
|
||||||
|
network_manager
|
||||||
|
) {
|
||||||
|
|
||||||
class { 'puppet': }
|
class { 'puppet': }
|
||||||
class {
|
class {
|
||||||
|
@ -18,9 +24,5 @@ class nova( $novaConfHash ) {
|
||||||
require => Package["python-greenlet"]
|
require => Package["python-greenlet"]
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/etc/nova/nova.conf":
|
Nova_config<| require +> Package["nova-common"] |>
|
||||||
ensure => present,
|
|
||||||
content => template("nova/nova.conf.erb"),
|
|
||||||
require => Package["nova-common"]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,3 +23,10 @@ class nova-compute-test {
|
||||||
class { "nova::compute": isServiceEnabled => false }
|
class { "nova::compute": isServiceEnabled => false }
|
||||||
}
|
}
|
||||||
include nova-compute-test
|
include nova-compute-test
|
||||||
|
|
||||||
|
|
||||||
|
class { 'nova::compute':
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class { 'nova': }
|
|
@ -0,0 +1,9 @@
|
||||||
|
class { 'mysql::server':
|
||||||
|
root_password => 'password'
|
||||||
|
}
|
||||||
|
class { 'nova::db':
|
||||||
|
password => 'password',
|
||||||
|
name => 'nova',
|
||||||
|
user => 'nova',
|
||||||
|
host => 'localhost',
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
resources { 'nova_config':
|
||||||
|
purge => true
|
||||||
|
}
|
||||||
|
nova_config { ['verbose', 'nodaemomize']:
|
||||||
|
value => 'true',
|
||||||
|
}
|
||||||
|
nova_config { 'xenapi_connection_username':
|
||||||
|
value => 'rootty',
|
||||||
|
}
|
|
@ -9,6 +9,9 @@ class { 'apt':
|
||||||
class { 'nova::repo':
|
class { 'nova::repo':
|
||||||
stage => 'repo-setup',
|
stage => 'repo-setup',
|
||||||
}
|
}
|
||||||
|
class { 'mysql::server':
|
||||||
|
root_password => 'password'
|
||||||
|
}
|
||||||
class { 'nova::all':
|
class { 'nova::all':
|
||||||
verbose => 'undef',
|
verbose => 'undef',
|
||||||
nodaemon => 'undef',
|
nodaemon => 'undef',
|
||||||
|
@ -28,17 +31,3 @@ class { 'nova::all':
|
||||||
ipv6_backend => 'account_identifier',
|
ipv6_backend => 'account_identifier',
|
||||||
}
|
}
|
||||||
|
|
||||||
# this will probably be on its own machine
|
|
||||||
class mysql::server {
|
|
||||||
mysql_root_pw => 'foo',
|
|
||||||
}
|
|
||||||
|
|
||||||
mysql::db {
|
|
||||||
db_user,
|
|
||||||
db_pw,
|
|
||||||
db_charset = 'utf8',
|
|
||||||
host = 'localhost',
|
|
||||||
grant='all',
|
|
||||||
sql=''
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue