[lxc-devel] [lxd/master] lxd/images: Set arch names when downloading

stgraber on Github lxc-bot at linuxcontainers.org
Mon Jun 22 21:33:15 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200622/cdcfa5e4/attachment.bin>
-------------- next part --------------
From 406eff43a98c95621342f61645df12f142c455dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 22 Jun 2020 17:32:33 -0400
Subject: [PATCH] lxd/images: Set arch names when downloading
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #7563

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/images.go | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lxd/images.go b/lxd/images.go
index 7e278ca1b5..cb38fb9dae 100644
--- a/lxd/images.go
+++ b/lxd/images.go
@@ -390,13 +390,17 @@ func imgPostURLInfo(d *Daemon, req api.ImagesPost, op *operations.Operation, pro
 		return nil, err
 	}
 
-	architecturesStr := []string{}
-	for _, arch := range d.os.Architectures {
-		architecturesStr = append(architecturesStr, fmt.Sprintf("%d", arch))
+	architectures := []string{}
+	for _, architecture := range d.os.Architectures {
+		architectureName, err := osarch.ArchitectureName(architecture)
+		if err != nil {
+			return nil, err
+		}
+		architectures = append(architectures, architectureName)
 	}
 
 	head.Header.Set("User-Agent", version.UserAgent)
-	head.Header.Set("LXD-Server-Architectures", strings.Join(architecturesStr, ", "))
+	head.Header.Set("LXD-Server-Architectures", strings.Join(architectures, ", "))
 	head.Header.Set("LXD-Server-Version", version.Version)
 
 	raw, err := myhttp.Do(head)


More information about the lxc-devel mailing list