# HG changeset patch # User David Scott # Date 1268315765 0 # Node ID a9896a894e36c8103f0deaacd53a3c556df9ab06 # Parent ccfac7027be9776c1cf2723e74ece2e00770ab38 Backed out changeset ccfac7027be9 -- implicated in causing an intolerable slowdown installing debian etch-like guests. diff -r ccfac7027be9 -r a9896a894e36 ocaml/xapi/xapi_templates_install.ml --- a/ocaml/xapi/xapi_templates_install.ml Fri Mar 05 15:19:20 2010 -0800 +++ b/ocaml/xapi/xapi_templates_install.ml Thu Mar 11 13:56:05 2010 +0000 @@ -98,13 +98,9 @@ in update_progress () ) with | Success _ -> debug "Install script exitted successfully." - | Failure(log, Subprocess_failed 5) -> - raise (Api_errors.Server_error (Api_errors.vdi_io_error, ["Device I/O error"])) - | Failure(log, Subprocess_failed 28) -> + | Failure(log, Subprocess_failed n) -> + error "post_install_script failed: message='%s' (assuming this was because the disk was too small)" log; raise (Api_errors.Server_error (Api_errors.provision_failed_out_of_space, [])) - | Failure(log, Subprocess_failed n) -> - let msg = Printf.sprintf "Template post installation script failed: status %d" n in - raise (Api_errors.Server_error (Api_errors.internal_error, [msg])) | Failure(log, exn) -> raise exn ) diff -r ccfac7027be9 -r a9896a894e36 scripts/templates/debian --- a/scripts/templates/debian Fri Mar 05 15:19:20 2010 -0800 +++ b/scripts/templates/debian Thu Mar 11 13:56:05 2010 +0000 @@ -3,7 +3,6 @@ # Code ripped out of 'xgt' script for now import commands, xmlrpclib, os, sys, httplib, socket, urllib2, signal -import errno verbose = True @@ -29,9 +28,7 @@ class CommandException(Exception): - def __init__(self, ret, out): - Exception.__init__(self, out) - self.ret = ret + pass def run(cmd, *args): @@ -45,7 +42,7 @@ pass if ret != 0: debug ("run - command %s failed with %d" , cmd, ret) - raise CommandException(ret, out) + raise CommandException(out) return out def log(fmt, *args): @@ -100,7 +97,7 @@ def sighandler(signum, frame): umount(mountpoint) os.killpg(0,signal.SIGKILL) - sys.exit(errno.EINTR) + exit(1) signal.signal(signal.SIGTERM,sighandler) @@ -113,26 +110,12 @@ run("/bin/mkdir -p %s", mountpoint) try: - try: - run("/bin/mount -osync %s1 %s", xvda, mountpoint) - run("/usr/bin/unzip -p %s root.tar.bz2 | tar -C %s -jx", xgt, mountpoint) - finally: - run("/bin/umount %s", mountpoint) - run("/bin/rmdir %s", mountpoint) - except CommandException, e: - if e.ret == 512: - sys.exit(errno.EIO) - else: - raise - try: - run("/usr/bin/unzip -p %s swap.img | dd of=%s oflag=direct bs=1M", xgt, xvdb) - except CommandException, e: - if e.ret == 256: - sys.exit(errno.EIO) - elif e.ret == 1: - sys.exit(errno.ENOSPC) - else: - raise + run("/bin/mount %s1 %s", xvda, mountpoint) + run("/usr/bin/unzip -p %s root.tar.bz2 | tar -C %s -jx", xgt, mountpoint) + finally: + run("/bin/umount %s", mountpoint) + run("/bin/rmdir %s", mountpoint) + run("/usr/bin/unzip -p %s swap.img | dd of=%s oflag=direct bs=1M", xgt, xvdb) try: session_id = server.session.login_with_password('','')['Value']