Merge ~raharper/curtin:feature/use-unsquashfs into curtin:master

Proposed by Ryan Harper
Status: Work in progress
Proposed branch: ~raharper/curtin:feature/use-unsquashfs
Merge into: curtin:master
Diff against target: 63 lines (+16/-11)
2 files modified
curtin/commands/extract.py (+15/-5)
tests/vmtests/__init__.py (+1/-6)
Reviewer Review Type Date Requested Status
curtin developers Pending
Review via email: mp+383814@code.launchpad.net

Commit message

Use unsquashfs if specified

To post a comment you must log in.

Unmerged commits

841d5fe... by Ryan Harper

vmtest: bump default nr_cpus to 2 for more unsquashfs performance!

91174a7... by Ryan Harper

wrap extracts in log_time

f907059... by Ryan Harper

Try unsquashfs first, vmtest change source to fsimage:PUBURL/squashfs

62f034a... by Ryan Harper

Use unsquashfs if fsimage is squashfs

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/curtin/commands/extract.py b/curtin/commands/extract.py
2index 069023f..c160f56 100644
3--- a/curtin/commands/extract.py
4+++ b/curtin/commands/extract.py
5@@ -50,11 +50,12 @@ def extract_root_tgz_url(url, target):
6 return
7
8 # Uses smtar to avoid specifying the compression type
9- util.subp(args=['sh', '-cf',
10- ('wget "$1" --progress=dot:mega -O - |'
11- 'smtar -C "$2" ' + ' '.join(tar_xattr_opts()) +
12- ' ' + '-Sxpf - --numeric-owner'),
13- '--', url, target])
14+ util.log_call(util.subp,
15+ args=['sh', '-cf',
16+ ('wget "$1" --progress=dot:mega -O - |'
17+ 'smtar -C "$2" ' + ' '.join(tar_xattr_opts()) +
18+ ' ' + '-Sxpf - --numeric-owner'),
19+ '--', url, target])
20
21
22 def extract_root_fsimage_url(url, target):
23@@ -72,6 +73,15 @@ def extract_root_fsimage_url(url, target):
24
25
26 def _extract_root_fsimage(path, target):
27+ try:
28+ util.log_call(
29+ util.subp, ["unsquashfs", "-f", "-d", target, path], capture=True)
30+ LOG.info('Unsquashed rootfs successfully')
31+ return
32+ except util.ProcessExecutionError as e:
33+ LOG.warning("Failed to unsquash '%s' for extraction: %s", path, e)
34+
35+ LOG.debug('Falling back to mounting fsimage for extraction')
36 mp = tempfile.mkdtemp()
37 try:
38 util.subp(['mount', '-o', 'loop,ro', path, mp], capture=True)
39diff --git a/tests/vmtests/__init__.py b/tests/vmtests/__init__.py
40index 222adcc..7c063cc 100644
41--- a/tests/vmtests/__init__.py
42+++ b/tests/vmtests/__init__.py
43@@ -819,7 +819,7 @@ class VMBaseClass(TestCase):
44 logger.debug('Setting cpus from '
45 ' env["CURTIN_VMTEST_NR_CPUS"] value: %s', nr_cpus)
46 if not nr_cpus:
47- nr_cpus = 1
48+ nr_cpus = 2
49 logger.debug('Setting cpus to default value: %s', nr_cpus)
50
51 return str(nr_cpus)
52@@ -1445,11 +1445,6 @@ class VMBaseClass(TestCase):
53 @classmethod
54 def get_install_source(cls, ftypes):
55 """Return install uri and a list of files needed to be published."""
56- # if release (install environment) is the same as target
57- # target (thing to install) then install via cp://
58- if cls.target_release == cls.release:
59- install_src = "cp:///media/root-ro"
60- return install_src, []
61
62 # publish the file to target/<ftype>
63 # and set the install source to <type>:PUBURL/target/<ftype>

Subscribers

People subscribed via source and target branches