[lxc-devel] [lxd/master] simplestream changes

stgraber on Github lxc-bot at linuxcontainers.org
Sun Aug 7 16:49:29 UTC 2016


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/20160807/7ff12734/attachment.bin>
-------------- next part --------------
From 4f3b04bc2bfdf6106147a7d3a27cb8555c2410ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 6 Aug 2016 21:00:57 -0400
Subject: [PATCH 1/3] simplestreams: properly deal with unset expiry
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 shared/simplestreams.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/shared/simplestreams.go b/shared/simplestreams.go
index 4a0ed4f..86a9fc5 100644
--- a/shared/simplestreams.go
+++ b/shared/simplestreams.go
@@ -180,6 +180,7 @@ func (s *SimpleStreamsManifest) ToLXD() ([]ImageInfo, map[string][][]string) {
 			}
 
 			// Attempt to parse the EOL
+			image.ExpiryDate = time.Unix(0, 0).UTC()
 			if product.SupportedEOL != "" {
 				eolDate, err := time.Parse(eolLayout, product.SupportedEOL)
 				if err == nil {

From 8e81adc68741d4cb126f761c43a804130c326133 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sun, 7 Aug 2016 12:47:35 -0400
Subject: [PATCH 2/3] simplestreams: handle images without labels
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 shared/simplestreams.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/shared/simplestreams.go b/shared/simplestreams.go
index 86a9fc5..ace5f46 100644
--- a/shared/simplestreams.go
+++ b/shared/simplestreams.go
@@ -160,6 +160,12 @@ func (s *SimpleStreamsManifest) ToLXD() ([]ImageInfo, map[string][][]string) {
 			}
 
 			// Generate the actual image entry
+			description := fmt.Sprintf("%s %s %s", product.OperatingSystem, product.ReleaseTitle, product.Architecture)
+			if version.Label != "" {
+				description = fmt.Sprintf("%s (%s)", description, version.Label)
+			}
+			description = fmt.Sprintf("%s (%s)", description, name)
+
 			image := ImageInfo{}
 			image.Architecture = architectureName
 			image.Public = true
@@ -176,7 +182,7 @@ func (s *SimpleStreamsManifest) ToLXD() ([]ImageInfo, map[string][][]string) {
 				"architecture": product.Architecture,
 				"label":        version.Label,
 				"serial":       name,
-				"description":  fmt.Sprintf("%s %s %s (%s) (%s)", product.OperatingSystem, product.ReleaseTitle, product.Architecture, version.Label, name),
+				"description":  description,
 			}
 
 			// Attempt to parse the EOL

From 34f62a7ea5cfea0f640ceb16ffc49a8f7c206c6c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sun, 7 Aug 2016 12:47:54 -0400
Subject: [PATCH 3/3] config: Switch to using simplestreams for images:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This allows for better caching on the client network and lower CPU usage
on the image server thanks to only using TLS for the metadata.

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 config.go | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/config.go b/config.go
index f4da426..8cd47bb 100644
--- a/config.go
+++ b/config.go
@@ -52,8 +52,9 @@ var LocalRemote = RemoteConfig{
 	Public: false}
 
 var ImagesRemote = RemoteConfig{
-	Addr:   "https://images.linuxcontainers.org",
-	Public: true}
+	Addr:     "https://images.linuxcontainers.org",
+	Public:   true,
+	Protocol: "simplestreams"}
 
 var UbuntuRemote = RemoteConfig{
 	Addr:     "https://cloud-images.ubuntu.com/releases",


More information about the lxc-devel mailing list