From 2c8889fb72d9bfcc3cff5de485c927d64e7f78ed Mon Sep 17 00:00:00 2001 From: Faidon Liambotis Date: Wed, 20 Jun 2012 21:57:18 +0300 Subject: [PATCH] Add molly-guard hook for kvm We don't really want to reboot virtualization hosts when there KVM processes running, so stop them with a molly-guard hook. --- .../debian-org/files/molly-guard/10-check-kvm | 7 +++++++ .../15-acquire-reboot-lock} | 0 modules/debian-org/manifests/init.pp | 21 +++++++++++++------ 3 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 modules/debian-org/files/molly-guard/10-check-kvm rename modules/debian-org/files/{molly-guard-acquire-reboot-lock => molly-guard/15-acquire-reboot-lock} (100%) mode change 100755 => 100644 diff --git a/modules/debian-org/files/molly-guard/10-check-kvm b/modules/debian-org/files/molly-guard/10-check-kvm new file mode 100644 index 000000000..e9ed39ca3 --- /dev/null +++ b/modules/debian-org/files/molly-guard/10-check-kvm @@ -0,0 +1,7 @@ +#!/bin/sh + +KVMCOUNT=`pgrep -cx '^(qemu-)?kvm$'` +if [ $KVMCOUNT != 0 ]; then + echo "Found $KVMCOUNT qemu-kvm instances running, aborting $MOLLYGUARD_CMD!" + exit 1 +fi diff --git a/modules/debian-org/files/molly-guard-acquire-reboot-lock b/modules/debian-org/files/molly-guard/15-acquire-reboot-lock old mode 100755 new mode 100644 similarity index 100% rename from modules/debian-org/files/molly-guard-acquire-reboot-lock rename to modules/debian-org/files/molly-guard/15-acquire-reboot-lock diff --git a/modules/debian-org/manifests/init.pp b/modules/debian-org/manifests/init.pp index f0b70e43a..3d2fd217c 100644 --- a/modules/debian-org/manifests/init.pp +++ b/modules/debian-org/manifests/init.pp @@ -32,7 +32,6 @@ class debian-org { 'less', 'lsb-release', 'libfilesystem-ruby1.8', - 'molly-guard', 'mtr-tiny', 'nload', 'pciutils', @@ -70,6 +69,21 @@ class debian-org { } } + + package { 'molly-guard': + ensure => installed, + } + file { '/etc/molly-guard/run.d/10-check-kvm': + mode => '0755', + source => 'puppet:///modules/debian-org/molly-guard/10-check-kvm', + require => Package['molly-guard'], + } + file { '/etc/molly-guard/run.d/15-acquire-reboot-lock': + mode => '0755', + source => 'puppet:///modules/debian-org/molly-guard/15-acquire-reboot-lock', + require => Package['molly-guard'], + } + # This really means 'not wheezy' if $::debarchitecture != 'armhf' { @@ -168,11 +182,6 @@ class debian-org { source => 'puppet:///modules/debian-org/rc.local', notify => Exec['rc.local start'], } - file { '/etc/molly-guard/run.d/15-acquire-reboot-lock': - mode => '0755', - source => 'puppet:///modules/debian-org/molly-guard-acquire-reboot-lock', - require => Package['molly-guard'], - } file { '/etc/dsa': ensure => directory, mode => '0755', -- 2.20.1