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
diff --git a/curtin/commands/extract.py b/curtin/commands/extract.py
index 069023f..c160f56 100644
--- a/curtin/commands/extract.py
+++ b/curtin/commands/extract.py
@@ -50,11 +50,12 @@ def extract_root_tgz_url(url, target):
50 return50 return
5151
52 # Uses smtar to avoid specifying the compression type52 # Uses smtar to avoid specifying the compression type
53 util.subp(args=['sh', '-cf',53 util.log_call(util.subp,
54 ('wget "$1" --progress=dot:mega -O - |'54 args=['sh', '-cf',
55 'smtar -C "$2" ' + ' '.join(tar_xattr_opts()) +55 ('wget "$1" --progress=dot:mega -O - |'
56 ' ' + '-Sxpf - --numeric-owner'),56 'smtar -C "$2" ' + ' '.join(tar_xattr_opts()) +
57 '--', url, target])57 ' ' + '-Sxpf - --numeric-owner'),
58 '--', url, target])
5859
5960
60def extract_root_fsimage_url(url, target):61def extract_root_fsimage_url(url, target):
@@ -72,6 +73,15 @@ def extract_root_fsimage_url(url, target):
7273
7374
74def _extract_root_fsimage(path, target):75def _extract_root_fsimage(path, target):
76 try:
77 util.log_call(
78 util.subp, ["unsquashfs", "-f", "-d", target, path], capture=True)
79 LOG.info('Unsquashed rootfs successfully')
80 return
81 except util.ProcessExecutionError as e:
82 LOG.warning("Failed to unsquash '%s' for extraction: %s", path, e)
83
84 LOG.debug('Falling back to mounting fsimage for extraction')
75 mp = tempfile.mkdtemp()85 mp = tempfile.mkdtemp()
76 try:86 try:
77 util.subp(['mount', '-o', 'loop,ro', path, mp], capture=True)87 util.subp(['mount', '-o', 'loop,ro', path, mp], capture=True)
diff --git a/tests/vmtests/__init__.py b/tests/vmtests/__init__.py
index 222adcc..7c063cc 100644
--- a/tests/vmtests/__init__.py
+++ b/tests/vmtests/__init__.py
@@ -819,7 +819,7 @@ class VMBaseClass(TestCase):
819 logger.debug('Setting cpus from '819 logger.debug('Setting cpus from '
820 ' env["CURTIN_VMTEST_NR_CPUS"] value: %s', nr_cpus)820 ' env["CURTIN_VMTEST_NR_CPUS"] value: %s', nr_cpus)
821 if not nr_cpus:821 if not nr_cpus:
822 nr_cpus = 1822 nr_cpus = 2
823 logger.debug('Setting cpus to default value: %s', nr_cpus)823 logger.debug('Setting cpus to default value: %s', nr_cpus)
824824
825 return str(nr_cpus)825 return str(nr_cpus)
@@ -1445,11 +1445,6 @@ class VMBaseClass(TestCase):
1445 @classmethod1445 @classmethod
1446 def get_install_source(cls, ftypes):1446 def get_install_source(cls, ftypes):
1447 """Return install uri and a list of files needed to be published."""1447 """Return install uri and a list of files needed to be published."""
1448 # if release (install environment) is the same as target
1449 # target (thing to install) then install via cp://
1450 if cls.target_release == cls.release:
1451 install_src = "cp:///media/root-ro"
1452 return install_src, []
14531448
1454 # publish the file to target/<ftype>1449 # publish the file to target/<ftype>
1455 # and set the install source to <type>:PUBURL/target/<ftype>1450 # and set the install source to <type>:PUBURL/target/<ftype>

Subscribers

People subscribed via source and target branches