aboutsummaryrefslogtreecommitdiffstats
path: root/modules/libvirtd/manifests/init.pp
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2011-03-29 22:47:59 +0000
committerMichael Scherer <misc@mageia.org>2011-03-29 22:47:59 +0000
commit5d5a3a39efe043dd49897f087528d6e03e5893e5 (patch)
tree9fac44a96292a034e8e418e10e75dbaad13865fc /modules/libvirtd/manifests/init.pp
parent008e72818c517857b16da51871bca3b85510831c (diff)
downloadpuppet-5d5a3a39efe043dd49897f087528d6e03e5893e5.tar
puppet-5d5a3a39efe043dd49897f087528d6e03e5893e5.tar.gz
puppet-5d5a3a39efe043dd49897f087528d6e03e5893e5.tar.bz2
puppet-5d5a3a39efe043dd49897f087528d6e03e5893e5.tar.xz
puppet-5d5a3a39efe043dd49897f087528d6e03e5893e5.zip
add a type to be able to manage storage directory for libvirtd
Diffstat (limited to 'modules/libvirtd/manifests/init.pp')
-rw-r--r--modules/libvirtd/manifests/init.pp33
1 files changed, 33 insertions, 0 deletions
diff --git a/modules/libvirtd/manifests/init.pp b/modules/libvirtd/manifests/init.pp
index da04bbfa..193099c9 100644
--- a/modules/libvirtd/manifests/init.pp
+++ b/modules/libvirtd/manifests/init.pp
@@ -11,6 +11,23 @@ class libvirtd {
ensure => running,
path => "/etc/init.d/libvirtd",
}
+
+ #TODO remove once libvirt package is fixed to manage the directory
+ file { "/etc/libvirt/storage":
+ ensure => directory,
+ }
+
+ file { "/etc/libvirt/storage/autostart":
+ ensure => directory,
+ }
+
+ file { "/usr/local/bin/storage_add.py":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 755,
+ source => "puppet:///libvirtd/storage_add.py",
+ }
}
class kvm inherits base {
@@ -33,4 +50,20 @@ class libvirtd {
content => template("libvirtd/50-template-libvirt-remote-access.pkla"),
}
}
+
+ define storage($path, $autostart = true) {
+ include libvirtd::base
+
+ exec { "/usr/local/bin/storage_add.py $name $path":
+ creates => "/etc/libvirt/storage/$name.xml",
+ require => File['/usr/local/bin/storage_add.py'],
+ }
+
+ file { "/etc/libvirt/storage/autostart/$name.xml":
+ ensure => $autostart ? {
+ true => "/etc/libvirt/storage/$name.xml",
+ false => "absent"
+ }
+ }
+ }
}