[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 595: [Nicholas Schutt] erase the beginning of the disk before deploying

Message ID 20130507184918.27886.52688.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Antonio Terceiro May 7, 2013, 6:49 p.m.
Merge authors:
  Nicholas Schutt (nick-schutt)
Related merge proposals:
  https://code.launchpad.net/~nick-schutt/lava-dispatcher/nicks-highbank-support/+merge/160356
  proposed by: Nicholas Schutt (nick-schutt)
  review: Approve - Antonio Terceiro (terceiro)
------------------------------------------------------------
revno: 595 [merge]
committer: Antonio Terceiro <antonio.terceiro@linaro.org>
branch nick: trunk
timestamp: Tue 2013-05-07 15:47:32 -0300
message:
  [Nicholas Schutt] erase the beginning of the disk before deploying
  
  This will corrupt the existing contents of the disk, so that if the current
  deploy fails, the system will not boot the previously-deployed image.
modified:
  lava_dispatcher/device/highbank.py


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription

Patch

=== modified file 'lava_dispatcher/device/highbank.py'
--- lava_dispatcher/device/highbank.py	2013-04-22 13:32:10 +0000
+++ lava_dispatcher/device/highbank.py	2013-04-22 18:45:28 +0000
@@ -91,6 +91,9 @@ 
     def _deploy_image(self, image_file, device):
         with self._as_master() as runner:
 
+            # erase the first part of the disk to make sure the new deploy works
+            runner.run("dd if=/dev/zero of=%s bs=4M count=4" % device, timeout=1800)
+
             # compress the image to reduce the transfer size
             if not image_file.endswith('.bz2') and not image_file.endswith('gz'):
                 os.system('bzip2 -9v ' + image_file)
@@ -157,7 +160,6 @@ 
             else:
                 logging.warning("unknown partition type for resize: %s" % parttype)
 
-
     @contextlib.contextmanager
     def file_system(self, partition, directory):
         logging.info('attempting to access master filesystem %r:%s' %