← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/use-shutdown-ec2 into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/use-shutdown-ec2 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/use-shutdown-ec2/+merge/71522

The use of at to perform the fail-safe shutdown on our ec2 instances has always irked me. We changed it, and when it didn't work, we reverted it with a comment, rather than fixing it by calling shutdown -c, which was even mentioned in the bug report!

Call shutdown -P +<timeout> rather than using at, and call 'sudo shutdown -c' before shutting down the instance.
-- 
https://code.launchpad.net/~stevenk/launchpad/use-shutdown-ec2/+merge/71522
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/use-shutdown-ec2 into lp:launchpad.
=== modified file 'lib/devscripts/ec2test/remote.py'
--- lib/devscripts/ec2test/remote.py	2011-02-27 22:57:06 +0000
+++ lib/devscripts/ec2test/remote.py	2011-08-15 09:00:46 +0000
@@ -173,6 +173,9 @@
 
         time.sleep(self.SHUTDOWN_DELAY)
 
+        # Cancel the running shutdown.
+        subprocess.call(['sudo', 'shutdown', '-c'])
+
         # We'll only get here if --postmortem didn't kill us.  This is our
         # fail-safe shutdown, in case the user got disconnected or suffered
         # some other mishap that would prevent them from shutting down this

=== modified file 'lib/devscripts/ec2test/testrunner.py'
--- lib/devscripts/ec2test/testrunner.py	2011-06-30 23:12:06 +0000
+++ lib/devscripts/ec2test/testrunner.py	2011-08-15 09:00:46 +0000
@@ -320,16 +320,7 @@
         if self.timeout is not None:
             # Activate a fail-safe shutdown just in case something goes
             # really wrong with the server or suite.
-            #
-            # We need to use a call to /usr/bin/at here instead of a call to
-            # /sbin/shutdown because the test suite already uses the shutdown
-            # command after the suite finishes. If we called shutdown
-            # here, it would prevent the end-of-suite shutdown from executing,
-            # leaving the server running until the failsafe finally activates.
-            # See bug 617598 for the details.
-            user_connection.perform(
-                "echo sudo shutdown -h now | at today + %d minutes"
-                % self.timeout)
+            user_connection.perform("sudo shutdown -P +%d" % self.timeout)
         as_user = user_connection.perform
         # Set up bazaar.conf with smtp information if necessary
         if self.email or self.message: