From 5cbcdb956b0bacb02229ca2085aa1245e7308dcc Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 15 Oct 2016 15:24:24 -0300 Subject: Adds udev param into virtual::kvm::manager --- manifests/kvm/manager/instance.pp | 11 +++++++++++ templates/kvm_creator.rules.erb | 3 +++ 2 files changed, 14 insertions(+) create mode 100644 templates/kvm_creator.rules.erb 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 %>" -- cgit v1.2.3