The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2348

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===

From 98c8e566224c0447e9b815930710a68df48af24f Mon Sep 17 00:00:00 2001
From: Carlos Neira <cneirabus...@gmail.com>
Date: Fri, 2 Sep 2016 15:24:07 -0300
Subject: [PATCH 1/2] Allow overriding compression algorithm

This adds an option for overriding the compression algorithm when
publishing images.

Closes #2296

Signed-off-by: Carlos Neira <cneirabus...@gmail.com>
---
 client.go             |   5 +--
 doc/api-extensions.md |   3 ++
 lxc/publish.go        |  12 +++---
 lxd/api_1.0.go        |   1 +
 lxd/images.go         |  10 ++++-
 po/lxd.pot            | 108 ++++++++++++++++++++++++++------------------------
 test/suites/basic.sh  |   7 ++++
 7 files changed, 85 insertions(+), 61 deletions(-)

diff --git a/client.go b/client.go
index f7a6c53..bb060d1 100644
--- a/client.go
+++ b/client.go
@@ -2414,12 +2414,11 @@ func (c *Client) AsyncWaitMeta(resp *Response) 
(*shared.Jmap, error) {
        return op.Metadata, nil
 }
 
-func (c *Client) ImageFromContainer(cname string, public bool, aliases 
[]string, properties map[string]string) (string, error) {
+func (c *Client) ImageFromContainer(cname string, public bool, aliases 
[]string, properties map[string]string, compression_algorithm string) (string, 
error) {
        if c.Remote.Public {
                return "", fmt.Errorf("This function isn't supported by public 
remotes.")
        }
-
-       source := shared.Jmap{"type": "container", "name": cname}
+       source := shared.Jmap{"type": "container", "name": cname, 
"compression_algorithm": compression_algorithm}
        if shared.IsSnapshot(cname) {
                source["type"] = "snapshot"
        }
diff --git a/doc/api-extensions.md b/doc/api-extensions.md
index 6ac0c30..7112eb6 100644
--- a/doc/api-extensions.md
+++ b/doc/api-extensions.md
@@ -74,3 +74,6 @@ flag to each XHR Request).
 Some browsers like Firefox and Safari can't accept server response without
 `Access-Control-Allow-Credentials: true` header. To ensure that the server will
 return a response with that header, set `core.https_allowed_credentials=true`.
+
+##image compression
+Add support to specify compression algorithm when publishing an image
diff --git a/lxc/publish.go b/lxc/publish.go
index b09675c..1aaffa5 100644
--- a/lxc/publish.go
+++ b/lxc/publish.go
@@ -12,9 +12,10 @@ import (
 )
 
 type publishCmd struct {
-       pAliases   aliasList // aliasList defined in lxc/image.go
-       makePublic bool
-       Force      bool
+       pAliases              aliasList // aliasList defined in lxc/image.go
+       compression_algorithm string
+       makePublic            bool
+       Force                 bool
 }
 
 func (c *publishCmd) showByDefault() bool {
@@ -33,6 +34,7 @@ func (c *publishCmd) flags() {
        gnuflag.Var(&c.pAliases, "alias", i18n.G("New alias to define at 
target"))
        gnuflag.BoolVar(&c.Force, "force", false, i18n.G("Stop the container if 
currently running"))
        gnuflag.BoolVar(&c.Force, "f", false, i18n.G("Stop the container if 
currently running"))
+       gnuflag.StringVar(&c.compression_algorithm, "compression", "gzip", 
i18n.G("Define a compression algorithm: for image or none"))
 }
 
 func (c *publishCmd) run(config *lxd.Config, args []string) error {
@@ -134,7 +136,7 @@ func (c *publishCmd) run(config *lxd.Config, args []string) 
error {
 
        // Optimized local publish
        if cRemote == iRemote {
-               fp, err = d.ImageFromContainer(cName, c.makePublic, c.pAliases, 
properties)
+               fp, err = d.ImageFromContainer(cName, c.makePublic, c.pAliases, 
properties, c.compression_algorithm)
                if err != nil {
                        return err
                }
@@ -142,7 +144,7 @@ func (c *publishCmd) run(config *lxd.Config, args []string) 
error {
                return nil
        }
 
-       fp, err = s.ImageFromContainer(cName, false, nil, properties)
+       fp, err = s.ImageFromContainer(cName, false, nil, properties, 
c.compression_algorithm)
        if err != nil {
                return err
        }
diff --git a/lxd/api_1.0.go b/lxd/api_1.0.go
index 90aaf9e..f60e170 100644
--- a/lxd/api_1.0.go
+++ b/lxd/api_1.0.go
@@ -64,6 +64,7 @@ func api10Get(d *Daemon, r *http.Request) Response {
                        "patch",
                        "usb_devices",
                        "https_allowed_credentials",
+                       "image_compression",
                },
 
                "api_status":  "stable",
diff --git a/lxd/images.go b/lxd/images.go
index 2fc649b..6e9a322 100644
--- a/lxd/images.go
+++ b/lxd/images.go
@@ -203,6 +203,7 @@ func imgPostContInfo(d *Daemon, r *http.Request, req 
imagePostReq,
        info.Properties = map[string]string{}
        name := req.Source["name"]
        ctype := req.Source["type"]
+       compression_algorithm := req.Source["compression_algorithm"]
        if ctype == "" || name == "" {
                return info, fmt.Errorf("No source provided")
        }
@@ -247,7 +248,14 @@ func imgPostContInfo(d *Daemon, r *http.Request, req 
imagePostReq,
        tarfile.Close()
 
        var compressedPath string
-       compress := daemonConfig["images.compression_algorithm"].Get()
+       var compress string
+
+       if compression_algorithm != "" {
+               compress = compression_algorithm
+       } else {
+               compress = daemonConfig["images.compression_algorithm"].Get()
+       }
+
        if compress != "none" {
                compressedPath, err = compressFile(tarfile.Name(), compress)
                if err != nil {
diff --git a/po/lxd.pot b/po/lxd.pot
index ca143a2..11e3862 100644
--- a/po/lxd.pot
+++ b/po/lxd.pot
@@ -7,7 +7,7 @@
 msgid   ""
 msgstr  "Project-Id-Version: lxd\n"
         "Report-Msgid-Bugs-To: lxc-devel@lists.linuxcontainers.org\n"
-        "POT-Creation-Date: 2016-08-30 17:59-0400\n"
+        "POT-Creation-Date: 2016-09-02 17:36-0300\n"
         "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
         "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
         "Language-Team: LANGUAGE <l...@li.org>\n"
@@ -48,7 +48,7 @@ msgid   "### This is a yaml representation of the 
configuration.\n"
         "### Note that the name is shown but cannot be changed"
 msgstr  ""
 
-#: lxc/image.go:85
+#: lxc/image.go:87
 msgid   "### This is a yaml representation of the image properties.\n"
         "### Any line starting with a '# will be ignored.\n"
         "###\n"
@@ -77,7 +77,7 @@ msgid   "### This is a yaml representation of the profile.\n"
         "### Note that the name is shown but cannot be changed"
 msgstr  ""
 
-#: lxc/image.go:617
+#: lxc/image.go:619
 #, c-format
 msgid   "%s (%d more)"
 msgstr  ""
@@ -90,11 +90,11 @@ msgstr  ""
 msgid   "(none)"
 msgstr  ""
 
-#: lxc/image.go:638 lxc/image.go:680
+#: lxc/image.go:640 lxc/image.go:682
 msgid   "ALIAS"
 msgstr  ""
 
-#: lxc/image.go:642
+#: lxc/image.go:644
 msgid   "ARCH"
 msgstr  ""
 
@@ -111,7 +111,7 @@ msgstr  ""
 msgid   "Admin password for %s: "
 msgstr  ""
 
-#: lxc/image.go:365
+#: lxc/image.go:367
 msgid   "Aliases:"
 msgstr  ""
 
@@ -119,12 +119,12 @@ msgstr  ""
 msgid   "An environment variable of the form HOME=/home/foo"
 msgstr  ""
 
-#: lxc/image.go:348 lxc/info.go:90
+#: lxc/image.go:350 lxc/info.go:90
 #, c-format
 msgid   "Architecture: %s"
 msgstr  ""
 
-#: lxc/image.go:369
+#: lxc/image.go:371
 #, c-format
 msgid   "Auto update: %s"
 msgstr  ""
@@ -187,7 +187,7 @@ msgstr  ""
 msgid   "Config key/value to apply to the new container"
 msgstr  ""
 
-#: lxc/config.go:531 lxc/config.go:596 lxc/image.go:734 lxc/profile.go:218
+#: lxc/config.go:531 lxc/config.go:596 lxc/image.go:736 lxc/profile.go:218
 #, c-format
 msgid   "Config parsing error: %s"
 msgstr  ""
@@ -196,7 +196,7 @@ msgstr  ""
 msgid   "Connection refused; is LXD running?"
 msgstr  ""
 
-#: lxc/publish.go:59
+#: lxc/publish.go:61
 msgid   "Container name is mandatory"
 msgstr  ""
 
@@ -205,12 +205,12 @@ msgstr  ""
 msgid   "Container name is: %s"
 msgstr  ""
 
-#: lxc/publish.go:141 lxc/publish.go:156
+#: lxc/publish.go:143 lxc/publish.go:158
 #, c-format
 msgid   "Container published with fingerprint: %s"
 msgstr  ""
 
-#: lxc/image.go:166
+#: lxc/image.go:168
 msgid   "Copy aliases from source"
 msgstr  ""
 
@@ -220,7 +220,7 @@ msgid   "Copy containers within or in between lxd 
instances.\n"
         "lxc copy [remote:]<source container> [[remote:]<destination 
container>] [--ephemeral|e] [--profile|-p <profile>...] [--config|-c 
<key=value>...]"
 msgstr  ""
 
-#: lxc/image.go:280
+#: lxc/image.go:282
 #, c-format
 msgid   "Copying the image: %s"
 msgstr  ""
@@ -245,7 +245,7 @@ msgid   "Create a read-only snapshot of a container.\n"
         "lxc snapshot u1 snap0"
 msgstr  ""
 
-#: lxc/image.go:353 lxc/info.go:92
+#: lxc/image.go:355 lxc/info.go:92
 #, c-format
 msgid   "Created: %s"
 msgstr  ""
@@ -259,10 +259,14 @@ msgstr  ""
 msgid   "Creating the container"
 msgstr  ""
 
-#: lxc/image.go:641 lxc/image.go:682
+#: lxc/image.go:643 lxc/image.go:684
 msgid   "DESCRIPTION"
 msgstr  ""
 
+#: lxc/publish.go:37
+msgid   "Define a compression algorithm: for image or none"
+msgstr  ""
+
 #: lxc/delete.go:25
 msgid   "Delete containers or container snapshots.\n"
         "\n"
@@ -317,16 +321,16 @@ msgid   "Execute the specified command in a container.\n"
         "Mode defaults to non-interactive, interactive mode is selected if 
both stdin AND stdout are terminals (stderr is ignored)."
 msgstr  ""
 
-#: lxc/image.go:357
+#: lxc/image.go:359
 #, c-format
 msgid   "Expires: %s"
 msgstr  ""
 
-#: lxc/image.go:359
+#: lxc/image.go:361
 msgid   "Expires: never"
 msgstr  ""
 
-#: lxc/config.go:273 lxc/image.go:639 lxc/image.go:681
+#: lxc/config.go:273 lxc/image.go:641 lxc/image.go:683
 msgid   "FINGERPRINT"
 msgstr  ""
 
@@ -334,7 +338,7 @@ msgstr  ""
 msgid   "Fast mode (same as --columns=nsacPt"
 msgstr  ""
 
-#: lxc/image.go:346
+#: lxc/image.go:348
 #, c-format
 msgid   "Fingerprint: %s"
 msgstr  ""
@@ -357,7 +361,7 @@ msgstr  ""
 msgid   "Force using the local unix socket."
 msgstr  ""
 
-#: lxc/image.go:169 lxc/list.go:123
+#: lxc/image.go:171 lxc/list.go:123
 msgid   "Format"
 msgstr  ""
 
@@ -389,16 +393,16 @@ msgstr  ""
 msgid   "Ignore the container state (only for start)."
 msgstr  ""
 
-#: lxc/image.go:285
+#: lxc/image.go:287
 msgid   "Image copied successfully!"
 msgstr  ""
 
-#: lxc/image.go:442
+#: lxc/image.go:444
 #, c-format
 msgid   "Image imported with fingerprint: %s"
 msgstr  ""
 
-#: lxc/image.go:429
+#: lxc/image.go:431
 #, c-format
 msgid   "Importing the image: %s"
 msgstr  ""
@@ -444,7 +448,7 @@ msgstr  ""
 msgid   "Ips:"
 msgstr  ""
 
-#: lxc/image.go:167
+#: lxc/image.go:169
 msgid   "Keep the image up to date after initial copy"
 msgstr  ""
 
@@ -535,11 +539,11 @@ msgstr  ""
 msgid   "Log:"
 msgstr  ""
 
-#: lxc/image.go:165
+#: lxc/image.go:167
 msgid   "Make image public"
 msgstr  ""
 
-#: lxc/publish.go:32
+#: lxc/publish.go:33
 msgid   "Make the image public"
 msgstr  ""
 
@@ -645,7 +649,7 @@ msgid   "Manage remote LXD servers.\n"
         "lxc remote get-default                                                
      Print the default remote."
 msgstr  ""
 
-#: lxc/image.go:95
+#: lxc/image.go:97
 msgid   "Manipulate container images.\n"
         "\n"
         "In LXD containers are created from images. Those images were 
themselves\n"
@@ -770,7 +774,7 @@ msgstr  ""
 msgid   "Name: %s"
 msgstr  ""
 
-#: lxc/image.go:168 lxc/publish.go:33
+#: lxc/image.go:170 lxc/publish.go:34
 msgid   "New alias to define at target"
 msgstr  ""
 
@@ -786,7 +790,7 @@ msgstr  ""
 msgid   "Only https URLs are supported for simplestreams"
 msgstr  ""
 
-#: lxc/image.go:434
+#: lxc/image.go:436
 msgid   "Only https:// is supported for remote image import."
 msgstr  ""
 
@@ -794,7 +798,7 @@ msgstr  ""
 msgid   "Options:"
 msgstr  ""
 
-#: lxc/image.go:538
+#: lxc/image.go:540
 #, c-format
 msgid   "Output is in %s"
 msgstr  ""
@@ -819,7 +823,7 @@ msgstr  ""
 msgid   "PROTOCOL"
 msgstr  ""
 
-#: lxc/image.go:640 lxc/remote.go:379
+#: lxc/image.go:642 lxc/remote.go:379
 msgid   "PUBLIC"
 msgstr  ""
 
@@ -858,7 +862,7 @@ msgstr  ""
 msgid   "Press enter to open the editor again"
 msgstr  ""
 
-#: lxc/config.go:532 lxc/config.go:597 lxc/image.go:735
+#: lxc/config.go:532 lxc/config.go:597 lxc/image.go:737
 msgid   "Press enter to start the editor again"
 msgstr  ""
 
@@ -923,7 +927,7 @@ msgstr  ""
 msgid   "Profiles: %s"
 msgstr  ""
 
-#: lxc/image.go:361
+#: lxc/image.go:363
 msgid   "Properties:"
 msgstr  ""
 
@@ -931,12 +935,12 @@ msgstr  ""
 msgid   "Public image server"
 msgstr  ""
 
-#: lxc/image.go:349
+#: lxc/image.go:351
 #, c-format
 msgid   "Public: %s"
 msgstr  ""
 
-#: lxc/publish.go:25
+#: lxc/publish.go:26
 msgid   "Publish containers as images.\n"
         "\n"
         "lxc publish [remote:]container [remote:] [--alias=ALIAS]... 
[prop-key=prop-value]..."
@@ -964,7 +968,7 @@ msgstr  ""
 msgid   "Retrieving image: %s"
 msgstr  ""
 
-#: lxc/image.go:643
+#: lxc/image.go:645
 msgid   "SIZE"
 msgstr  ""
 
@@ -1029,7 +1033,7 @@ msgstr  ""
 msgid   "Show the container's last 100 log lines?"
 msgstr  ""
 
-#: lxc/image.go:347
+#: lxc/image.go:349
 #, c-format
 msgid   "Size: %.2fMB"
 msgstr  ""
@@ -1038,7 +1042,7 @@ msgstr  ""
 msgid   "Snapshots:"
 msgstr  ""
 
-#: lxc/image.go:371
+#: lxc/image.go:373
 msgid   "Source:"
 msgstr  ""
 
@@ -1052,11 +1056,11 @@ msgstr  ""
 msgid   "Status: %s"
 msgstr  ""
 
-#: lxc/publish.go:34 lxc/publish.go:35
+#: lxc/publish.go:35 lxc/publish.go:36
 msgid   "Stop the container if currently running"
 msgstr  ""
 
-#: lxc/delete.go:106 lxc/publish.go:111
+#: lxc/delete.go:106 lxc/publish.go:113
 msgid   "Stopping container failed!"
 msgstr  ""
 
@@ -1080,7 +1084,7 @@ msgstr  ""
 msgid   "The container is currently running, stop it first or pass --force."
 msgstr  ""
 
-#: lxc/publish.go:89
+#: lxc/publish.go:91
 msgid   "The container is currently running. Use --force to have it stopped 
and restarted."
 msgstr  ""
 
@@ -1097,7 +1101,7 @@ msgstr  ""
 msgid   "The opposite of `lxc pause` is `lxc start`."
 msgstr  ""
 
-#: lxc/publish.go:62
+#: lxc/publish.go:64
 msgid   "There is no \"image name\".  Did you want an alias?"
 msgstr  ""
 
@@ -1105,7 +1109,7 @@ msgstr  ""
 msgid   "Time to wait for the container before killing it."
 msgstr  ""
 
-#: lxc/image.go:350
+#: lxc/image.go:352
 msgid   "Timestamps:"
 msgstr  ""
 
@@ -1113,7 +1117,7 @@ msgstr  ""
 msgid   "To start your first container, try: lxc launch ubuntu:16.04"
 msgstr  ""
 
-#: lxc/image.go:421
+#: lxc/image.go:423
 #, c-format
 msgid   "Transferring image: %d%%"
 msgstr  ""
@@ -1131,7 +1135,7 @@ msgstr  ""
 msgid   "Type: persistent"
 msgstr  ""
 
-#: lxc/image.go:644
+#: lxc/image.go:646
 msgid   "UPLOAD DATE"
 msgstr  ""
 
@@ -1143,7 +1147,7 @@ msgstr  ""
 msgid   "Unable to read remote TLS certificate"
 msgstr  ""
 
-#: lxc/image.go:355
+#: lxc/image.go:357
 #, c-format
 msgid   "Uploaded: %s"
 msgstr  ""
@@ -1205,11 +1209,11 @@ msgstr  ""
 msgid   "didn't get any affected image, container or snapshot from server"
 msgstr  ""
 
-#: lxc/image.go:341
+#: lxc/image.go:343
 msgid   "disabled"
 msgstr  ""
 
-#: lxc/image.go:343
+#: lxc/image.go:345
 msgid   "enabled"
 msgstr  ""
 
@@ -1227,7 +1231,7 @@ msgstr  ""
 msgid   "got bad version"
 msgstr  ""
 
-#: lxc/image.go:336 lxc/image.go:620
+#: lxc/image.go:338 lxc/image.go:622
 msgid   "no"
 msgstr  ""
 
@@ -1239,7 +1243,7 @@ msgstr  ""
 msgid   "ok (y/n)?"
 msgstr  ""
 
-#: lxc/main.go:302 lxc/main.go:306
+#: lxc/main.go:303 lxc/main.go:307
 #, c-format
 msgid   "processing aliases failed %s\n"
 msgstr  ""
@@ -1281,11 +1285,11 @@ msgstr  ""
 msgid   "unreachable return reached"
 msgstr  ""
 
-#: lxc/main.go:234
+#: lxc/main.go:235
 msgid   "wrong number of subcommand arguments"
 msgstr  ""
 
-#: lxc/delete.go:45 lxc/image.go:338 lxc/image.go:624
+#: lxc/delete.go:45 lxc/image.go:340 lxc/image.go:626
 msgid   "yes"
 msgstr  ""
 
diff --git a/test/suites/basic.sh b/test/suites/basic.sh
index 7256eea..509260a 100644
--- a/test/suites/basic.sh
+++ b/test/suites/basic.sh
@@ -110,6 +110,13 @@ test_basic_usage() {
   curl -k -s --cert "${LXD_CONF}/client3.crt" --key "${LXD_CONF}/client3.key" 
-X GET "https://${LXD_ADDR}/1.0/images"; | grep "/1.0/images/" && false
   lxc image delete foo-image
 
+# Test image compression on publish
+  lxc publish bar --alias=foo-image-compressed --compression=bzip2 prop=val1
+  lxc image show foo-image-compressed | grep val1
+  curl -k -s --cert "${LXD_CONF}/client3.crt" --key "${LXD_CONF}/client3.key" 
-X GET "https://${LXD_ADDR}/1.0/images"; | grep "/1.0/images/" && false
+  lxc image delete foo-image-compressed
+
+
   # Test privileged container publish
   lxc profile create priv
   lxc profile set priv security.privileged true

From b8e182f761adcdfa98e6acc70384f28704ce1700 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Wed, 7 Sep 2016 14:54:35 -0400
Subject: [PATCH 2/2] Small fixes for image compression
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This fixes a few remaining issues in cneira's branch:
 - Move the compression_algorithm property to the root (out of the source map)
 - Clarifiy API extension documentation
 - Update rest-api.md with the new field
 - Only set compression_algorithm if provided by the user
 - Rename API extension to image_compression_algorithm

Closes #2337

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 client.go             |  7 ++++++-
 doc/api-extensions.md |  6 ++++--
 doc/rest-api.md       |  9 +++++----
 lxd/api_1.0.go        |  2 +-
 lxd/images.go         | 16 ++++++++--------
 5 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/client.go b/client.go
index bb060d1..8747949 100644
--- a/client.go
+++ b/client.go
@@ -2418,12 +2418,17 @@ func (c *Client) ImageFromContainer(cname string, 
public bool, aliases []string,
        if c.Remote.Public {
                return "", fmt.Errorf("This function isn't supported by public 
remotes.")
        }
-       source := shared.Jmap{"type": "container", "name": cname, 
"compression_algorithm": compression_algorithm}
+       source := shared.Jmap{"type": "container", "name": cname}
        if shared.IsSnapshot(cname) {
                source["type"] = "snapshot"
        }
+
        body := shared.Jmap{"public": public, "source": source, "properties": 
properties}
 
+       if compression_algorithm != "" {
+               body["compression_algorithm"] = compression_algorithm
+       }
+
        resp, err := c.post("images", body, Async)
        if err != nil {
                return "", err
diff --git a/doc/api-extensions.md b/doc/api-extensions.md
index 7112eb6..ff84170 100644
--- a/doc/api-extensions.md
+++ b/doc/api-extensions.md
@@ -75,5 +75,7 @@ Some browsers like Firefox and Safari can't accept server 
response without
 `Access-Control-Allow-Credentials: true` header. To ensure that the server will
 return a response with that header, set `core.https_allowed_credentials=true`.
 
-##image compression
-Add support to specify compression algorithm when publishing an image
+## image\_compression\_algorithm
+This adds support for a compression\_algorithm property when creating an image 
(POST to /1.0/images).
+
+Setting this property overrides the server default value 
(images.compression\_algorithm).
diff --git a/doc/rest-api.md b/doc/rest-api.md
index 4c1b10c..b92dc09 100644
--- a/doc/rest-api.md
+++ b/doc/rest-api.md
@@ -1183,13 +1183,14 @@ In the source image case, the following dict must be 
used:
 In the source container case, the following dict must be used:
 
     {
-        "filename": filename,     # Used for export (optional)
-        "public":   true,         # Whether the image can be downloaded by 
untrusted users  (defaults to false)
-        "properties": {           # Image properties (optional)
+        "compression_algorithm": "xz",  # Override the compression algorithm 
for the image (optional)
+        "filename": filename,           # Used for export (optional)
+        "public":   true,               # Whether the image can be downloaded 
by untrusted users (defaults to false)
+        "properties": {                 # Image properties (optional)
             "os": "Ubuntu"
         },
         "source": {
-            "type": "container",  # One of "container" or "snapshot"
+            "type": "container",        # One of "container" or "snapshot"
             "name": "abc"
         }
     }
diff --git a/lxd/api_1.0.go b/lxd/api_1.0.go
index f60e170..96e29e7 100644
--- a/lxd/api_1.0.go
+++ b/lxd/api_1.0.go
@@ -64,7 +64,7 @@ func api10Get(d *Daemon, r *http.Request) Response {
                        "patch",
                        "usb_devices",
                        "https_allowed_credentials",
-                       "image_compression",
+                       "image_compression_algorithm",
                },
 
                "api_status":  "stable",
diff --git a/lxd/images.go b/lxd/images.go
index 6e9a322..5600936 100644
--- a/lxd/images.go
+++ b/lxd/images.go
@@ -178,11 +178,12 @@ type templateEntry struct {
 }
 
 type imagePostReq struct {
-       Filename   string            `json:"filename"`
-       Public     bool              `json:"public"`
-       Source     map[string]string `json:"source"`
-       Properties map[string]string `json:"properties"`
-       AutoUpdate bool              `json:"auto_update"`
+       Filename             string            `json:"filename"`
+       Public               bool              `json:"public"`
+       Source               map[string]string `json:"source"`
+       Properties           map[string]string `json:"properties"`
+       AutoUpdate           bool              `json:"auto_update"`
+       CompressionAlgorithm string            `json:"compression_algorithm"`
 }
 
 type imageMetadata struct {
@@ -203,7 +204,6 @@ func imgPostContInfo(d *Daemon, r *http.Request, req 
imagePostReq,
        info.Properties = map[string]string{}
        name := req.Source["name"]
        ctype := req.Source["type"]
-       compression_algorithm := req.Source["compression_algorithm"]
        if ctype == "" || name == "" {
                return info, fmt.Errorf("No source provided")
        }
@@ -250,8 +250,8 @@ func imgPostContInfo(d *Daemon, r *http.Request, req 
imagePostReq,
        var compressedPath string
        var compress string
 
-       if compression_algorithm != "" {
-               compress = compression_algorithm
+       if req.CompressionAlgorithm != "" {
+               compress = req.CompressionAlgorithm
        } else {
                compress = daemonConfig["images.compression_algorithm"].Get()
        }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to