Package: lava-dispatcher
Severity: important
Tags: patch

ecent versions of e2fsprogs in debian will give a warning when trying
to create a filesystem on a parition containing one and wait for user
input, this isn't very helpful for usage in a lava slave where the test
partitions get reformatted every run.

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (101, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
>From 34389967bec348fa85f1ca0d5d063baf0af6bc5e Mon Sep 17 00:00:00 2001
From: Sjoerd Simons <sjoerd.sim...@collabora.co.uk>
Date: Tue, 23 Sep 2014 08:52:07 +0200
Subject: [PATCH] master: Force rootfs creation

Recent versions of e2fsprogs in debian will give a warning when trying
to create a filesystem on a parition containing one and wait for user
input, this isn't very helpful for usage in a lava slave where the test
partitions get reformatted every run.

To work around this pass -F to mkfs.ext* and -f to mkfs.btrfs (woo,
standards...) to force filesystem creation.
---
 lava_dispatcher/device/master.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lava_dispatcher/device/master.py b/lava_dispatcher/device/master.py
index 83968d8..510b0d2 100644
--- a/lava_dispatcher/device/master.py
+++ b/lava_dispatcher/device/master.py
@@ -274,11 +274,16 @@ class MasterImageTarget(Target):
             logging.debug("Unable to read boot commands dynamically.")
 
     def _format_testpartition(self, runner, fstype):
+        force = ""
         logging.info("Format testboot and testrootfs partitions")
+        if fstype.startswith("ext"):
+            force = "-F"
+        elif fstype == "btrfs":
+            force = "-f"
 
         runner.run('umount %s' % self.testrootfs_path, failok=True)
-        runner.run('nice mkfs -t %s -q %s -L %s'
-                   % (fstype, self.testrootfs_path, self.testrootfs_label), timeout=1800)
+        runner.run('nice mkfs %s -t %s -q %s -L %s'
+                   % (force, fstype, self.testrootfs_path, self.testrootfs_label), timeout=1800)
         runner.run('umount %s' % self.testboot_path, failok=True)
         runner.run('nice mkfs.vfat %s -n %s' % (self.testboot_path, self.testboot_label))
 
@@ -538,7 +543,7 @@ class MasterImageTarget(Target):
     def _deploy_linaro_android_data(self, session, datatbz2):
         data_label, data_path = self._android_data_label(session)
         session.run('umount %s' % data_path, failok=True)
-        session.run('nice mkfs.ext4 -q %s -L %s' %
+        session.run('nice mkfs.ext4 -F -q %s -L %s' %
                     (data_path, data_label))
         session.run('udevadm trigger')
         session.run('mkdir -p /mnt/lava/data')
-- 
2.1.0

Reply via email to