Skip to content

Commit b17613b

Browse files
committed
Merge pull request #139 from gdhgdhgdh/master
Assortment of improvements for CentOS 7
2 parents bc0b2b4 + a4f70f6 commit b17613b

13 files changed

Lines changed: 320 additions & 40 deletions

File tree

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ group :development, :test do
66
gem 'puppetlabs_spec_helper', :require => false
77
gem 'puppet-lint', :require => false
88
gem 'simplecov', :require => false
9+
gem 'minitest', '<5.0'
910
gem 'nokogiri', '<= 1.5.10'
1011
end
1112

lib/puppet/provider/onedatastore/cli.rb

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def create
3434
xml.send(resource[:safe_dirs].join(' '))
3535
end if resource[:safe_dirs]
3636
xml.DS_MAD resource[:dm]
37+
xml.BRIDGE_LIST resource[:bridgelist]
38+
xml.CEPH_HOST resource[:cephhost]
39+
xml.STAGING_DIR resource[:stagingdir]
3740
xml.BASE_PATH do
3841
resource[:basepath]
3942
end if resource[:basepath]
@@ -60,14 +63,17 @@ def self.instances
6063
datastores = Nokogiri::XML(onedatastore('list','-x')).root.xpath('/DATASTORE_POOL/DATASTORE').map
6164
datastores.collect do |datastore|
6265
new(
63-
:name => datastore.xpath('./NAME').text,
64-
:ensure => :present,
65-
:type => datastore.xpath('./TEMPLATE/TYPE').text,
66-
:dm => (datastore.xpath('./TEMPLATE/DS_MAD').text unless datastore.xpath('./TEMPLATE/DS_MAD').nil?),
67-
:safe_dirs => (datastore.xpath('./TEMPLATE/SAFE_DIRS').text unless datastore.xpath('./TEMPLATE/SAFE_DIRS').nil?),
68-
:tm => (datastore.xpath('./TEMPLATE/TM_MAD').text unless datastore.xpath('./TEMPLATE/TM_MAD').nil?),
69-
:basepath => (datastore.xpath('./TEMPLATE/BASE_PATH').text unless datastore.xpath('./TEMPLATE/BASE_PATH').nil?),
70-
:disktype => {0 => 'file', 1 => 'block', 2 => 'rdb'}[datastore.xpath('./DISK_TYPE').text]
66+
:name => datastore.xpath('./NAME').text,
67+
:ensure => :present,
68+
:type => datastore.xpath('./TEMPLATE/TYPE').text,
69+
:dm => (datastore.xpath('./TEMPLATE/DS_MAD').text unless datastore.xpath('./TEMPLATE/DS_MAD').nil?),
70+
:safe_dirs => (datastore.xpath('./TEMPLATE/SAFE_DIRS').text unless datastore.xpath('./TEMPLATE/SAFE_DIRS').nil?),
71+
:tm => (datastore.xpath('./TEMPLATE/TM_MAD').text unless datastore.xpath('./TEMPLATE/TM_MAD').nil?),
72+
:basepath => (datastore.xpath('./TEMPLATE/BASE_PATH').text unless datastore.xpath('./TEMPLATE/BASE_PATH').nil?),
73+
:bridgelist => (datastore.xpath('./TEMPLATE/BRIDGE_LIST').text unless datastore.xpath('./TEMPLATE/BRIDGE_LIST').nil?),
74+
:cephhost => (datastore.xpath('./TEMPLATE/CEPH_HOST').text unless datastore.xpath('./TEMPLATE/CEPH_HOST').nil?),
75+
:stagingdir => (datastore.xpath('./TEMPLATE/STAGING_DIR').text unless datastore.xpath('./TEMPLATE/STAGING_DIR').nil?),
76+
:disktype => {'0' => 'file', '1' => 'block', '3' => 'rbd'}[datastore.xpath('./DISK_TYPE').text]
7177
)
7278
end
7379
end

lib/puppet/type/onedatastore.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@
5656
desc "Choose a base path"
5757
end
5858

59+
newproperty(:bridgelist) do
60+
desc "List of frontend hosts, space separated, for Ceph"
61+
end
62+
63+
newproperty(:cephhost) do
64+
desc "List of Ceph monitors, space separated"
65+
end
66+
67+
newproperty(:stagingdir) do
68+
desc "Temporary scratch space. Must be big enough to store raw image size plus sparse version"
69+
end
70+
5971
newproperty(:safe_dirs, :array_matching => :all) do
6072
desc "Array of safe directories"
6173
end

manifests/compute_node/config.pp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,22 @@
6969
source => 'puppet:///modules/one/sudoers_imaginator',
7070
}
7171

72-
file { '/sbin/brctl':
73-
ensure => link,
74-
target => '/usr/sbin/brctl',
72+
if $::osfamily == 'Debian' {
73+
file { '/sbin/brctl':
74+
ensure => link,
75+
target => '/usr/sbin/brctl',
76+
}
77+
}
78+
79+
if $::osfamily == 'RedHat' and versioncmp($::lsbmajdistrelease, '7') < 0 {
80+
file { '/sbin/brctl':
81+
ensure => link,
82+
target => '/usr/sbin/brctl',
83+
}
7584
}
7685

7786
file { 'polkit-opennebula':
78-
path => $::osfamily ? {
87+
path => $::osfamily ? {
7988
'RedHat' => '/etc/polkit-1/localauthority/50-local.d/50-org.libvirt.unix.manage-opennebula.pkla',
8089
'Debian' => '/var/lib/polkit-1/localauthority/50-local.d/50-org.libvirt.unix.manage-opennebula.pkla',
8190
},

manifests/install.pp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
content => "---\nhttp_proxy: ${http_proxy}\n",
1313
}
1414

15-
File['/etc/gemrc'] -> Package <| provider == "gem" |>
15+
File['/etc/gemrc'] -> Package <| provider == 'gem' |>
1616

1717
package { $dbus_pkg:
1818
ensure => present,
1919
require => Class['one::prerequisites'],
2020
}
2121

2222
file { '/var/lib/one':
23-
ensure => 'directory',
24-
owner => 'oneadmin',
25-
group => 'oneadmin',
23+
ensure => 'directory',
24+
owner => 'oneadmin',
25+
group => 'oneadmin',
2626
}
2727
}

manifests/oned/config.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
ensure => 'directory',
6060
ignore => 'tests/*',
6161
mode => '0750',
62-
recurse => 'true',
63-
purge => 'true',
64-
force => 'true',
62+
recurse => true,
63+
purge => true,
64+
force => true,
6565
source => $hook_scripts_path,
6666
}
6767

manifests/oned/install.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
#
1919
class one::oned::install {
2020
package { $one::params::rubygems :
21-
ensure => latest,
22-
provider => gem,
23-
require => Class['one::prerequisites'],
21+
ensure => latest,
22+
provider => gem,
23+
require => Class['one::prerequisites'],
2424
}
2525
package { $one::params::oned_packages :
2626
ensure => latest,

manifests/oned/sunstone/config.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
$listen_ip = $one::params::sunstone_listen_ip,
2121
$enable_support = $one::params::enable_support,
2222
$enable_marketplace = $one::params::enable_marketplace,
23+
$tmpdir = $one::params::sunstone_tmpdir,
2324
){
2425
File {
2526
ensure => 'file',

manifests/oned/sunstone/service.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
$srv_enable = true
2626
}
2727
service { 'opennebula-sunstone':
28-
ensure => $srv_ensure,
29-
enable => $srv_enable,
30-
require=> Service['opennebula'],
28+
ensure => $srv_ensure,
29+
enable => $srv_enable,
30+
require => Service['opennebula'],
3131
}
3232
}

manifests/params.pp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
$sunstone_listen_ip = hiera('one::oned::sunstone_listen_ip', '127.0.0.1'),
6161
$enable_support = hiera('one::oned::enable_support', 'yes'),
6262
$enable_marketplace = hiera('one::oned::enable_marketplace', 'yes'),
63+
$sunstone_tmpdir = hiera('one::oned::sunstone_tmpdir', '/var/tmp'),
6364
) {
6465
# generic params for nodes and oned
6566
$oneid = $one::oneid
@@ -122,10 +123,16 @@
122123
# params for nodes
123124
case $::osfamily {
124125
'RedHat': {
125-
$node_packages = ['opennebula-node-kvm',
126-
'sudo',
127-
'python-virtinst'
128-
]
126+
if $::lsbmajdistrelease == '7' {
127+
$node_packages = ['opennebula-node-kvm',
128+
'sudo'
129+
]
130+
} else {
131+
$node_packages = ['opennebula-node-kvm',
132+
'sudo',
133+
'python-virtinst'
134+
]
135+
}
129136
$oned_packages = ['opennebula', 'opennebula-server', 'opennebula-ruby']
130137
$dbus_srv = 'messagebus'
131138
$dbus_pkg = 'dbus'
@@ -141,7 +148,7 @@
141148
$libvirtd_srv = 'libvirtd'
142149
$libvirtd_cfg = '/etc/sysconfig/libvirtd'
143150
$libvirtd_source = 'puppet:///modules/one/libvirtd.sysconfig'
144-
$rubygems = ['builder']
151+
$rubygems = ['builder', 'sinatra']
145152
}
146153
'Debian': {
147154
$node_packages = ['opennebula-node',

0 commit comments

Comments
 (0)