summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Araujo <luis.araujo@collabora.co.uk>2015-07-10 17:23:50 (GMT)
committerLuis Araujo <luis.araujo@collabora.co.uk>2015-07-10 17:23:50 (GMT)
commit7020a915abe50ea93fdb6629dce9a5a45d403877 (patch)
tree97584069add5ea809605bff8e4205cd87d255c1d
parenta7d44a04849889c8ca44079d25b973a8ddfe1e45 (diff)
downloadlava-dispatcher-add-bootfstype.tar.gz
lava-dispatcher-add-bootfstype.tar.xz
WIP Add bootfstypeadd-bootfstype
This commits adds the bootfstype json job field to the latest master lava-dispatcher code.
-rw-r--r--lava_dispatcher/actions/deploy.py8
-rw-r--r--lava_dispatcher/client/base.py9
-rw-r--r--lava_dispatcher/device/bootloader.py9
-rw-r--r--lava_dispatcher/device/master.py49
-rw-r--r--lava_dispatcher/device/target.py6
5 files changed, 50 insertions, 31 deletions
diff --git a/lava_dispatcher/actions/deploy.py b/lava_dispatcher/actions/deploy.py
index 6d83e21..001c66e 100644
--- a/lava_dispatcher/actions/deploy.py
+++ b/lava_dispatcher/actions/deploy.py
@@ -59,6 +59,7 @@ class cmd_deploy_linaro_image(BaseAction):
'dtb': {'type': 'string', 'optional': True},
'customize': {'type': 'object', 'optional': True},
'rootfstype': {'type': 'string', 'optional': True},
+ 'bootfstype': {'type': 'string', 'optional': True},
'bootloadertype': {'type': 'string', 'optional': True,
'default': 'u_boot'},
'login_prompt': {'type': 'string', 'optional': True},
@@ -99,7 +100,8 @@ class cmd_deploy_linaro_image(BaseAction):
prompt when specifying login commands')
def run(self, hwpack=None, rootfs=None, image=None, dtb=None,
- rootfstype='ext4', bootloadertype='u_boot', login_prompt=None,
+ rootfstype='ext4', bootfstype='vfat',
+ bootloadertype='u_boot', login_prompt=None,
password_prompt=None, username=None, password=None,
login_commands=None, customize=None, qemu_pflash=None,
boot_part=None, root_part=None):
@@ -121,8 +123,8 @@ class cmd_deploy_linaro_image(BaseAction):
self.client.config.root_part = root_part
self.client.deploy_linaro(
hwpack=hwpack, rootfs=rootfs, image=image, dtb=dtb,
- rootfstype=rootfstype, bootloadertype=bootloadertype,
- qemu_pflash=qemu_pflash,)
+ rootfstype=rootfstype, bootfstype=bootfstype,
+ bootloadertype=bootloadertype, qemu_pflash=qemu_pflash,)
cmd_deploy_image = cmd_deploy_linaro_image
diff --git a/lava_dispatcher/client/base.py b/lava_dispatcher/client/base.py
index dacd8fc..54df66c 100644
--- a/lava_dispatcher/client/base.py
+++ b/lava_dispatcher/client/base.py
@@ -397,7 +397,8 @@ class LavaClient(object):
self.target_device.deploy_android(images, rootfstype,
bootloadertype, target_type)
- def deploy_linaro(self, hwpack, rootfs, image, dtb, rootfstype, bootloadertype, qemu_pflash=None):
+ def deploy_linaro(self, hwpack, rootfs, image, dtb, rootfstype, bootfstype,
+ bootloadertype, qemu_pflash=None):
if image is None:
if hwpack is None or rootfs is None:
raise CriticalError(
@@ -409,11 +410,11 @@ class LavaClient(object):
if image is None:
self.target_device.deploy_linaro(hwpack, rootfs, dtb,
- rootfstype, bootloadertype,
- qemu_pflash=qemu_pflash)
+ rootfstype, bootfstype,
+ bootloadertype, qemu_pflash=qemu_pflash)
else:
self.target_device.deploy_linaro_prebuilt(image, dtb, rootfstype,
- bootloadertype,
+ bootfstype, bootloadertype,
qemu_pflash=qemu_pflash)
def deploy_linaro_kernel(self, kernel, ramdisk, dtb, overlays, rootfs,
diff --git a/lava_dispatcher/device/bootloader.py b/lava_dispatcher/device/bootloader.py
index fc3e7e0..a1ff982 100644
--- a/lava_dispatcher/device/bootloader.py
+++ b/lava_dispatcher/device/bootloader.py
@@ -267,12 +267,14 @@ class BootloaderTarget(MasterImageTarget):
ramdisk,
dtb)
- def deploy_linaro(self, hwpack, rfs, dtb, rootfstype, bootloadertype, qemu_pflash=None):
+ def deploy_linaro(self, hwpack, rfs, dtb, rootfstype, bootfstype,
+ bootloadertype, qemu_pflash=None):
self._uboot_boot = False
super(BootloaderTarget, self).deploy_linaro(hwpack, rfs, dtb,
- rootfstype, bootloadertype, qemu_pflash=qemu_pflash)
+ rootfstype, bootfstype,
+ bootloadertype, qemu_pflash=qemu_pflash)
- def deploy_linaro_prebuilt(self, image, dtb, rootfstype, bootloadertype, qemu_pflash=None):
+ def deploy_linaro_prebuilt(self, image, dtb, rootfstype, bootfstype, bootloadertype, qemu_pflash=None):
self._uboot_boot = False
if self._is_ipxe():
if image is not None:
@@ -294,6 +296,7 @@ class BootloaderTarget(MasterImageTarget):
super(BootloaderTarget, self).deploy_linaro_prebuilt(image,
dtb,
rootfstype,
+ bootfstype,
bootloadertype,
qemu_pflash=qemu_pflash)
diff --git a/lava_dispatcher/device/master.py b/lava_dispatcher/device/master.py
index b5b88ee..26749f4 100644
--- a/lava_dispatcher/device/master.py
+++ b/lava_dispatcher/device/master.py
@@ -123,7 +123,7 @@ class MasterImageTarget(Target):
finalize_process(self.proc)
self.proc = None
- def deploy_linaro(self, hwpack, rfs, dtb, rootfstype, bootloadertype, qemu_pflash=None):
+ def deploy_linaro(self, hwpack, rfs, dtb, rootfstype, bootfstype, bootloadertype, qemu_pflash=None):
self.boot_master_image()
image_file = generate_image(self, hwpack, rfs, dtb, self.scratch_dir,
@@ -131,7 +131,7 @@ class MasterImageTarget(Target):
(boot_tgz, root_tgz, distro) = self._generate_tarballs(image_file)
self._read_boot_cmds(boot_tgz=boot_tgz)
- self._deploy_tarballs(boot_tgz, root_tgz, rootfstype)
+ self._deploy_tarballs(boot_tgz, root_tgz, rootfstype, bootfstype)
def deploy_android(self, images, rootfstype,
bootloadertype, target_type):
@@ -184,7 +184,7 @@ class MasterImageTarget(Target):
self._deploy_linaro_android_system(master, system_url)
self._deploy_linaro_android_data(master, data_url)
- def deploy_linaro_prebuilt(self, image, dtb, rootfstype, bootloadertype, qemu_pflash=None):
+ def deploy_linaro_prebuilt(self, image, dtb, rootfstype, bootfstype, bootloadertype, qemu_pflash=None):
self.boot_master_image()
if self.context.job_data.get('health_check', False):
@@ -196,9 +196,9 @@ class MasterImageTarget(Target):
(boot_tgz, root_tgz, distro) = self._generate_tarballs(image_file)
self._read_boot_cmds(boot_tgz=boot_tgz)
- self._deploy_tarballs(boot_tgz, root_tgz, rootfstype)
+ self._deploy_tarballs(boot_tgz, root_tgz, rootfstype, bootfstype)
- def _deploy_tarballs(self, boot_tgz, root_tgz, rootfstype):
+ def _deploy_tarballs(self, boot_tgz, root_tgz, rootfstype, bootfstype):
tmpdir = self.context.config.lava_image_tmpdir
url = self.context.config.lava_image_url
@@ -207,9 +207,10 @@ class MasterImageTarget(Target):
boot_url = '/'.join(u.strip('/') for u in [url, boot_tarball])
root_url = '/'.join(u.strip('/') for u in [url, root_tarball])
with self._as_master() as master:
- self._format_testpartition(master, rootfstype)
+ self._format_testpartition(master, rootfstype, bootfstype)
try:
- self._deploy_linaro_rootfs(master, root_url, rootfstype)
+ self._deploy_linaro_rootfs(master, root_url, rootfstype,
+ bootfstype)
self._deploy_linaro_bootfs(master, boot_url)
except KeyboardInterrupt:
raise KeyboardInterrupt
@@ -296,20 +297,21 @@ class MasterImageTarget(Target):
else:
logging.debug("Unable to read boot commands dynamically.")
- def _format_testpartition(self, runner, fstype):
+ def _format_testpartition(self, runner, rootfstype, bootfstype="vfat"):
try:
- 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 %s -t %s -q %s -L %s'
- % (force, fstype, self.testrootfs_path, self.testrootfs_label), timeout=1800)
+ self._do_format_partition(runner, self.testrootfs_label,
+ self.testrootfs_path, rootfstype)
runner.run('umount %s' % self.testboot_path, failok=True)
- runner.run('nice mkfs.vfat %s -n %s' % (self.testboot_path, self.testboot_label))
+ if bootfstype == "vfat":
+ runner.run('nice mkfs.vfat %s -n %s'
+ % (self.testboot_path, self.testboot_label))
+ else:
+ self._do_format_partition(runner, self.testboot_label,
+ self.testboot_path, bootfstype)
+
self.context.test_data.add_result('format_test_partition_in_master_image',
'pass')
except:
@@ -319,6 +321,15 @@ class MasterImageTarget(Target):
'fail')
raise
+ def _do_format_partition(self, runner, label, path, fstype):
+ force = ""
+ if fstype.startswith("ext"):
+ force = "-F"
+ elif fstype == "btrfs":
+ force = "-f"
+ runner.run('nice mkfs %s -t %s -q %s -L %s'
+ % (force, fstype, path, label), timeout=1800)
+
def _generate_tarballs(self, image_file):
self.customize_image(image_file)
self._read_boot_cmds(image=image_file)
@@ -647,7 +658,7 @@ class MasterImageTarget(Target):
'fail')
raise
- def _deploy_linaro_rootfs(self, session, rootfs, rootfstype):
+ def _deploy_linaro_rootfs(self, session, rootfs, rootfstype, bootfstype):
try:
logging.info("Deploying linaro image")
session.run('udevadm trigger')
@@ -672,8 +683,8 @@ class MasterImageTarget(Target):
if session.is_file_exist('/mnt/root/etc/fstab'):
logging.info("Rewriting /etc/fstab in test image")
session.run(
- 'echo "LABEL=%s /boot vfat defaults 0 0" > /mnt/root/etc/fstab' %
- self.testboot_label)
+ 'echo "LABEL=%s /boot %s defaults 0 0" > /mnt/root/etc/fstab' %
+ (self.testboot_label, bootfstype))
session.run(
'echo "LABEL=%s / %s defaults 0 1" >> /mnt/root/etc/fstab' %
(self.testrootfs_label, rootfstype))
diff --git a/lava_dispatcher/device/target.py b/lava_dispatcher/device/target.py
index dbb1b47..e962390 100644
--- a/lava_dispatcher/device/target.py
+++ b/lava_dispatcher/device/target.py
@@ -208,14 +208,16 @@ class Target(object):
"""
raise NotImplementedError('power_on')
- def deploy_linaro(self, hwpack, rfs, dtb, rootfstype, bootloadertype, qemu_pflash=None):
+ def deploy_linaro(self, hwpack, rfs, dtb, rootfstype, bootfstype,
+ bootloadertype, qemu_pflash=None):
raise NotImplementedError('deploy_image')
def deploy_android(self, images, rootfstype,
bootloadertype, target_type):
raise NotImplementedError('deploy_android_image')
- def deploy_linaro_prebuilt(self, image, dtb, rootfstype, bootloadertype, qemu_pflash=None):
+ def deploy_linaro_prebuilt(self, image, dtb, rootfstype, bootfstype,
+ bootloadertype, qemu_pflash=None):
raise NotImplementedError('deploy_linaro_prebuilt')
def deploy_linaro_kernel(self, kernel, ramdisk, dtb, overlays, rootfs, nfsrootfs, image, bootloader, firmware, bl0, bl1,