From 4a94945884a1b8a2bd7eb0f31350841fc704e65b Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Mon, 5 Nov 2012 22:36:58 -0800 Subject: [PATCH] Add Redhat support This commit adds red hat support to cinder. - Adds Redhat package names - Make package installations optional - Make cinder client package name per OS --- manifests/api.pp | 15 +++++++++------ manifests/client.pp | 1 + manifests/params.pp | 16 ++++++++++++++++ manifests/scheduler.pp | 15 +++++++++------ manifests/volume.pp | 17 ++++++++++------- 5 files changed, 45 insertions(+), 19 deletions(-) diff --git a/manifests/api.pp b/manifests/api.pp index d59c5357..73a11e08 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -16,12 +16,15 @@ class cinder::api ( Cinder_config<||> ~> Service['cinder-api'] Cinder_config<||> ~> Exec['cinder-manage db_sync'] Cinder_api_paste_ini<||> ~> Service['cinder-api'] - Package['cinder-api'] -> Cinder_config<||> - Package['cinder-api'] -> Cinder_api_paste_ini<||> - package { 'cinder-api': - name => $::cinder::params::api_package, - ensure => $package_ensure, + if $::cinder::params::api_package { + Package['cinder-api'] -> Cinder_config<||> + Package['cinder-api'] -> Cinder_api_paste_ini<||> + Package['cinder-api'] -> Service['cinder-api'] + package { 'cinder-api': + name => $::cinder::params::api_package, + ensure => $package_ensure, + } } if $enabled { @@ -34,7 +37,7 @@ class cinder::api ( name => $::cinder::params::api_service, enable => $enabled, ensure => $ensure, - require => Package[$::cinder::params::api_package], + require => Package['cinder'], } if $keystone_enabled { diff --git a/manifests/client.pp b/manifests/client.pp index 1e4601a2..6ddb4c7b 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -2,6 +2,7 @@ class cinder::client( $package_ensure = 'present' ) { package { 'python-cinderclient': + name => $::cinder::params::client_package, ensure => $package_ensure, } } diff --git a/manifests/params.pp b/manifests/params.pp index 47d75013..814d6f38 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -6,6 +6,7 @@ class cinder::params { if $::osfamily == 'Debian' { $package_name = 'cinder-common' + $client_package = 'python-cinderclient' $api_package = 'cinder-api' $api_service = 'cinder-api' $scheduler_package = 'cinder-scheduler' @@ -16,6 +17,21 @@ class cinder::params { $tgt_package_name = 'tgt' $tgt_service_name = 'tgt' + + } elsif($::osfamily == 'RedHat') { + + $package_name = 'openstack-cinder' + $client_package = 'python-cinderclient' + $api_package = false + $api_service = 'openstack-cinder-api' + $scheduler_package = false + $scheduler_service = 'openstack-cinder-scheduler' + $volume_package = false + $volume_service = 'openstack-cinder-volume' + $db_sync_command = 'cinder-manage db sync' + $tgt_package_name = 'scsi-target-utils' + $tgt_service_name = 'tgtd' + } else { fail("unsuported osfamily ${::osfamily}, currently Debian is the only supported platform") } diff --git a/manifests/scheduler.pp b/manifests/scheduler.pp index af88a72c..aaa9da97 100644 --- a/manifests/scheduler.pp +++ b/manifests/scheduler.pp @@ -6,14 +6,17 @@ class cinder::scheduler ( include cinder::params - Package['cinder-scheduler'] -> Cinder_config<||> - Package['cinder-scheduler'] -> Cinder_api_paste_ini<||> Cinder_api_paste_ini<||> ~> Service['cinder-scheduler'] Exec<| title == 'cinder-manage db_sync' |> ~> Service['cinder-scheduler'] - package { 'cinder-scheduler': - name => $::cinder::params::scheduler_package, - ensure => $package_ensure, + if $::cinder::params::scheduler_package { + Package['cinder-scheduler'] -> Cinder_config<||> + Package['cinder-scheduler'] -> Cinder_api_paste_ini<||> + Package['cinder-scheduler'] -> Service['cinder-scheduler'] + package { 'cinder-scheduler': + name => $::cinder::params::scheduler_package, + ensure => $package_ensure, + } } if $enabled { @@ -26,7 +29,7 @@ class cinder::scheduler ( name => $::cinder::params::scheduler_service, enable => $enabled, ensure => $ensure, - require => Package[$::cinder::params::scheduler_package], + require => Package['cinder'], subscribe => File[$::cinder::params::cinder_conf], } } diff --git a/manifests/volume.pp b/manifests/volume.pp index a90f6cfc..58d496a0 100644 --- a/manifests/volume.pp +++ b/manifests/volume.pp @@ -6,15 +6,18 @@ class cinder::volume ( include cinder::params - Package['cinder-volume'] -> Cinder_config<||> - Package['cinder-volume'] -> Cinder_api_paste_ini<||> - Package['cinder'] -> Package['cinder-volume'] Cinder_config<||> ~> Service['cinder-volume'] Cinder_api_paste_ini<||> ~> Service['cinder-volume'] - package { 'cinder-volume': - name => $::cinder::params::volume_package, - ensure => $package_ensure, + if $::cinder::params::volume_package { + Package['cinder-volume'] -> Cinder_config<||> + Package['cinder-volume'] -> Cinder_api_paste_ini<||> + Package['cinder'] -> Package['cinder-volume'] + Package['cinder-volume'] -> Service['cinder-volume'] + package { 'cinder-volume': + name => $::cinder::params::volume_package, + ensure => $package_ensure, + } } if $enabled { @@ -27,7 +30,7 @@ class cinder::volume ( name => $::cinder::params::volume_service, enable => $enabled, ensure => $ensure, - require => Package['cinder-volume'], + require => Package['cinder'], subscribe => File[$::cinder::params::cinder_conf], }