aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/kvm/manager/instance.pp11
-rw-r--r--templates/kvm_creator.rules.erb3
2 files changed, 14 insertions, 0 deletions
diff --git a/manifests/kvm/manager/instance.pp b/manifests/kvm/manager/instance.pp
index 4f52310..4957645 100644
--- a/manifests/kvm/manager/instance.pp
+++ b/manifests/kvm/manager/instance.pp
@@ -2,6 +2,7 @@ define virtual::kvm::manager::instance(
$vg,
$size,
$ram,
+ $udev = false,
) {
exec { "kvm-creator-${name}":
command => "/usr/local/sbin/kvm-creator create $name $vg $size $ram",
@@ -22,4 +23,14 @@ define virtual::kvm::manager::instance(
creates => "/etc/service/${name}",
require => [ Exec["kvm-creator-${name}"], User["${name}"] ],
}
+
+ if $udev == true {
+ file { "/etc/udev/rules.d/92-kvm_creator-${name}.rules":
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 0644,
+ content => template('virtual/kvm_creator.rules.erb'),
+ }
+ }
}
diff --git a/templates/kvm_creator.rules.erb b/templates/kvm_creator.rules.erb
new file mode 100644
index 0000000..8267d90
--- /dev/null
+++ b/templates/kvm_creator.rules.erb
@@ -0,0 +1,3 @@
+ACTION=="change", SUBSYSTEM=="block", ATTR{dm/name}=="<%= scope.lookupvar('::hostname') %>-<%= @name %>", GROUP="<%= @name %>"
+ACTION=="change", SUBSYSTEM=="block", ATTR{dm/name}=="<%= @name %>", GROUP="<%= @name %>"
+ACTION=="change", SUBSYSTEM=="block", ATTR{dm/name}=="<%= @name %>1", GROUP="<%= @name %>"