From 0f625728945fcbead723cd8bf1cf35859dd5cdc9 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Thu, 26 Nov 2020 17:44:03 +0100 Subject: [PATCH] Support using lzma for initramfs compression Reduces the size by roughly 30% at the expense of larger decompression time. Change-Id: I04613a26bd3f66ddcb1623e288d325666586fa6c --- ironic_python_agent_builder/__init__.py | 5 +++++ releasenotes/notes/lzma-bf4552b98dd5824a.yaml | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 releasenotes/notes/lzma-bf4552b98dd5824a.yaml diff --git a/ironic_python_agent_builder/__init__.py b/ironic_python_agent_builder/__init__.py index 4de45cb..cf30772 100644 --- a/ironic_python_agent_builder/__init__.py +++ b/ironic_python_agent_builder/__init__.py @@ -53,6 +53,8 @@ def main(): "ironic-python-agent and requirements") parser.add_argument("-v", "--verbose", action='store_true', help="Enable verbose logging in diskimage-builder") + parser.add_argument("--lzma", action='store_true', + help="Use lzma compression for smaller images") parser.add_argument("--extra-args", help="Extra arguments to pass to diskimage-builder") # TODO(dtantsur): handle distribution == tinyipa @@ -68,6 +70,9 @@ def main(): if args.branch: os.environ['DIB_REPOREF_ironic_python_agent'] = args.branch os.environ['DIB_REPOREF_requirements'] = args.branch + if args.lzma: + os.environ['DIB_IPA_COMPRESS_CMD'] = \ + 'xz --format=lzma --compress --stdout' extra_args = shlex.split(args.extra_args) if args.extra_args else [] if args.verbose: extra_args.append("-x") diff --git a/releasenotes/notes/lzma-bf4552b98dd5824a.yaml b/releasenotes/notes/lzma-bf4552b98dd5824a.yaml new file mode 100644 index 0000000..79e6d63 --- /dev/null +++ b/releasenotes/notes/lzma-bf4552b98dd5824a.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The ``ironic-python-agent-builder`` CLI now supports ``--lzma`` flag to + compress images with the LZMA algorithm.