From 3889b71e3bc5ee13ef967d180ec62020b5b473f0 Mon Sep 17 00:00:00 2001 From: Carla Souza Date: Wed, 20 Oct 2010 11:10:13 -0300 Subject: [PATCH 01/32] Features :importable and :buildable declared to virt type. --- lib/puppet/type/virt.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/puppet/type/virt.rb b/lib/puppet/type/virt.rb index f9981cc..38fc469 100644 --- a/lib/puppet/type/virt.rb +++ b/lib/puppet/type/virt.rb @@ -2,6 +2,12 @@ module Puppet newtype(:virt) do @doc = "Manages virtual machines using the 'libvirt' hypervisor management library. The guests may be imported using an existing image, configured to use one or more virtual disks, network interfaces and other options which we haven't included yet. Create a new xen, kvm or openvz guest." + feature :buildable, "The provider can build a new guest from scratch", + :methods => [:build] + + feature :importable, "The provider can import and existing guest image", + :methods => [:import] + # A base class for numeric Virt parameters validation. class VirtNumericParam < Puppet::Parameter From f46b676e572ad91ecd63b1b769f1d8412aa7110e Mon Sep 17 00:00:00 2001 From: Carla Souza Date: Wed, 20 Oct 2010 23:36:29 -0300 Subject: [PATCH 02/32] Feature for live migration declared --- lib/puppet/type/virt.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/puppet/type/virt.rb b/lib/puppet/type/virt.rb index 38fc469..db64ba9 100644 --- a/lib/puppet/type/virt.rb +++ b/lib/puppet/type/virt.rb @@ -8,6 +8,9 @@ module Puppet feature :importable, "The provider can import and existing guest image", :methods => [:import] + feature :livemigrable, "The provider supports live migration", + :methods => [:migrate] + # A base class for numeric Virt parameters validation. class VirtNumericParam < Puppet::Parameter From 36d55325c303304ef2524258eb27467e0fb322d8 Mon Sep 17 00:00:00 2001 From: Carla Souza Date: Wed, 20 Oct 2010 23:44:12 -0300 Subject: [PATCH 03/32] Feature for live migration declared --- lib/puppet/type/virt.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/type/virt.rb b/lib/puppet/type/virt.rb index db64ba9..897f331 100644 --- a/lib/puppet/type/virt.rb +++ b/lib/puppet/type/virt.rb @@ -8,7 +8,7 @@ module Puppet feature :importable, "The provider can import and existing guest image", :methods => [:import] - feature :livemigrable, "The provider supports live migration", + feature :livemigratable, "The provider supports live migration", :methods => [:migrate] # A base class for numeric Virt parameters validation. From da2a35f4b5d5571caeeecdb71ce7668f06aeef44 Mon Sep 17 00:00:00 2001 From: Carla Souza Date: Fri, 29 Oct 2010 23:49:13 -0300 Subject: [PATCH 04/32] Starting support for PXE boot protocol --- lib/puppet/provider/virt/libvirt.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/puppet/provider/virt/libvirt.rb b/lib/puppet/provider/virt/libvirt.rb index 29fce09..4b138ce 100644 --- a/lib/puppet/provider/virt/libvirt.rb +++ b/lib/puppet/provider/virt/libvirt.rb @@ -48,9 +48,10 @@ def install(bootoninstall = true) debug "Creating new domain." fail "Only existing domain images importing is supported." # Future work - # --pxe + # ["--pxe"] # ["--location", resource[:boot_location]] - # [resource[:disk_size]] + # ["-x", resource[:boot_options]] + # ["--disk", "size=" + resource[:disk_size]] end virtinstall arguments + network + graphic From eece9728ec5c794490598f91b6d75f4b615f8957 Mon Sep 17 00:00:00 2001 From: Carla Souza Date: Fri, 29 Oct 2010 23:53:15 -0300 Subject: [PATCH 05/32] Starting support for PXE boot protocol --- lib/puppet/type/virt.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/puppet/type/virt.rb b/lib/puppet/type/virt.rb index f9981cc..ea781b1 100644 --- a/lib/puppet/type/virt.rb +++ b/lib/puppet/type/virt.rb @@ -174,6 +174,14 @@ def retrieve end + newparam(:pxe) do + desc "Use the PXE boot protocol to load the initial ramdisk and kernel for starting the guest installation process." + newvalue(:true) + newvalue(:false) + + defaultto(:false) + + end # VM parameters @@ -279,6 +287,12 @@ def retrieve end end end + + newparam(:macaddrs) do + desc "Fixed MAC address for the guest; +If this parameter is omitted, or the value \"RANDOM\" is specified a suitable address will be randomly generated. +For Xen virtual machines it is required that the first 3 pairs in the MAC address be the sequence '00:16:3e', while for QEMU or KVM virtual machines it must be '54:52:00'." + end newproperty(:on_poweroff) do desc "The content of this element specifies the action to take when the guest requests a poweroff. From 7af124c530370c7a3670e6df7554bb83c500867e Mon Sep 17 00:00:00 2001 From: Carla Souza Date: Sat, 20 Nov 2010 11:29:33 -0300 Subject: [PATCH 06/32] Syntax fix --- manifests/init.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 2ceccb4..359fe8e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,7 +8,7 @@ class virt::debian { case $virtual { - xen | kvm: { + /^(xen|kvm)/: { package { [ "linux-image-xen-686", "xen-hypervisor", "xen-tools", "xen-utils", "kvm", "qemu", "libvirt-bin", "virtinst", "libvirt-bin" ]: @@ -27,7 +27,7 @@ class virt::ubuntu { case $virtual { - xen | kvm: { + /^(xen|kvm)/: { package { [ "ubuntu-virt-server", "python-vm-builder", "kvm", "qemu", "qemu-kvm", "ubuntu-xen-server", "libvirt-ruby" ]: @@ -45,7 +45,7 @@ class virt::fedora { case $virtual { - xen | kvm: { + /^(xen|kvm)/: { package { [ "kvm", "qemu", "libvirt", "python-virtinst", "kernel-xen", "xen", "ruby-libvirt" ]: From d02ad447cadf8b195f728cabb2f86eea9d88ad50 Mon Sep 17 00:00:00 2001 From: Carla Souza Date: Sun, 21 Nov 2010 14:57:44 -0300 Subject: [PATCH 07/32] Newvalue no longer exists. Using newvalues instead. --- lib/puppet/provider/virt/libvirt.rb | 2 +- lib/puppet/type/virt.rb | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/puppet/provider/virt/libvirt.rb b/lib/puppet/provider/virt/libvirt.rb index 4b138ce..bdc7138 100644 --- a/lib/puppet/provider/virt/libvirt.rb +++ b/lib/puppet/provider/virt/libvirt.rb @@ -89,7 +89,7 @@ def interface?(ifname) # Setup the virt-install graphic configuration arguments def graphic - opt = resource[:graphics] + opt = resource[:graphic] case opt when :enable || nil then args = ["--vnc"] when :disable then args = ["--nographics"] diff --git a/lib/puppet/type/virt.rb b/lib/puppet/type/virt.rb index 0f6d6ca..16f2e5f 100644 --- a/lib/puppet/type/virt.rb +++ b/lib/puppet/type/virt.rb @@ -46,19 +46,19 @@ def numfix(num) `absent`: Removes config file, and makes sure the domain is not running." - newvalue(:stopped) do + newvalues(:stopped) do provider.stop end - newvalue(:running) do + newvalues(:running) do provider.start end - newvalue(:installed) do + newvalues(:installed) do provider.setinstalled end - newvalue(:absent) do + newvalues(:absent) do provider.destroy end @@ -185,8 +185,7 @@ def retrieve newparam(:pxe) do desc "Use the PXE boot protocol to load the initial ramdisk and kernel for starting the guest installation process." - newvalue(:true) - newvalue(:false) + newvalues(:true, :false) defaultto(:false) @@ -273,7 +272,7 @@ def retrieve end - newparam(:xml_path) do + newparam(:xml_file) do desc "This is the path to a predefined xml config file, to be used with the import function." munge do |value| @@ -357,8 +356,7 @@ def retrieve newproperty(:autoboot) do desc "Determines if the guest should start when the host starts." - newvalue(true) - newvalue(false) + newvalues(:true, :false) end From e460190d714bd093cbf165914088eb15a48e9c73 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 6 Dec 2010 21:00:58 +0100 Subject: [PATCH 08/32] place examples outside --- {manifests => examples}/virt-example.pp | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {manifests => examples}/virt-example.pp (100%) diff --git a/manifests/virt-example.pp b/examples/virt-example.pp similarity index 100% rename from manifests/virt-example.pp rename to examples/virt-example.pp From 4af6a2d7396b241d73eea6933fca23577cebb52b Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 6 Dec 2010 21:05:23 +0100 Subject: [PATCH 09/32] refactor classes - no behavior change --- manifests/debian.pp | 20 +++++++++++++++++ manifests/fedora.pp | 17 ++++++++++++++ manifests/init.pp | 55 --------------------------------------------- manifests/ubuntu.pp | 18 +++++++++++++++ 4 files changed, 55 insertions(+), 55 deletions(-) create mode 100644 manifests/debian.pp create mode 100644 manifests/fedora.pp create mode 100644 manifests/ubuntu.pp diff --git a/manifests/debian.pp b/manifests/debian.pp new file mode 100644 index 0000000..e73869a --- /dev/null +++ b/manifests/debian.pp @@ -0,0 +1,20 @@ +class virt::debian { + case $virtual { + /^(xen|kvm)/: { + package { + [ "linux-image-xen-686", "xen-hypervisor", "xen-tools", "xen-utils", + "kvm", "qemu", "libvirt-bin", "virtinst", "libvirt-bin" ]: + ensure => latest; + } + } + openvzhn: { + package { + [ "linux-image-openvz-686", "vzctl", "vzquota", "vzdump", + "libvirt-bin", "python-virtinst" ]: + ensure => latest; + } + } + } +} + + diff --git a/manifests/fedora.pp b/manifests/fedora.pp new file mode 100644 index 0000000..a24dfa9 --- /dev/null +++ b/manifests/fedora.pp @@ -0,0 +1,17 @@ +class virt::fedora { + case $virtual { + /^(xen|kvm)/: { + package { + [ "kvm", "qemu", "libvirt", "python-virtinst", "kernel-xen", "xen", + "ruby-libvirt" ]: + ensure => latest; + } + } + openvzhn: { + package { + [ "ovzkernel", "vzctl", "vzquota", "libvirt", "python-virtinst", "ruby-libvirt" ]: + ensure => latest; + } + } + } +} diff --git a/manifests/init.pp b/manifests/init.pp index 359fe8e..81aecdc 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,58 +5,3 @@ fedora: { include virt::fedora } } } - -class virt::debian { - case $virtual { - /^(xen|kvm)/: { - package { - [ "linux-image-xen-686", "xen-hypervisor", "xen-tools", "xen-utils", - "kvm", "qemu", "libvirt-bin", "virtinst", "libvirt-bin" ]: - ensure => latest; - } - } - openvzhn: { - package { - [ "linux-image-openvz-686", "vzctl", "vzquota", "vzdump", - "libvirt-bin", "python-virtinst" ]: - ensure => latest; - } - } - } -} - -class virt::ubuntu { - case $virtual { - /^(xen|kvm)/: { - package { - [ "ubuntu-virt-server", "python-vm-builder", "kvm", "qemu", "qemu-kvm", - "ubuntu-xen-server", "libvirt-ruby" ]: - ensure => latest; - } - } - openvzhn: { - package { - [ "linux-openvz", "vzctl", "vzquota", "libvirt-bin", "python-virtinst" ]: - ensure => latest; - } - } - } -} - -class virt::fedora { - case $virtual { - /^(xen|kvm)/: { - package { - [ "kvm", "qemu", "libvirt", "python-virtinst", "kernel-xen", "xen", - "ruby-libvirt" ]: - ensure => latest; - } - } - openvzhn: { - package { - [ "ovzkernel", "vzctl", "vzquota", "libvirt", "python-virtinst", "ruby-libvirt" ]: - ensure => latest; - } - } - } -} diff --git a/manifests/ubuntu.pp b/manifests/ubuntu.pp new file mode 100644 index 0000000..7e5b54c --- /dev/null +++ b/manifests/ubuntu.pp @@ -0,0 +1,18 @@ +class virt::ubuntu { + case $virtual { + /^(xen|kvm)/: { + package { + [ "ubuntu-virt-server", "python-vm-builder", "kvm", "qemu", "qemu-kvm", + "ubuntu-xen-server", "libvirt-ruby" ]: + ensure => latest; + } + } + openvzhn: { + package { + [ "linux-openvz", "vzctl", "vzquota", "libvirt-bin", "python-virtinst" ]: + ensure => latest; + } + } + } +} + From 4f7ac3d68930870763e06c668d2b8acd7753631b Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 6 Dec 2010 22:32:14 +0100 Subject: [PATCH 10/32] enricht virt module * split things up between technologies and then between operating- systems * include legacy stuff from the virtual module * refactor things * add various scripts and facts --- files/libvirt/guest_starter | 68 +++++++++++++ files/xen/CentOS/sysconfig/xend | 11 ++ files/xen/CentOS/sysconfig/xendomains | 137 +++++++++++++++++++++++++ files/xen/Debian/default/xendomains | 138 ++++++++++++++++++++++++++ lib/facter/virtual_guests.rb | 10 ++ lib/facter/virtual_guests_count.rb | 10 ++ manifests/debian.pp | 20 ---- manifests/fedora.pp | 17 ---- manifests/init.pp | 10 +- manifests/kvm.pp | 4 + manifests/kvm/base.pp | 5 + manifests/libvirt.pp | 7 ++ manifests/libvirt/base.pp | 18 ++++ manifests/libvirt/debian.pp | 5 + manifests/libvirt/ubuntu.pp | 8 ++ manifests/openvz.pp | 5 + manifests/openvz/hn.pp | 8 ++ manifests/openvz/hn/base.pp | 6 ++ manifests/openvz/hn/debian.pp | 8 ++ manifests/openvz/hn/fedora.pp | 1 + manifests/openvz/hn/ubuntu.pp | 5 + manifests/ubuntu.pp | 18 ---- manifests/xen.pp | 7 ++ manifests/xen/xen0.pp | 8 ++ manifests/xen/xen0/base.pp | 43 ++++++++ manifests/xen/xen0/centos.pp | 13 +++ manifests/xen/xen0/debian.pp | 32 ++++++ manifests/xen/xen0/ubuntu.pp | 5 + manifests/xen/xenu.pp | 5 + manifests/xen/xenu/centos.pp | 11 ++ 30 files changed, 583 insertions(+), 60 deletions(-) create mode 100755 files/libvirt/guest_starter create mode 100644 files/xen/CentOS/sysconfig/xend create mode 100755 files/xen/CentOS/sysconfig/xendomains create mode 100644 files/xen/Debian/default/xendomains create mode 100644 lib/facter/virtual_guests.rb create mode 100644 lib/facter/virtual_guests_count.rb delete mode 100644 manifests/debian.pp delete mode 100644 manifests/fedora.pp create mode 100644 manifests/kvm.pp create mode 100644 manifests/kvm/base.pp create mode 100644 manifests/libvirt.pp create mode 100644 manifests/libvirt/base.pp create mode 100644 manifests/libvirt/debian.pp create mode 100644 manifests/libvirt/ubuntu.pp create mode 100644 manifests/openvz.pp create mode 100644 manifests/openvz/hn.pp create mode 100644 manifests/openvz/hn/base.pp create mode 100644 manifests/openvz/hn/debian.pp create mode 100644 manifests/openvz/hn/fedora.pp create mode 100644 manifests/openvz/hn/ubuntu.pp delete mode 100644 manifests/ubuntu.pp create mode 100644 manifests/xen.pp create mode 100644 manifests/xen/xen0.pp create mode 100644 manifests/xen/xen0/base.pp create mode 100644 manifests/xen/xen0/centos.pp create mode 100644 manifests/xen/xen0/debian.pp create mode 100644 manifests/xen/xen0/ubuntu.pp create mode 100644 manifests/xen/xenu.pp create mode 100644 manifests/xen/xenu/centos.pp diff --git a/files/libvirt/guest_starter b/files/libvirt/guest_starter new file mode 100755 index 0000000..8523d75 --- /dev/null +++ b/files/libvirt/guest_starter @@ -0,0 +1,68 @@ +#!/bin/env ruby + +require 'facter' +class GuestStarter + def self.factory + if Facter[:virtual].value == 'xen0' + XenGuestStarter.new + else + raise "No such virtual type supported so far!" + end + end + + def guests + @guests ||= get_guests + end + + def started_guests + @started_guests ||= `virsh list | egrep -v '(^.*Id.*Name.*State$|^-*$|Domain-0|^$)' | awk '{ print $2 }'`.split("\n") + end + + def start_missing_guests + ret = 0 + guests.keys.reject{ |name| started_guests.include?(name) }.each do |guest| + if (missing_disks=guests[guest][:disks].reject{|disk| File.exists?(disk) }).empty? + start_guest(guest) + else + ret += 1 + puts "Guest #{guest} can't yet be started as the following disks are missing: #{missing_disks.join(',')}" + end + end + ret + end + + def start_guest(guest) + puts "Starting guest #{guest}" + system start_guest_cmd(guest) + end + + def get_guests + raise "Implement method!" + end + def start_guest_cmd(guest) + raise "Implement method!" + end +end + +class XenGuestStarter < GuestStarter + def get_guests + guests = {} + (Dir['/etc/xen/auto/*'] | Dir['/etc/xen/*.sxp']).each do |file| + next if File.basename(file) =~ /^xend\-.*.sxp$/ + content = File.read(file).split("\n").select{|l| l =~ /^.*(name|disk).*=.*$/ }.join("\n") + name = disk = nil + eval content + guests[name] = { + :file => file, + :disks => disk.collect{|d| d.split(':',2).last.split(',').first } + } + end + guests + end + + def start_guest_cmd(guest) + "xm create #{guests[guest][:file]}" + end +end + +exit GuestStarter.factory.start_missing_guests diff --git a/files/xen/CentOS/sysconfig/xend b/files/xen/CentOS/sysconfig/xend new file mode 100644 index 0000000..d72f9ad --- /dev/null +++ b/files/xen/CentOS/sysconfig/xend @@ -0,0 +1,11 @@ +# NB. changing these requires a reboot. +# A simple 'xend restart' will not take effect + +# Log all hypervisor messages (cf xm dmesg) +#XENCONSOLED_LOG_HYPERVISOR=no + +# Log all guest console output (cf xm console) +#XENCONSOLED_LOG_GUESTS=no + +# Location to store guest & hypervisor logs +#XENCONSOLED_LOG_DIR=/var/log/xen/console diff --git a/files/xen/CentOS/sysconfig/xendomains b/files/xen/CentOS/sysconfig/xendomains new file mode 100755 index 0000000..00b9784 --- /dev/null +++ b/files/xen/CentOS/sysconfig/xendomains @@ -0,0 +1,137 @@ +## Path: System/xen +## Description: xen domain start/stop on boot +## Type: string +## Default: +# +# The xendomains script can send SysRq requests to domains on shutdown. +# If you don't want to MIGRATE, SAVE, or SHUTDOWN, this may be a possibility +# to do a quick and dirty shutdown ("s e i u o") or at least sync the disks +# of the domains ("s"). +# +XENDOMAINS_SYSRQ="" + +## Type: integer +## Default: 100000 +# +# If XENDOMAINS_SYSRQ is set, this variable determines how long to wait +# (in microseconds) after each SysRq, so the domain has a chance to react. +# If you want to a quick'n'dirty shutdown via SysRq, you may want to set +# it to a relatively high value (1200000). +# +XENDOMAINS_USLEEP=100000 + +## Type: integer +## Default: 5000000 +# +# When creating a guest domain, it is sensible to allow a little time for it +# to get started before creating another domain or proceeding through the +# boot process. Without this, the booting guests will thrash the disk as they +# start up. This timeout (in microseconds) specifies the delay after guest +# domain creation. +# +XENDOMAINS_CREATE_USLEEP=5000000 + +## Type: string +## Default: "" +# +# Set this to a non-empty string if you want to migrate virtual machines +# on shutdown. The string will be passed to the xm migrate DOMID command +# as is: It should contain the target IP address of the physical machine +# to migrate to and optionally parameters like --live. Leave empty if +# you don't want to try virtual machine relocation on shutdown. +# If migration succeeds, neither SAVE nor SHUTDOWN will be executed for +# that domain. +# +XENDOMAINS_MIGRATE="" + +## Type: string +## Default: /var/lib/xen/save +# +# Directory to save running domains to when the system (dom0) is +# shut down. Will also be used to restore domains from if # XENDOMAINS_RESTORE +# is set (see below). Leave empty to disable domain saving on shutdown +# (e.g. because you rather shut domains down). +# If domain saving does succeed, SHUTDOWN will not be executed. +# +XENDOMAINS_SAVE= + +## Type: string +## Default: "--halt --wait" +# +# If neither MIGRATE nor SAVE were enabled or if they failed, you can +# try to shut down a domain by sending it a shutdown request. To do this, +# set this to "--halt --wait". Omit the "--wait" flag to avoid waiting +# for the domain to be really down. Leave empty to skip domain shutdown. +# +XENDOMAINS_SHUTDOWN="--halt --wait" + +## Type: string +## Default: "--all --halt --wait" +# +# After we have gone over all virtual machines (resp. all automatically +# started ones, see XENDOMAINS_AUTO_ONLY below) in a loop and sent SysRq, +# migrated, saved and/or shutdown according to the settings above, we +# might want to shutdown the virtual machines that are still running +# for some reason or another. To do this, set this variable to +# "--all --halt --wait", it will be passed to xm shutdown. +# Leave it empty not to do anything special here. +# (Note: This will hit all virtual machines, even if XENDOMAINS_AUTO_ONLY +# is set.) +# +XENDOMAINS_SHUTDOWN_ALL="--all --halt --wait" + +## Type: boolean +## Default: true +# +# This variable determines whether saved domains from XENDOMAINS_SAVE +# will be restored on system startup. +# +XENDOMAINS_RESTORE=false + +## Type: string +## Default: /etc/xen/auto +# +# This variable sets the directory where domains configurations +# are stored that should be started on system startup automatically. +# Leave empty if you don't want to start domains automatically +# (or just don't place any xen domain config files in that dir). +# Note that the script tries to be clever if both RESTORE and AUTO are +# set: It will first restore saved domains and then only start domains +# in AUTO which are not running yet. +# Note that the name matching is somewhat fuzzy. +# +XENDOMAINS_AUTO=/etc/xen/auto + +## Type: boolean +## Default: false +# +# If this variable is set to "true", only the domains started via config +# files in XENDOMAINS_AUTO will be treated according to XENDOMAINS_SYSRQ, +# XENDOMAINS_MIGRATE, XENDOMAINS_SAVE, XENDMAINS_SHUTDOWN; otherwise +# all running domains will be. +# Note that the name matching is somewhat fuzzy. +# +XENDOMAINS_AUTO_ONLY=false + +## Type: integer +## Default: 300 +# +# On xendomains stop, a number of xm commands (xm migrate, save, shutdown, +# shutdown --all) may be executed. In the worst case, these commands may +# stall forever, which will prevent a successful shutdown of the machine. +# If this variable is non-zero, the script will set up a watchdog timer +# for every of these xm commands and time it out after the number of seconds +# specified by this variable. +# Note that SHUTDOWN_ALL will not be called if no virtual machines or only +# zombies are still running, so you don't need to enable this timeout just +# for the zombie case. +# The setting should be large enough to make sure that migrate/save/shutdown +# can succeed. If you do live migrations, keep in mind that live migration +# of a 1GB machine over Gigabit ethernet may actually take something like +# 100s (assuming that live migration uses 10% of the network # bandwidth). +# Depending on the virtual machine, a shutdown may also require a significant +# amount of time. So better setup this variable to a huge number and hope the +# watchdog never fires. +# +XENDOMAINS_STOP_MAXWAIT=300 + diff --git a/files/xen/Debian/default/xendomains b/files/xen/Debian/default/xendomains new file mode 100644 index 0000000..4e4aba0 --- /dev/null +++ b/files/xen/Debian/default/xendomains @@ -0,0 +1,138 @@ +## Path: System/xen +## Description: xen domain start/stop on boot +## Type: string +## Default: +# +# The xendomains script can send SysRq requests to domains on shutdown. +# If you don't want to MIGRATE, SAVE, or SHUTDOWN, this may be a possibility +# to do a quick and dirty shutdown ("s e i u o") or at least sync the disks +# of the domains ("s"). +# +XENDOMAINS_SYSRQ="" + +## Type: integer +## Default: 100000 +# +# If XENDOMAINS_SYSRQ is set, this variable determines how long to wait +# (in microseconds) after each SysRq, so the domain has a chance to react. +# If you want to a quick'n'dirty shutdown via SysRq, you may want to set +# it to a relatively high value (1200000). +# +XENDOMAINS_USLEEP=100000 + +## Type: integer +## Default: 5000000 +# +# When creating a guest domain, it is sensible to allow a little time for it +# to get started before creating another domain or proceeding through the +# boot process. Without this, the booting guests will thrash the disk as they +# start up. This timeout (in microseconds) specifies the delay after guest +# domain creation. +# +XENDOMAINS_CREATE_USLEEP=5000000 + +## Type: string +## Default: "" +# +# Set this to a non-empty string if you want to migrate virtual machines +# on shutdown. The string will be passed to the xm migrate DOMID command +# as is: It should contain the target IP address of the physical machine +# to migrate to and optionally parameters like --live. Leave empty if +# you don't want to try virtual machine relocation on shutdown. +# If migration succeeds, neither SAVE nor SHUTDOWN will be executed for +# that domain. +# +XENDOMAINS_MIGRATE="" + +## Type: string +## Default: /var/lib/xen/save +# +# Directory to save running domains to when the system (dom0) is +# shut down. Will also be used to restore domains from if # XENDOMAINS_RESTORE +# is set (see below). Leave empty to disable domain saving on shutdown +# (e.g. because you rather shut domains down). +# If domain saving does succeed, SHUTDOWN will not be executed. +# +#XENDOMAINS_SAVE=/var/lib/xen/save +XENDOMAINS_SAVE= + +## Type: string +## Default: "--halt --wait" +# +# If neither MIGRATE nor SAVE were enabled or if they failed, you can +# try to shut down a domain by sending it a shutdown request. To do this, +# set this to "--halt --wait". Omit the "--wait" flag to avoid waiting +# for the domain to be really down. Leave empty to skip domain shutdown. +# +XENDOMAINS_SHUTDOWN="--halt --wait" + +## Type: string +## Default: "--all --halt --wait" +# +# After we have gone over all virtual machines (resp. all automatically +# started ones, see XENDOMAINS_AUTO_ONLY below) in a loop and sent SysRq, +# migrated, saved and/or shutdown according to the settings above, we +# might want to shutdown the virtual machines that are still running +# for some reason or another. To do this, set this variable to +# "--all --halt --wait", it will be passed to xm shutdown. +# Leave it empty not to do anything special here. +# (Note: This will hit all virtual machines, even if XENDOMAINS_AUTO_ONLY +# is set.) +# +XENDOMAINS_SHUTDOWN_ALL="--all --halt --wait" + +## Type: boolean +## Default: true +# +# This variable determines whether saved domains from XENDOMAINS_SAVE +# will be restored on system startup. +# +XENDOMAINS_RESTORE=false + +## Type: string +## Default: /etc/xen/auto +# +# This variable sets the directory where domains configurations +# are stored that should be started on system startup automatically. +# Leave empty if you don't want to start domains automatically +# (or just don't place any xen domain config files in that dir). +# Note that the script tries to be clever if both RESTORE and AUTO are +# set: It will first restore saved domains and then only start domains +# in AUTO which are not running yet. +# Note that the name matching is somewhat fuzzy. +# +XENDOMAINS_AUTO=/etc/xen/auto + +## Type: boolean +## Default: false +# +# If this variable is set to "true", only the domains started via config +# files in XENDOMAINS_AUTO will be treated according to XENDOMAINS_SYSRQ, +# XENDOMAINS_MIGRATE, XENDOMAINS_SAVE, XENDMAINS_SHUTDOWN; otherwise +# all running domains will be. +# Note that the name matching is somewhat fuzzy. +# +XENDOMAINS_AUTO_ONLY=false + +## Type: integer +## Default: 300 +# +# On xendomains stop, a number of xm commands (xm migrate, save, shutdown, +# shutdown --all) may be executed. In the worst case, these commands may +# stall forever, which will prevent a successful shutdown of the machine. +# If this variable is non-zero, the script will set up a watchdog timer +# for every of these xm commands and time it out after the number of seconds +# specified by this variable. +# Note that SHUTDOWN_ALL will not be called if no virtual machines or only +# zombies are still running, so you don't need to enable this timeout just +# for the zombie case. +# The setting should be large enough to make sure that migrate/save/shutdown +# can succeed. If you do live migrations, keep in mind that live migration +# of a 1GB machine over Gigabit ethernet may actually take something like +# 100s (assuming that live migration uses 10% of the network # bandwidth). +# Depending on the virtual machine, a shutdown may also require a significant +# amount of time. So better setup this variable to a huge number and hope the +# watchdog never fires. +# +XENDOMAINS_STOP_MAXWAIT=300 + diff --git a/lib/facter/virtual_guests.rb b/lib/facter/virtual_guests.rb new file mode 100644 index 0000000..d9194c2 --- /dev/null +++ b/lib/facter/virtual_guests.rb @@ -0,0 +1,10 @@ +Facter.add('virtual_guests') do + confine :virtual => [ :xen0, :kvm ] + setcode do + # cache the list for other facts + system('((/usr/bin/find /var/cache/virsh_list.state -mmin -5 2>&1 | /bin/grep -qE \'^\/var\/cache\/virsh_list\.state$\') && [ `/bin/cat /var/cache/virsh_list.state | /usr/bin/wc -l` -gt 1 ]) || /usr/bin/virsh list | egrep -v \'(^.*Id.*Name.*State$|^-*$|Domain-0|^$)\' > /var/cache/virsh_list.state') + return '' unless File.exists?('/var/cache/virsh_list.state') + File.read('/var/cache/virsh_list.state').split("\n").collect{|line| line.split[1] }.sort.join(',') + end +end + diff --git a/lib/facter/virtual_guests_count.rb b/lib/facter/virtual_guests_count.rb new file mode 100644 index 0000000..9dc11e5 --- /dev/null +++ b/lib/facter/virtual_guests_count.rb @@ -0,0 +1,10 @@ +Facter.add('virtual_guests_count') do + confine :virtual => [ :xen0, :kvm ] + setcode do + # cache the list for other facts + system('((/usr/bin/find /var/cache/virsh_list.state -mmin -5 2>&1 | /bin/grep -qE \'^\/var\/cache\/virsh_list\.state$\') && [ `/bin/cat /var/cache/virsh_list.state | /usr/bin/wc -l` -gt 1 ]) || /usr/bin/virsh list | egrep -v \'(^.*Id.*Name.*State$|^-*$|Domain-0|^$)\' > /var/cache/virsh_list.state') + return 0 unless File.exists?('/var/cache/virsh_list.state') + File.read('/var/cache/virsh_list.state').split("\n").length + end +end + diff --git a/manifests/debian.pp b/manifests/debian.pp deleted file mode 100644 index e73869a..0000000 --- a/manifests/debian.pp +++ /dev/null @@ -1,20 +0,0 @@ -class virt::debian { - case $virtual { - /^(xen|kvm)/: { - package { - [ "linux-image-xen-686", "xen-hypervisor", "xen-tools", "xen-utils", - "kvm", "qemu", "libvirt-bin", "virtinst", "libvirt-bin" ]: - ensure => latest; - } - } - openvzhn: { - package { - [ "linux-image-openvz-686", "vzctl", "vzquota", "vzdump", - "libvirt-bin", "python-virtinst" ]: - ensure => latest; - } - } - } -} - - diff --git a/manifests/fedora.pp b/manifests/fedora.pp deleted file mode 100644 index a24dfa9..0000000 --- a/manifests/fedora.pp +++ /dev/null @@ -1,17 +0,0 @@ -class virt::fedora { - case $virtual { - /^(xen|kvm)/: { - package { - [ "kvm", "qemu", "libvirt", "python-virtinst", "kernel-xen", "xen", - "ruby-libvirt" ]: - ensure => latest; - } - } - openvzhn: { - package { - [ "ovzkernel", "vzctl", "vzquota", "libvirt", "python-virtinst", "ruby-libvirt" ]: - ensure => latest; - } - } - } -} diff --git a/manifests/init.pp b/manifests/init.pp index 81aecdc..7a9c836 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,7 +1,7 @@ class virt { - case $operatingsystem { - debian: { include virt::debian } - ubuntu: { include virt::ubuntu } - fedora: { include virt::fedora } - } + case $virtual { + /^xen/: { include virt::xen } + /^kvm/: { include virt::kvm } + /^openvzhn/: { include virt::openvz } + } } diff --git a/manifests/kvm.pp b/manifests/kvm.pp new file mode 100644 index 0000000..bfe8284 --- /dev/null +++ b/manifests/kvm.pp @@ -0,0 +1,4 @@ +class virt::kvm { + include ::virt::libvirt + include virt::kvm::base +} diff --git a/manifests/kvm/base.pp b/manifests/kvm/base.pp new file mode 100644 index 0000000..aad6c02 --- /dev/null +++ b/manifests/kvm/base.pp @@ -0,0 +1,5 @@ +class virt::kvm::base { + package{ [ 'kvm', 'qemu-kvm']: + ensure => present, + } +} diff --git a/manifests/libvirt.pp b/manifests/libvirt.pp new file mode 100644 index 0000000..dca2ae9 --- /dev/null +++ b/manifests/libvirt.pp @@ -0,0 +1,7 @@ +class virt::libvirt { + case $operatingsystem { + debian: { include virt::libvirt::debian } + ubuntu: { include virt::libvirt::ubuntu } + default: { include virt::libvirt::base } + } +} diff --git a/manifests/libvirt/base.pp b/manifests/libvirt/base.pp new file mode 100644 index 0000000..4935cc0 --- /dev/null +++ b/manifests/libvirt/base.pp @@ -0,0 +1,18 @@ +class virt::libvirt::base { + package{ [ 'libvirt', 'python-virtinst', 'ruby-libvirt', 'qemu' ]: + ensure => installed, + } + + service{'libvirtd': + ensure => running, + enable => true, + hasstatus => true, + require => Package['libvirt'], + } + + file{'/usr/local/sbin/guest_starter': + source => 'puppet:///modules/virt/libvirt/guest_starter', + require => Package['libvirt'], + owner => root, group => 0, mode => 0700; + } +} diff --git a/manifests/libvirt/debian.pp b/manifests/libvirt/debian.pp new file mode 100644 index 0000000..df2d64e --- /dev/null +++ b/manifests/libvirt/debian.pp @@ -0,0 +1,5 @@ +class virt::libvirt::debian inherits virt::libvirt::base { + Package['python-virtinst']{ + name => 'virtinst', + } +} diff --git a/manifests/libvirt/ubuntu.pp b/manifests/libvirt/ubuntu.pp new file mode 100644 index 0000000..78a6beb --- /dev/null +++ b/manifests/libvirt/ubuntu.pp @@ -0,0 +1,8 @@ +class virt::libvirt::ubuntu inherits virt::libvirt::debian { + Package['python-virtinst']{ + name => 'python-vm-builder', + } + package{'ubuntu-virt-server': + ensure => present, + } +} diff --git a/manifests/openvz.pp b/manifests/openvz.pp new file mode 100644 index 0000000..b0611ff --- /dev/null +++ b/manifests/openvz.pp @@ -0,0 +1,5 @@ +class virt::openvz { + case $virtual { + openvzhn: { include virt::openvz::hn } + } +} diff --git a/manifests/openvz/hn.pp b/manifests/openvz/hn.pp new file mode 100644 index 0000000..c5531fb --- /dev/null +++ b/manifests/openvz/hn.pp @@ -0,0 +1,8 @@ +class virt::openvz::hn { + include ::virt::libvirt + case $operatingsystem { + ubuntu: { include virt::openvz::hn::ubuntu } + debian: { include virt::openvz::hn::debian } + fedora: { include virt::openvz::hn::fedora } + } +} diff --git a/manifests/openvz/hn/base.pp b/manifests/openvz/hn/base.pp new file mode 100644 index 0000000..4ca889f --- /dev/null +++ b/manifests/openvz/hn/base.pp @@ -0,0 +1,6 @@ +class virt::openvz::hn::base { + package{ + [ 'vzctl', 'vzquota', 'ovzkernel']: + ensure => present, + } +} diff --git a/manifests/openvz/hn/debian.pp b/manifests/openvz/hn/debian.pp new file mode 100644 index 0000000..3bde04f --- /dev/null +++ b/manifests/openvz/hn/debian.pp @@ -0,0 +1,8 @@ +class virt::openvz::hn::debian inherits virt::openvz::hn::base { + Package['openvz-kernel']{ + name => "linux-image-openvz-${architecture}", + } + package{'vzdump': + ensure => present; + } +} diff --git a/manifests/openvz/hn/fedora.pp b/manifests/openvz/hn/fedora.pp new file mode 100644 index 0000000..eff192f --- /dev/null +++ b/manifests/openvz/hn/fedora.pp @@ -0,0 +1 @@ +class virt::openvz::hn::fedora inherits virt::openvz::hn::base { } diff --git a/manifests/openvz/hn/ubuntu.pp b/manifests/openvz/hn/ubuntu.pp new file mode 100644 index 0000000..3f9218d --- /dev/null +++ b/manifests/openvz/hn/ubuntu.pp @@ -0,0 +1,5 @@ +class virt::openvz::hn::ubuntu inherits virt::openvz::hn::base { + Package['opnvzkernel']{ + name => 'linux-openvz', + } +} diff --git a/manifests/ubuntu.pp b/manifests/ubuntu.pp deleted file mode 100644 index 7e5b54c..0000000 --- a/manifests/ubuntu.pp +++ /dev/null @@ -1,18 +0,0 @@ -class virt::ubuntu { - case $virtual { - /^(xen|kvm)/: { - package { - [ "ubuntu-virt-server", "python-vm-builder", "kvm", "qemu", "qemu-kvm", - "ubuntu-xen-server", "libvirt-ruby" ]: - ensure => latest; - } - } - openvzhn: { - package { - [ "linux-openvz", "vzctl", "vzquota", "libvirt-bin", "python-virtinst" ]: - ensure => latest; - } - } - } -} - diff --git a/manifests/xen.pp b/manifests/xen.pp new file mode 100644 index 0000000..5fa2f47 --- /dev/null +++ b/manifests/xen.pp @@ -0,0 +1,7 @@ +class virt::xen { + case $virtual { + 'xen0': { include virt::xen::xen0 } + 'xenu': { include virt::xen::xenu } + default: { fail("No such xen mode known") } + } +} diff --git a/manifests/xen/xen0.pp b/manifests/xen/xen0.pp new file mode 100644 index 0000000..faffc29 --- /dev/null +++ b/manifests/xen/xen0.pp @@ -0,0 +1,8 @@ +class virt::xen::xen0 { + include ::virt::libvirt + case $operatingsystem { + debian: { include virt::xen::xen0::debian } + centos: { include virt::xen::xen0::centos } + default: { include virt::xen::xen0::base } + } +} diff --git a/manifests/xen/xen0/base.pp b/manifests/xen/xen0/base.pp new file mode 100644 index 0000000..7870507 --- /dev/null +++ b/manifests/xen/xen0/base.pp @@ -0,0 +1,43 @@ +class virt::xen::xen0::base { + package{ ['xen', 'xen-libs', 'kernel-xen']: + ensure => present, + } + + service{'xend': + ensure => running, + enable => true, + hasstatus => true, + require => Package['kernel-xen'], + } + + file{'xendomains_defaults': + owner => root, group => 0, mode => 0644; + } + + service{'xendomains': + enable => true, + hasstatus => true, + require => Package['kernel-xen'], + } + # only ensure xendomains running if we have more + # than one domain running + if $virtual_guests_count > 0 { + Service['xendomains']{ + ensure => running, + } + File['xendomains_defaults']{ + notify => Service[xendomains] + } + } + + file{'/etc/xen/xend-config.sxp': + source => [ "puppet:///modules/site-virt/xen/${fqdn}/config/xend-config.sxp", + "puppet:///modules/site-virt/xen/config/${domain}/xend-config.sxp", + "puppet:///modules/site-virt/xen/config/${operatingsystem}/xend-config.sxp", + "puppet:///modules/site-virt/xen/config/xend-config.sxp", + "puppet:///modules/virt/xen/config/${operatingsystem}/xend-config.sxp", + "puppet:///modules/virt/xen/config/xend-config.sxp" ], + notify => Service['xend'], + owner => root, group => 0, mode => 0644; + } +} diff --git a/manifests/xen/xen0/centos.pp b/manifests/xen/xen0/centos.pp new file mode 100644 index 0000000..1e0e574 --- /dev/null +++ b/manifests/xen/xen0/centos.pp @@ -0,0 +1,13 @@ +class virt::xen::xen0::centos inherits virt::xen::xen0::base { + file{'xend_defaults': + path => '/etc/sysconfig/xend', + source => "puppet:///modules/virt/xen/${operatingsystem}/sysconfig/xend", + notify => Service['xend'], + owner => root, group => 0, mode => 0644; + } + + File['xendomains_defaults']{ + path => '/etc/sysconfig/xendomains', + source => "puppet:///modules/virt/xen/${operatingsystem}/sysconfig/xendomains", + } +} diff --git a/manifests/xen/xen0/debian.pp b/manifests/xen/xen0/debian.pp new file mode 100644 index 0000000..8dd5612 --- /dev/null +++ b/manifests/xen/xen0/debian.pp @@ -0,0 +1,32 @@ +class virt::xen::xen0::debian inherits virt::xen::xen0::base { + # This package is i386 only + # See also http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=379444 + case $architecture { + 'i386': { + package { 'libc6-xen': ensure => present } + } + } + Package['kernel-xen']{ + name => "linux-image-xen-$architecture", + } + + Package['xen']{ + name => 'xen-hypervisor', + } + + Package['xen-libs']{ + name => 'xen-utils', + } + + File['xendomains_defaults']{ + path => '/etc/defaults/xendomains', + source => "puppet:///modules/virt/xen/${operatingsystem}/defaults/xendomains", + } + + config_file { + "/etc/ld.so.conf.d/nosegneg.conf": + ensure => $xen_ensure, + content => "hwcap 0 nosegneg\n", + } +} + diff --git a/manifests/xen/xen0/ubuntu.pp b/manifests/xen/xen0/ubuntu.pp new file mode 100644 index 0000000..e2cb35d --- /dev/null +++ b/manifests/xen/xen0/ubuntu.pp @@ -0,0 +1,5 @@ +class virt::xen::xen0::ubuntu inherits virt::xen::xen0::debian { + package{'ubuntu-xen-server': + ensure => present, + } +} diff --git a/manifests/xen/xenu.pp b/manifests/xen/xenu.pp new file mode 100644 index 0000000..9d4ba17 --- /dev/null +++ b/manifests/xen/xenu.pp @@ -0,0 +1,5 @@ +class virt::xen::xenu { + case $operatingsystem { + centos: { include virt::xen::xenu::centos } + } +} diff --git a/manifests/xen/xenu/centos.pp b/manifests/xen/xenu/centos.pp new file mode 100644 index 0000000..d15aadd --- /dev/null +++ b/manifests/xen/xenu/centos.pp @@ -0,0 +1,11 @@ +class virt::xen::xenu::centos { + # Connect console to xvc0 + line{ + 'xvc0_inittab': + file => '/etc/inittab', + line => 'co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav'; + 'securetty': + file => '/etc/securetty', + line => 'xvc0'; + } +} From c95ba39c6de39a4c1fd1c01a0c05d715e6c005cf Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 9 Dec 2010 23:48:35 +0100 Subject: [PATCH 11/32] check value on undef --- manifests/xen/xen0/base.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/xen/xen0/base.pp b/manifests/xen/xen0/base.pp index 7870507..7dcadb8 100644 --- a/manifests/xen/xen0/base.pp +++ b/manifests/xen/xen0/base.pp @@ -21,7 +21,7 @@ } # only ensure xendomains running if we have more # than one domain running - if $virtual_guests_count > 0 { + if $virtual_guests_count and $virtual_guests_count > 0 { Service['xendomains']{ ensure => running, } From c3ed7e9a069782d4b5ba4717cc1163825b7ffec1 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 9 Dec 2010 23:58:47 +0100 Subject: [PATCH 12/32] fixing source --- manifests/xen/xen0/debian.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/xen/xen0/debian.pp b/manifests/xen/xen0/debian.pp index 8dd5612..6993a65 100644 --- a/manifests/xen/xen0/debian.pp +++ b/manifests/xen/xen0/debian.pp @@ -20,7 +20,7 @@ File['xendomains_defaults']{ path => '/etc/defaults/xendomains', - source => "puppet:///modules/virt/xen/${operatingsystem}/defaults/xendomains", + source => "puppet:///modules/virt/xen/${operatingsystem}/default/xendomains", } config_file { From 3fc38f80548679efa6a63816929a9221ba3ad420 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 10 Dec 2010 00:44:27 +0100 Subject: [PATCH 13/32] naming for lenny --- manifests/libvirt/debian.pp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/manifests/libvirt/debian.pp b/manifests/libvirt/debian.pp index df2d64e..3ec873e 100644 --- a/manifests/libvirt/debian.pp +++ b/manifests/libvirt/debian.pp @@ -2,4 +2,7 @@ Package['python-virtinst']{ name => 'virtinst', } + Package['ruby-libvirt']{ + name => 'libvirt-ruby', + } } From a239cd31bb80574ef8f2ebc2a18533056b06b6c0 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 10 Dec 2010 00:47:27 +0100 Subject: [PATCH 14/32] fix package naming --- manifests/libvirt/debian.pp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/manifests/libvirt/debian.pp b/manifests/libvirt/debian.pp index 3ec873e..dcdde2a 100644 --- a/manifests/libvirt/debian.pp +++ b/manifests/libvirt/debian.pp @@ -2,7 +2,13 @@ Package['python-virtinst']{ name => 'virtinst', } + Package['libvirt']{ + name => 'libvirt0', + } Package['ruby-libvirt']{ name => 'libvirt-ruby', } + package{'libvirt-bin': + ensure => present, + } } From 971c4485271e68f562b55ddcb9a63615039c1536 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 10 Dec 2010 00:54:54 +0100 Subject: [PATCH 15/32] fix path --- manifests/xen/xen0/debian.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/xen/xen0/debian.pp b/manifests/xen/xen0/debian.pp index 6993a65..5150dca 100644 --- a/manifests/xen/xen0/debian.pp +++ b/manifests/xen/xen0/debian.pp @@ -19,7 +19,7 @@ } File['xendomains_defaults']{ - path => '/etc/defaults/xendomains', + path => '/etc/default/xendomains', source => "puppet:///modules/virt/xen/${operatingsystem}/default/xendomains", } From 61cb63c6e998671a6797df0089d81263a01a4dcc Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 10 Dec 2010 10:18:44 +0100 Subject: [PATCH 16/32] get the service right for lenny --- manifests/libvirt/debian.pp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/manifests/libvirt/debian.pp b/manifests/libvirt/debian.pp index dcdde2a..7d3920a 100644 --- a/manifests/libvirt/debian.pp +++ b/manifests/libvirt/debian.pp @@ -11,4 +11,8 @@ package{'libvirt-bin': ensure => present, } + Service['libvirtd']{ + name => 'libvirt-bin', + require +> Package['libvirt-bin'], + } } From ee8b039ce97882858a780138e273f9306623fba0 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 10 Dec 2010 10:54:04 +0100 Subject: [PATCH 17/32] various fixes to get things running on lenny --- manifests/xen/xen0/debian.pp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/manifests/xen/xen0/debian.pp b/manifests/xen/xen0/debian.pp index 5150dca..59bed72 100644 --- a/manifests/xen/xen0/debian.pp +++ b/manifests/xen/xen0/debian.pp @@ -11,11 +11,15 @@ } Package['xen']{ - name => 'xen-hypervisor', + name => 'xen-utils-common', } Package['xen-libs']{ - name => 'xen-utils', + name => 'xen-utils-3.2-1', + } + + Service['xend']{ + hasstatus => false, } File['xendomains_defaults']{ From ac773541b3b3e5aa4d7787e57448619ed9269dc6 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 10 Dec 2010 17:27:55 +0100 Subject: [PATCH 18/32] using env in /usr as e.g. debian only has that one --- files/libvirt/guest_starter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/libvirt/guest_starter b/files/libvirt/guest_starter index 8523d75..b1f0b48 100755 --- a/files/libvirt/guest_starter +++ b/files/libvirt/guest_starter @@ -1,4 +1,4 @@ -#!/bin/env ruby +#!/usr/bin/env ruby require 'facter' class GuestStarter From e3019576a45bdfb7855f6288dd1ae973825115fb Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 12 Apr 2011 00:46:40 +0200 Subject: [PATCH 19/32] update to latest upstream --- files/xen/CentOS/sysconfig/xendomains | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/files/xen/CentOS/sysconfig/xendomains b/files/xen/CentOS/sysconfig/xendomains index 00b9784..cbdf5ae 100755 --- a/files/xen/CentOS/sysconfig/xendomains +++ b/files/xen/CentOS/sysconfig/xendomains @@ -55,6 +55,17 @@ XENDOMAINS_MIGRATE="" # XENDOMAINS_SAVE= +## Type: string +## Default: "none" +# +# If you're restoring domain and the restore fails you can specify the +# type of action to be done. Possible values are: +# "none" - do nothing, standard behaviour +# "rename" - rename /savePath/invalidRestoreImage to /savePath/.invalidRestoreImage +# "delete" - delete /savePath/invalidRestoreImage +# +XENDOMAINS_RESTOREFAILTYPE="none" + ## Type: string ## Default: "--halt --wait" # From 6f5c6e12daf4229ad316d017c0ccaa873d03b8b4 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 6 Jul 2011 23:45:56 +0200 Subject: [PATCH 20/32] add script to generate mac addresses for virtualizations --- files/libvirt/random_mac_address.rb | 20 ++++++++++++++++++++ manifests/libvirt/base.pp | 12 ++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100755 files/libvirt/random_mac_address.rb diff --git a/files/libvirt/random_mac_address.rb b/files/libvirt/random_mac_address.rb new file mode 100755 index 0000000..8ccac72 --- /dev/null +++ b/files/libvirt/random_mac_address.rb @@ -0,0 +1,20 @@ +#!/usr/bin/env ruby + + +prefixes = { + 'xen' => '00:16:3E', +} + +def random_hex + rand(15).to_s(16).upcase +end + +type = ARGV.shift +unless prefixes[type] + puts "Usage: #{File.basename(__FILE__)} " + puts "Where known types are: #{prefixes.keys.join(', ')}" + exit 1 +end + + +puts "#{prefixes[type]<<'.'<<(0..(5-prefixes[type].split(':').length)).collect{ random_hex + random_hex }.join(':')}" diff --git a/manifests/libvirt/base.pp b/manifests/libvirt/base.pp index 4935cc0..2826944 100644 --- a/manifests/libvirt/base.pp +++ b/manifests/libvirt/base.pp @@ -10,9 +10,13 @@ require => Package['libvirt'], } - file{'/usr/local/sbin/guest_starter': - source => 'puppet:///modules/virt/libvirt/guest_starter', - require => Package['libvirt'], - owner => root, group => 0, mode => 0700; + file{ + '/usr/local/sbin/guest_starter': + source => 'puppet:///modules/virt/libvirt/guest_starter', + require => Package['libvirt'], + owner => root, group => 0, mode => 0700; + '/usr/local/sbin/generate_random_macaddress': + source => 'puppet:///modules/virt/libvirt/random_mac_address.rb', + owner => root, group => 0, mode => 0755; } } From 772768324ae95ed313d677cc35a69af3c4fac0c8 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 7 Jul 2011 13:28:54 +0200 Subject: [PATCH 21/32] fixing concatenation --- files/libvirt/random_mac_address.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/libvirt/random_mac_address.rb b/files/libvirt/random_mac_address.rb index 8ccac72..4a41db3 100755 --- a/files/libvirt/random_mac_address.rb +++ b/files/libvirt/random_mac_address.rb @@ -17,4 +17,4 @@ def random_hex end -puts "#{prefixes[type]<<'.'<<(0..(5-prefixes[type].split(':').length)).collect{ random_hex + random_hex }.join(':')}" +puts "#{prefixes[type]<<':'<<(0..(5-prefixes[type].split(':').length)).collect{ random_hex + random_hex }.join(':')}" From a38b41ac40e9f5de9bd59c94001ba0b21ff440f1 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 22 Dec 2011 23:27:12 +0100 Subject: [PATCH 22/32] no need to install qemu --- manifests/libvirt/base.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/libvirt/base.pp b/manifests/libvirt/base.pp index 2826944..9a37ca9 100644 --- a/manifests/libvirt/base.pp +++ b/manifests/libvirt/base.pp @@ -1,5 +1,5 @@ class virt::libvirt::base { - package{ [ 'libvirt', 'python-virtinst', 'ruby-libvirt', 'qemu' ]: + package{ [ 'libvirt', 'python-virtinst', 'ruby-libvirt' ]: ensure => installed, } From 846cdcff723351ceab9d3d21e98474dd0e642cd3 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 22 Dec 2011 23:37:57 +0100 Subject: [PATCH 23/32] actually this should not be installed on a guest --- manifests/init.pp | 2 +- manifests/xen/xen0/base.pp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 7a9c836..5f7f99f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,7 +1,7 @@ class virt { case $virtual { /^xen/: { include virt::xen } - /^kvm/: { include virt::kvm } + #/^kvm/: { include virt::kvm } /^openvzhn/: { include virt::openvz } } } diff --git a/manifests/xen/xen0/base.pp b/manifests/xen/xen0/base.pp index 7dcadb8..6733078 100644 --- a/manifests/xen/xen0/base.pp +++ b/manifests/xen/xen0/base.pp @@ -33,6 +33,7 @@ file{'/etc/xen/xend-config.sxp': source => [ "puppet:///modules/site-virt/xen/${fqdn}/config/xend-config.sxp", "puppet:///modules/site-virt/xen/config/${domain}/xend-config.sxp", + "puppet:///modules/site-virt/xen/config/${operatingsystem}.${lsbmajdistrelease}/xend-config.sxp", "puppet:///modules/site-virt/xen/config/${operatingsystem}/xend-config.sxp", "puppet:///modules/site-virt/xen/config/xend-config.sxp", "puppet:///modules/virt/xen/config/${operatingsystem}/xend-config.sxp", From 4b63c82922cc18edaa8bd42ab58691b330daa066 Mon Sep 17 00:00:00 2001 From: mh Date: Thu, 22 Dec 2011 23:53:10 +0100 Subject: [PATCH 24/32] use proper names on squeeze --- manifests/xen/xen0/base.pp | 2 +- manifests/xen/xen0/debian.pp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/manifests/xen/xen0/base.pp b/manifests/xen/xen0/base.pp index 6733078..9465d4e 100644 --- a/manifests/xen/xen0/base.pp +++ b/manifests/xen/xen0/base.pp @@ -33,7 +33,7 @@ file{'/etc/xen/xend-config.sxp': source => [ "puppet:///modules/site-virt/xen/${fqdn}/config/xend-config.sxp", "puppet:///modules/site-virt/xen/config/${domain}/xend-config.sxp", - "puppet:///modules/site-virt/xen/config/${operatingsystem}.${lsbmajdistrelease}/xend-config.sxp", + "puppet:///modules/site-virt/xen/config/${operatingsystem}.${lsbdistcodename}/xend-config.sxp", "puppet:///modules/site-virt/xen/config/${operatingsystem}/xend-config.sxp", "puppet:///modules/site-virt/xen/config/xend-config.sxp", "puppet:///modules/virt/xen/config/${operatingsystem}/xend-config.sxp", diff --git a/manifests/xen/xen0/debian.pp b/manifests/xen/xen0/debian.pp index 59bed72..7b7530d 100644 --- a/manifests/xen/xen0/debian.pp +++ b/manifests/xen/xen0/debian.pp @@ -15,7 +15,10 @@ } Package['xen-libs']{ - name => 'xen-utils-3.2-1', + name => $lsbdistcodename ? { + lenny => 'xen-utils-3.2-1', + default => 'xen-utils-4.0' + } } Service['xend']{ From 879e850391651da3b697a45d38688c24c9018253 Mon Sep 17 00:00:00 2001 From: mh Date: Fri, 23 Dec 2011 00:05:33 +0100 Subject: [PATCH 25/32] kvm are kvm guests, need to find another way to identify a kvm host --- lib/facter/virtual_guests.rb | 2 +- lib/facter/virtual_guests_count.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/facter/virtual_guests.rb b/lib/facter/virtual_guests.rb index d9194c2..d00b320 100644 --- a/lib/facter/virtual_guests.rb +++ b/lib/facter/virtual_guests.rb @@ -1,5 +1,5 @@ Facter.add('virtual_guests') do - confine :virtual => [ :xen0, :kvm ] + confine :virtual => [ :xen0 ] setcode do # cache the list for other facts system('((/usr/bin/find /var/cache/virsh_list.state -mmin -5 2>&1 | /bin/grep -qE \'^\/var\/cache\/virsh_list\.state$\') && [ `/bin/cat /var/cache/virsh_list.state | /usr/bin/wc -l` -gt 1 ]) || /usr/bin/virsh list | egrep -v \'(^.*Id.*Name.*State$|^-*$|Domain-0|^$)\' > /var/cache/virsh_list.state') diff --git a/lib/facter/virtual_guests_count.rb b/lib/facter/virtual_guests_count.rb index 9dc11e5..3728992 100644 --- a/lib/facter/virtual_guests_count.rb +++ b/lib/facter/virtual_guests_count.rb @@ -1,5 +1,5 @@ Facter.add('virtual_guests_count') do - confine :virtual => [ :xen0, :kvm ] + confine :virtual => [ :xen0 ] setcode do # cache the list for other facts system('((/usr/bin/find /var/cache/virsh_list.state -mmin -5 2>&1 | /bin/grep -qE \'^\/var\/cache\/virsh_list\.state$\') && [ `/bin/cat /var/cache/virsh_list.state | /usr/bin/wc -l` -gt 1 ]) || /usr/bin/virsh list | egrep -v \'(^.*Id.*Name.*State$|^-*$|Domain-0|^$)\' > /var/cache/virsh_list.state') From ec582c3137c3bc99cc0e863b977f4af27f22e212 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 21 Jan 2012 13:25:46 +0100 Subject: [PATCH 26/32] ensure that we install amd64 package on x86_64 archtiecture --- manifests/xen/xen0/debian.pp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/manifests/xen/xen0/debian.pp b/manifests/xen/xen0/debian.pp index 7b7530d..8ac7569 100644 --- a/manifests/xen/xen0/debian.pp +++ b/manifests/xen/xen0/debian.pp @@ -7,7 +7,9 @@ } } Package['kernel-xen']{ - name => "linux-image-xen-$architecture", + name => $archtiecture ? { + x86_64 => "linux-image-xen-amd64", + default => "linux-image-xen-${architecture}", } Package['xen']{ From 31cfdc4882e9c201f2773469083ae1e5fa48f201 Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 21 Jan 2012 13:30:03 +0100 Subject: [PATCH 27/32] fix typo --- manifests/xen/xen0/debian.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/xen/xen0/debian.pp b/manifests/xen/xen0/debian.pp index 8ac7569..818f1e6 100644 --- a/manifests/xen/xen0/debian.pp +++ b/manifests/xen/xen0/debian.pp @@ -10,6 +10,7 @@ name => $archtiecture ? { x86_64 => "linux-image-xen-amd64", default => "linux-image-xen-${architecture}", + } } Package['xen']{ From 69f0e9a320bf525ea1e80a9391262a065429473e Mon Sep 17 00:00:00 2001 From: mh Date: Sat, 21 Jan 2012 13:42:15 +0100 Subject: [PATCH 28/32] more typos --- manifests/xen/xen0/debian.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/xen/xen0/debian.pp b/manifests/xen/xen0/debian.pp index 818f1e6..12ec161 100644 --- a/manifests/xen/xen0/debian.pp +++ b/manifests/xen/xen0/debian.pp @@ -7,7 +7,7 @@ } } Package['kernel-xen']{ - name => $archtiecture ? { + name => $architecture ? { x86_64 => "linux-image-xen-amd64", default => "linux-image-xen-${architecture}", } From 627257ff0c3ab4e315a5c5132ce2d0f04e95aa79 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 5 Jun 2012 22:30:04 +0200 Subject: [PATCH 29/32] new style for 2.7 --- manifests/init.pp | 2 +- manifests/libvirt.pp | 2 +- manifests/openvz.pp | 2 +- manifests/openvz/hn.pp | 2 +- manifests/xen.pp | 2 +- manifests/xen/xen0.pp | 2 +- manifests/xen/xen0/base.pp | 14 +++++++------- manifests/xen/xen0/centos.pp | 4 ++-- manifests/xen/xen0/debian.pp | 8 ++++---- manifests/xen/xenu.pp | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 5f7f99f..a3ce9c3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,5 +1,5 @@ class virt { - case $virtual { + case $::virtual { /^xen/: { include virt::xen } #/^kvm/: { include virt::kvm } /^openvzhn/: { include virt::openvz } diff --git a/manifests/libvirt.pp b/manifests/libvirt.pp index dca2ae9..8e75ac5 100644 --- a/manifests/libvirt.pp +++ b/manifests/libvirt.pp @@ -1,5 +1,5 @@ class virt::libvirt { - case $operatingsystem { + case $::operatingsystem { debian: { include virt::libvirt::debian } ubuntu: { include virt::libvirt::ubuntu } default: { include virt::libvirt::base } diff --git a/manifests/openvz.pp b/manifests/openvz.pp index b0611ff..dd033cb 100644 --- a/manifests/openvz.pp +++ b/manifests/openvz.pp @@ -1,5 +1,5 @@ class virt::openvz { - case $virtual { + case $::virtual { openvzhn: { include virt::openvz::hn } } } diff --git a/manifests/openvz/hn.pp b/manifests/openvz/hn.pp index c5531fb..71e499d 100644 --- a/manifests/openvz/hn.pp +++ b/manifests/openvz/hn.pp @@ -1,6 +1,6 @@ class virt::openvz::hn { include ::virt::libvirt - case $operatingsystem { + case $::operatingsystem { ubuntu: { include virt::openvz::hn::ubuntu } debian: { include virt::openvz::hn::debian } fedora: { include virt::openvz::hn::fedora } diff --git a/manifests/xen.pp b/manifests/xen.pp index 5fa2f47..ecb3b3e 100644 --- a/manifests/xen.pp +++ b/manifests/xen.pp @@ -1,5 +1,5 @@ class virt::xen { - case $virtual { + case $::virtual { 'xen0': { include virt::xen::xen0 } 'xenu': { include virt::xen::xenu } default: { fail("No such xen mode known") } diff --git a/manifests/xen/xen0.pp b/manifests/xen/xen0.pp index faffc29..c1c8f05 100644 --- a/manifests/xen/xen0.pp +++ b/manifests/xen/xen0.pp @@ -1,6 +1,6 @@ class virt::xen::xen0 { include ::virt::libvirt - case $operatingsystem { + case $::operatingsystem { debian: { include virt::xen::xen0::debian } centos: { include virt::xen::xen0::centos } default: { include virt::xen::xen0::base } diff --git a/manifests/xen/xen0/base.pp b/manifests/xen/xen0/base.pp index 9465d4e..a029990 100644 --- a/manifests/xen/xen0/base.pp +++ b/manifests/xen/xen0/base.pp @@ -21,7 +21,7 @@ } # only ensure xendomains running if we have more # than one domain running - if $virtual_guests_count and $virtual_guests_count > 0 { + if $::virtual_guests_count and $::virtual_guests_count > 0 { Service['xendomains']{ ensure => running, } @@ -31,12 +31,12 @@ } file{'/etc/xen/xend-config.sxp': - source => [ "puppet:///modules/site-virt/xen/${fqdn}/config/xend-config.sxp", - "puppet:///modules/site-virt/xen/config/${domain}/xend-config.sxp", - "puppet:///modules/site-virt/xen/config/${operatingsystem}.${lsbdistcodename}/xend-config.sxp", - "puppet:///modules/site-virt/xen/config/${operatingsystem}/xend-config.sxp", - "puppet:///modules/site-virt/xen/config/xend-config.sxp", - "puppet:///modules/virt/xen/config/${operatingsystem}/xend-config.sxp", + source => [ "puppet:///modules/site_virt/xen/${::fqdn}/config/xend-config.sxp", + "puppet:///modules/site_virt/xen/config/${::domain}/xend-config.sxp", + "puppet:///modules/site_virt/xen/config/${::operatingsystem}.${::lsbdistcodename}/xend-config.sxp", + "puppet:///modules/site_virt/xen/config/${::operatingsystem}/xend-config.sxp", + "puppet:///modules/site_virt/xen/config/xend-config.sxp", + "puppet:///modules/virt/xen/config/${::operatingsystem}/xend-config.sxp", "puppet:///modules/virt/xen/config/xend-config.sxp" ], notify => Service['xend'], owner => root, group => 0, mode => 0644; diff --git a/manifests/xen/xen0/centos.pp b/manifests/xen/xen0/centos.pp index 1e0e574..24f1607 100644 --- a/manifests/xen/xen0/centos.pp +++ b/manifests/xen/xen0/centos.pp @@ -1,13 +1,13 @@ class virt::xen::xen0::centos inherits virt::xen::xen0::base { file{'xend_defaults': path => '/etc/sysconfig/xend', - source => "puppet:///modules/virt/xen/${operatingsystem}/sysconfig/xend", + source => "puppet:///modules/virt/xen/${::operatingsystem}/sysconfig/xend", notify => Service['xend'], owner => root, group => 0, mode => 0644; } File['xendomains_defaults']{ path => '/etc/sysconfig/xendomains', - source => "puppet:///modules/virt/xen/${operatingsystem}/sysconfig/xendomains", + source => "puppet:///modules/virt/xen/${::operatingsystem}/sysconfig/xendomains", } } diff --git a/manifests/xen/xen0/debian.pp b/manifests/xen/xen0/debian.pp index 12ec161..19208eb 100644 --- a/manifests/xen/xen0/debian.pp +++ b/manifests/xen/xen0/debian.pp @@ -1,13 +1,13 @@ class virt::xen::xen0::debian inherits virt::xen::xen0::base { # This package is i386 only # See also http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=379444 - case $architecture { + case $::architecture { 'i386': { package { 'libc6-xen': ensure => present } } } Package['kernel-xen']{ - name => $architecture ? { + name => $::architecture ? { x86_64 => "linux-image-xen-amd64", default => "linux-image-xen-${architecture}", } @@ -18,7 +18,7 @@ } Package['xen-libs']{ - name => $lsbdistcodename ? { + name => $::lsbdistcodename ? { lenny => 'xen-utils-3.2-1', default => 'xen-utils-4.0' } @@ -30,7 +30,7 @@ File['xendomains_defaults']{ path => '/etc/default/xendomains', - source => "puppet:///modules/virt/xen/${operatingsystem}/default/xendomains", + source => "puppet:///modules/virt/xen/${::operatingsystem}/default/xendomains", } config_file { diff --git a/manifests/xen/xenu.pp b/manifests/xen/xenu.pp index 9d4ba17..1153dcf 100644 --- a/manifests/xen/xenu.pp +++ b/manifests/xen/xenu.pp @@ -1,5 +1,5 @@ class virt::xen::xenu { - case $operatingsystem { + case $::operatingsystem { centos: { include virt::xen::xenu::centos } } } From c2bf8593eb864ffd562a840fb7ec6d0bc5415d32 Mon Sep 17 00:00:00 2001 From: mh Date: Tue, 5 Jun 2012 18:45:02 -0300 Subject: [PATCH 30/32] new style for 2.7 --- manifests/openvz/hn/debian.pp | 2 +- manifests/xen/xen0/debian.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/openvz/hn/debian.pp b/manifests/openvz/hn/debian.pp index 3bde04f..1d90649 100644 --- a/manifests/openvz/hn/debian.pp +++ b/manifests/openvz/hn/debian.pp @@ -1,6 +1,6 @@ class virt::openvz::hn::debian inherits virt::openvz::hn::base { Package['openvz-kernel']{ - name => "linux-image-openvz-${architecture}", + name => "linux-image-openvz-${::architecture}", } package{'vzdump': ensure => present; diff --git a/manifests/xen/xen0/debian.pp b/manifests/xen/xen0/debian.pp index 19208eb..462f35f 100644 --- a/manifests/xen/xen0/debian.pp +++ b/manifests/xen/xen0/debian.pp @@ -9,7 +9,7 @@ Package['kernel-xen']{ name => $::architecture ? { x86_64 => "linux-image-xen-amd64", - default => "linux-image-xen-${architecture}", + default => "linux-image-xen-${::architecture}", } } From a476c4b321e0334ef7bb2b946b653e3bd117b081 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 17 Jun 2012 16:45:50 -0300 Subject: [PATCH 31/32] line is deprecated better use file_line --- manifests/xen/xenu/centos.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/xen/xenu/centos.pp b/manifests/xen/xenu/centos.pp index d15aadd..88c125b 100644 --- a/manifests/xen/xenu/centos.pp +++ b/manifests/xen/xenu/centos.pp @@ -1,11 +1,11 @@ class virt::xen::xenu::centos { # Connect console to xvc0 - line{ + file_line{ 'xvc0_inittab': - file => '/etc/inittab', + path => '/etc/inittab', line => 'co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav'; 'securetty': - file => '/etc/securetty', + path => '/etc/securetty', line => 'xvc0'; } } From 52e57e572cfbc80f984db9543b1fa6332ee63236 Mon Sep 17 00:00:00 2001 From: mh Date: Mon, 18 Jun 2012 11:33:11 -0300 Subject: [PATCH 32/32] get rid off config_file wrapper --- manifests/xen/xen0/debian.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/xen/xen0/debian.pp b/manifests/xen/xen0/debian.pp index 462f35f..331735a 100644 --- a/manifests/xen/xen0/debian.pp +++ b/manifests/xen/xen0/debian.pp @@ -33,10 +33,11 @@ source => "puppet:///modules/virt/xen/${::operatingsystem}/default/xendomains", } - config_file { + file { "/etc/ld.so.conf.d/nosegneg.conf": ensure => $xen_ensure, content => "hwcap 0 nosegneg\n", + owner => root, group => 0, mode => 0644; } }