lib/deprec/recipes/xen.rb in isaac-deprec-1.99.30 vs lib/deprec/recipes/xen.rb in isaac-deprec-1.99.32
- old
+ new
@@ -10,72 +10,69 @@
set(:xen_disk_size) { Capistrano::CLI.ui.ask("Disk size (GB)") }
set(:xen_swap_size) { Capistrano::CLI.ui.ask("Swap size (GB)") }
# ref: http://www.eadz.co.nz/blog/article/xen-gutsy.html
+ desc "Install Xen"
+ task :install, :roles => :dom0 do
+ install_deps
+ disable_apparmour
+ disable_tls
+ enable_hardy_domu
+ initial_config
+ end
+
+ task :install_deps, :roles => :dom0 do
+ # for amd64 version of ubuntu 7.10
+ apt.install( {:base => %w(linux-image-xen bridge-utils libxen3.1 python-xen-3.1 xen-docs-3.1 xen-hypervisor-3.1 xen-ioemu-3.1 xen-tools xen-utils-3.1 lvm2)}, :stable )
+ # alternatively, for x86 version of ubuntu:
+ # apt-get install ubuntu-xen-server libc6-xen lvm2
+ end
+
+ task :disable_apparmour, :roles => :dom0 do
+ sudo '/etc/init.d/apparmor stop'
+ sudo 'update-rc.d -f apparmor remove'
+ end
+
+ task :disable_tls, :roles => :dom0 do
+ sudo 'mv /lib/tls /lib/tls.disabled'
+ end
+
SYSTEM_CONFIG_FILES[:xen] = [
{:template => "xend-config.sxp.erb",
:path => '/etc/xen/xend-config.sxp',
:mode => 0644,
:owner => 'root:root'},
-
- {:template => "xen-tools.conf.erb",
- :path => '/etc/xen-tools/xen-tools.conf',
- :mode => 0644,
- :owner => 'root:root'},
- {:template => "xm.tmpl.erb",
- :path => '/etc/xen-tools/xm.tmpl',
- :mode => 0644,
- :owner => 'root:root'},
-
{:template => "xendomains.erb",
:path => '/etc/default/xendomains',
:mode => 0755,
:owner => 'root:root'},
- # This one is a bugfix for gutsy
- {:template => "15-disable-hwclock",
- :path => '/usr/lib/xen-tools/gutsy.d/15-disable-hwclock',
+ # This gives you a second network bridge on second ethernet device
+ {:template => "network-bridge-wrapper",
+ :path => '/etc/xen/scripts/network-bridge-wrapper',
:mode => 0755,
:owner => 'root:root'},
- # This one is a bugfix for gutsy: domU -> domU networking is screwy
- # http://lists.xensource.com/archives/html/xen-users/2006-05/msg00818.html
- {:template => "40-setup-networking",
- :path => '/usr/lib/xen-tools/gutsy.d/40-setup-networking',
- :mode => 0755,
- :owner => 'root:root'},
-
- # So is this - xendomains fails to shut down domains on system shutdown
+ # Bugfix for gutsy - xendomains fails to shut down domains on system shutdown
{:template => "xend-init.erb",
:path => '/etc/init.d/xend',
:mode => 0755,
- :owner => 'root:root'},
-
- # This gives you a second network bridge on second ethernet device
- {:template => "network-bridge-wrapper",
- :path => '/etc/xen/scripts/network-bridge-wrapper',
- :mode => 0755,
:owner => 'root:root'}
]
- desc "Install Xen"
- task :install, :roles => :dom0 do
- install_deps
- enable_hardy_domu
+ desc "Push Xen config files to server"
+ task :initial_config, :roles => :dom0 do
+ # Non-standard! We're pushing these straight out
+ SYSTEM_CONFIG_FILES[:xen].each do |file|
+ deprec2.render_template(:xen, file.merge(:remote => true))
+ end
end
- task :install_deps, :roles => :dom0 do
- # for amd64 version of ubuntu 7.10
- apt.install( {:base => %w(linux-image-xen bridge-utils libxen3.1 python-xen-3.1 xen-docs-3.1 xen-hypervisor-3.1 xen-ioemu-3.1 xen-tools xen-utils-3.1 lvm2)}, :stable )
- # alternatively, for x86 version of ubuntu:
- # apt-get install ubuntu-xen-server libc6-xen
- end
-
desc "Generate configuration file(s) for Xen from template(s)"
task :config_gen do
SYSTEM_CONFIG_FILES[:xen].each do |file|
deprec2.render_template(:xen, file)
end
@@ -130,11 +127,10 @@
copy_slice_config
create_lvm_disks
build_slice_from_tarball
end
-
task :copy_disk do
mnt_dir = "/mnt/#{xen_slice}-disk"
tarball = "/tmp/#{xen_slice}-disk.tar"
lvm_disk = "/dev/vm_local/#{xen_slice}-disk"
@@ -185,12 +181,13 @@
sudo "sh -c 'cd #{mnt_dir} && tar xf #{tarball}'", :hosts => xen_new_host
sudo "umount #{mnt_dir}", :hosts => xen_new_host
sudo "rmdir #{mnt_dir}", :hosts => xen_new_host
end
- desc "Enable hardy heron domU's on gutsy dom0"
+ desc "Enable hardy heron domU's on gutsy dom0. (Note required on hardy)"
task :enable_hardy_domu, :roles => :dom0 do
+ # Note, hardy keeps debootrap in /usr/share/debootstrap/scripts/
# create debootstrap symlink
sudo "ln -sf /usr/lib/debootstrap/scripts/gutsy /usr/lib/debootstrap/scripts/hardy"
# link xen-tools hooks
sudo "ln -sf /usr/lib/xen-tools/edgy.d /usr/lib/xen-tools/hardy.d"
end
@@ -198,9 +195,10 @@
task :touch_hwclock do
sudo "touch /etc/init.d/hwclock.sh"
end
end
+
end
end
# Stop the 'incrementing ethX problem'