[lxc-devel] [lxd/master] Support zstd compression.

likema on Github lxc-bot at linuxcontainers.org
Sat Nov 21 20:01:49 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201121/3f48a162/attachment.bin>
-------------- next part --------------
From 14906754525aab38bdf844bec03d1c36faefe2d0 Mon Sep 17 00:00:00 2001
From: Like Ma <likemartinma at gmail.com>
Date: Sun, 22 Nov 2020 03:59:40 +0800
Subject: [PATCH] Support zstd compression.

---
 shared/archive.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/shared/archive.go b/shared/archive.go
index 0e279115a4..122b902c5a 100644
--- a/shared/archive.go
+++ b/shared/archive.go
@@ -54,6 +54,8 @@ func DetectCompressionFile(f io.Reader) ([]string, string, []string, error) {
 		return []string{"-xf"}, ".squashfs", []string{"sqfs2tar", "--no-skip"}, nil
 	case bytes.Equal(header[0:3], []byte{'Q', 'F', 'I'}):
 		return []string{""}, ".qcow2", []string{"qemu-img", "convert", "-O", "raw"}, nil
+	case bytes.Equal(header[0:4], []byte{0x28, 0xb5, 0x2f, 0xfd}):
+		return []string{"--zstd", "-xf"}, ".tar.zst", []string{"zstd", "-d"}, nil
 	default:
 		return nil, "", nil, fmt.Errorf("Unsupported compression")
 	}


More information about the lxc-devel mailing list