diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 184: Added rootfstype option for deploying images

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

Commit Message

Paul Larson Jan. 3, 2012, 5:46 p.m. UTC
Merge authors:
  Michael Hudson-Doyle (mwhudson)
Related merge proposals:
  https://code.launchpad.net/~mwhudson/lava-dispatcher/specify-fs/+merge/86186
  proposed by: Michael Hudson-Doyle (mwhudson)
  review: Approve - Spring Zhang (qzhang)
------------------------------------------------------------
revno: 184 [merge]
committer: Paul Larson <paul.larson@canonical.com>
branch nick: lava-dispatcher
timestamp: Tue 2012-01-03 11:43:52 -0600
message:
  Added rootfstype option for deploying images
modified:
  lava_dispatcher/actions/android_deploy.py
  lava_dispatcher/actions/deploy.py
  lava_dispatcher/client/base.py
  lava_dispatcher/client/lmc_utils.py
  lava_dispatcher/client/master.py
  lava_dispatcher/client/qemu.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
diff mbox

Patch

=== modified file 'lava_dispatcher/actions/android_deploy.py'
--- lava_dispatcher/actions/android_deploy.py	2011-11-24 03:00:54 +0000
+++ lava_dispatcher/actions/android_deploy.py	2011-12-19 02:23:53 +0000
@@ -23,5 +23,5 @@ 
 
 
 class cmd_deploy_linaro_android_image(BaseAction):
-    def run(self, boot, system, data, pkg=None, use_cache=True):
-        self.client.deploy_linaro_android(boot, system, data, pkg, use_cache)
+    def run(self, boot, system, data, pkg=None, use_cache=True, rootfstype='ext4'):
+        self.client.deploy_linaro_android(boot, system, data, pkg, use_cache, rootfstype)

=== modified file 'lava_dispatcher/actions/deploy.py'
--- lava_dispatcher/actions/deploy.py	2011-11-21 04:21:06 +0000
+++ lava_dispatcher/actions/deploy.py	2011-12-19 01:40:25 +0000
@@ -21,6 +21,6 @@ 
 
 
 class cmd_deploy_linaro_image(BaseAction):
-    def run(self, hwpack, rootfs, kernel_matrix=None, use_cache=True):
+    def run(self, hwpack, rootfs, kernel_matrix=None, use_cache=True, rootfstype='ext3'):
         self.client.deploy_linaro(
-            hwpack, rootfs, kernel_matrix=None, use_cache=True)
+            hwpack, rootfs, kernel_matrix=None, use_cache=True, rootfstype=rootfstype)

=== modified file 'lava_dispatcher/client/base.py'
--- lava_dispatcher/client/base.py	2011-12-06 21:01:44 +0000
+++ lava_dispatcher/client/base.py	2011-12-19 02:23:53 +0000
@@ -366,7 +366,7 @@ 
             raise OperationFailed
         logging.info("System is in test image now")
 
-    def deploy_linaro(self, hwpack, rootfs, kernel_matrix=None, use_cache=True):
+    def deploy_linaro(self, hwpack, rootfs, kernel_matrix=None, use_cache=True, rootfstype='ext3'):
         raise NotImplementedError(self.deploy_linaro)
 
     def boot_master_image(self):
@@ -390,6 +390,9 @@ 
 
     # Android stuff
 
+    def deploy_linaro_android(self, boot, system, data, pkg=None, use_cache=True, rootfstype='ext4'):
+        raise NotImplementedError(self.deploy_linaro_android)
+
     def boot_linaro_android_image(self):
         """Reboot the system to the test android image."""
         self.proc._boot(string_to_list(self.config.get('boot_cmds_android')))

=== modified file 'lava_dispatcher/client/lmc_utils.py'
--- lava_dispatcher/client/lmc_utils.py	2011-12-15 16:36:00 +0000
+++ lava_dispatcher/client/lmc_utils.py	2011-12-19 01:44:12 +0000
@@ -54,7 +54,7 @@ 
             return new_hwpack_path
 
 
-def generate_image(client, hwpack_url, rootfs_url, kernel_matrix, use_cache=True):
+def generate_image(client, hwpack_url, rootfs_url, kernel_matrix, use_cache=True, rootfstype=None):
     """Generate image from a hwpack and rootfs url
 
     :param hwpack_url: url of the Linaro hwpack to download
@@ -113,6 +113,8 @@ 
     cmd = ("sudo flock /var/lock/lava-lmc.lck linaro-media-create --hwpack-force-yes --dev %s "
            "--image-file %s --binary %s --hwpack %s --image-size 3G" %
            (client.lmc_dev_arg, image_file, rootfs_path, hwpack_path))
+    if rootfstype is not None:
+        cmd += ' --rootfs ' + rootfstype
     logging.info("Executing the linaro-media-create command")
     logging.info(cmd)
     rc, output = getstatusoutput(cmd)

=== modified file 'lava_dispatcher/client/master.py'
--- lava_dispatcher/client/master.py	2011-12-11 17:12:43 +0000
+++ lava_dispatcher/client/master.py	2011-12-19 02:23:53 +0000
@@ -160,13 +160,13 @@ 
     session.run('mv ~/tmp/uInitrd /mnt/lava/boot/uInitrd')
     session.run('rm -rf ~/tmp')
 
-def _deploy_linaro_android_testrootfs(session, systemtbz2):
+def _deploy_linaro_android_testrootfs(session, systemtbz2, rootfstype):
     logging.info("Deploying the test root filesystem")
     sdcard_part_lava = session._client.device_option("sdcard_part_android")
 
     session.run('umount /dev/disk/by-label/testrootfs')
     session.run(
-        'mkfs.ext4 -q /dev/disk/by-label/testrootfs -L testrootfs')
+        'mkfs -t %s -q /dev/disk/by-label/testrootfs -L testrootfs' % rootfstype)
     session.run('udevadm trigger')
     session.run('mkdir -p /mnt/lava/system')
     session.run(
@@ -244,7 +244,7 @@ 
     def master_str(self):
         return self.device_option("MASTER_STR")
 
-    def deploy_linaro(self, hwpack, rootfs, kernel_matrix=None, use_cache=True):
+    def deploy_linaro(self, hwpack, rootfs, kernel_matrix=None, use_cache=True, rootfstype='ext3'):
         LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir
         LAVA_IMAGE_URL = self.context.lava_image_url
         try:
@@ -264,7 +264,7 @@ 
             root_url = '/'.join(u.strip('/') for u in [
                 LAVA_IMAGE_URL, root_tarball])
             with self._master_session() as session:
-                self._format_testpartition(session)
+                self._format_testpartition(session, rootfstype)
 
                 logging.info("Waiting for network to come up")
                 try:
@@ -284,7 +284,7 @@ 
         finally:
             shutil.rmtree(os.path.dirname(boot_tgz))
 
-    def deploy_linaro_android(self, boot, system, data, pkg=None, use_cache=True):
+    def deploy_linaro_android(self, boot, system, data, pkg=None, use_cache=True, rootfstype='ext4'):
         LAVA_IMAGE_TMPDIR = self.context.lava_image_tmpdir
         LAVA_IMAGE_URL = self.context.lava_image_url
         logging.info("Deploying Android on %s" % self.hostname)
@@ -330,7 +330,7 @@ 
 
             try:
                 _deploy_linaro_android_testboot(session, boot_url, pkg_url)
-                _deploy_linaro_android_testrootfs(session, system_url)
+                _deploy_linaro_android_testrootfs(session, system_url, rootfstype)
                 _purge_linaro_android_sdcard(session)
             except:
                 tb = traceback.format_exc()
@@ -391,11 +391,12 @@ 
         self.proc.sendline('export PS1="$PS1 [rc=$(echo \$?)]: "')
         self.proc.expect(self.master_str, timeout=10, lava_no_logging=1)
 
-    def _format_testpartition(self, session):
+    def _format_testpartition(self, session, fstype):
         logging.info("Format testboot and testrootfs partitions")
         session.run('umount /dev/disk/by-label/testrootfs')
         session.run(
-            'mkfs.ext3 -q /dev/disk/by-label/testrootfs -L testrootfs')
+            'mkfs -t %s -q /dev/disk/by-label/testrootfs -L testrootfs'
+            % fstype)
         session.run('umount /dev/disk/by-label/testboot')
         session.run('mkfs.vfat /dev/disk/by-label/testboot -n testboot')
 

=== modified file 'lava_dispatcher/client/qemu.py'
--- lava_dispatcher/client/qemu.py	2011-11-30 02:06:29 +0000
+++ lava_dispatcher/client/qemu.py	2011-12-19 01:44:12 +0000
@@ -44,8 +44,8 @@ 
         super(LavaQEMUClient, self).__init__(context, config)
         self._lava_image = None
 
-    def deploy_linaro(self, hwpack, rootfs, kernel_matrix=None, use_cache=True):
-        image_file = generate_image(self, hwpack, rootfs, kernel_matrix, use_cache)
+    def deploy_linaro(self, hwpack, rootfs, kernel_matrix=None, use_cache=True, rootfstype='ext3'):
+        image_file = generate_image(self, hwpack, rootfs, kernel_matrix, use_cache, rootfstype)
         self._lava_image = image_file
         with image_partition_mounted(self._lava_image, self.root_part) as mntdir:
             logging_system('echo linaro > %s/etc/hostname' % mntdir)