[lxc-devel] [lxd/master] Bugfixes
stgraber on Github
lxc-bot at linuxcontainers.org
Fri Feb 26 05:50:37 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/20160226/9f546233/attachment.bin>
-------------- next part --------------
From 28a6cd27e775bb0afdb9260c2fc8034ea7138c50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 25 Feb 2016 19:21:28 -0500
Subject: [PATCH 1/4] Remove old backward compat code
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>
---
lxc/main.go | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/lxc/main.go b/lxc/main.go
index a95daac..88845f5 100644
--- a/lxc/main.go
+++ b/lxc/main.go
@@ -95,16 +95,6 @@ func run() error {
if err != nil {
return err
}
-
- // One time migration from old config
- if config.DefaultRemote == "" {
- _, ok := config.Remotes["local"]
- if !ok {
- config.Remotes["local"] = lxd.LocalRemote
- }
- config.DefaultRemote = "local"
- lxd.SaveConfig(config, configPath)
- }
}
// This is quite impolite, but it seems gnuflag needs us to shift our
From 96d4e31f0e01285a8a1f4418285d392e33fa61fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 25 Feb 2016 20:13:54 -0500
Subject: [PATCH 2/4] Use common table rendering in the client
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>
---
lxc/config.go | 9 +++++----
lxc/image.go | 11 ++++++-----
lxc/remote.go | 2 ++
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/lxc/config.go b/lxc/config.go
index 54134fc..5f02ee1 100644
--- a/lxc/config.go
+++ b/lxc/config.go
@@ -6,6 +6,7 @@ import (
"fmt"
"io/ioutil"
"os"
+ "sort"
"strings"
"syscall"
@@ -260,15 +261,15 @@ func (c *configCmd) run(config *lxd.Config, args []string) error {
}
table := tablewriter.NewWriter(os.Stdout)
+ table.SetAutoWrapText(false)
+ table.SetRowLine(true)
table.SetHeader([]string{
i18n.G("FINGERPRINT"),
i18n.G("COMMON NAME"),
i18n.G("ISSUE DATE"),
i18n.G("EXPIRY DATE")})
-
- for _, v := range data {
- table.Append(v)
- }
+ sort.Sort(SortImage(data))
+ table.AppendBulk(data)
table.Render()
return nil
diff --git a/lxc/image.go b/lxc/image.go
index 182f08e..8187333 100644
--- a/lxc/image.go
+++ b/lxc/image.go
@@ -548,7 +548,8 @@ func (c *imageCmd) showImages(images []shared.ImageInfo, filters []string) error
}
table := tablewriter.NewWriter(os.Stdout)
- table.SetColWidth(50)
+ table.SetAutoWrapText(false)
+ table.SetRowLine(true)
table.SetHeader([]string{
i18n.G("ALIAS"),
i18n.G("FINGERPRINT"),
@@ -571,14 +572,14 @@ func (c *imageCmd) showAliases(aliases shared.ImageAliases) error {
}
table := tablewriter.NewWriter(os.Stdout)
+ table.SetAutoWrapText(false)
+ table.SetRowLine(true)
table.SetHeader([]string{
i18n.G("ALIAS"),
i18n.G("FINGERPRINT"),
i18n.G("DESCRIPTION")})
-
- for _, v := range data {
- table.Append(v)
- }
+ sort.Sort(SortImage(data))
+ table.AppendBulk(data)
table.Render()
return nil
diff --git a/lxc/remote.go b/lxc/remote.go
index 9588660..f20f1bc 100644
--- a/lxc/remote.go
+++ b/lxc/remote.go
@@ -292,6 +292,8 @@ func (c *remoteCmd) run(config *lxd.Config, args []string) error {
}
table := tablewriter.NewWriter(os.Stdout)
+ table.SetAutoWrapText(false)
+ table.SetRowLine(true)
table.SetHeader([]string{
i18n.G("NAME"),
i18n.G("URL"),
From f78cd5409f2483bbdda1488e1995ade4d4ba38b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 25 Feb 2016 21:27:04 -0500
Subject: [PATCH 3/4] specs: Remove section on Etag (not implemented)
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>
---
specs/rest-api.md | 22 ++--------------------
1 file changed, 2 insertions(+), 20 deletions(-)
diff --git a/specs/rest-api.md b/specs/rest-api.md
index 621aca4..d64fdbb 100644
--- a/specs/rest-api.md
+++ b/specs/rest-api.md
@@ -136,24 +136,6 @@ Code | Meaning
401 | Cancelled
-# Safety for concurrent updates
-The API uses the HTTP ETAG to prevent potential problems when a resource
-changes on the server between the time it was accessed by the client and
-the time it is sent back for update.
-
-All GET queries come with an Etag HTTP header which is a short hash of
-the content that is relevant for an update. Any information which is
-read-only, shouldn't be included in the hash.
-
-On update (PUT), the same Etag field can be set by the client in its
-request alongside a If-Match header.. If it's set, the server will
-then compute the current Etag for the resource and compare the two.
-The update will then only be done if the two match.
-If they don't, an error will be returned instead using HTTP error code
-412 (Precondition failed).
-
-For consistency in LXD's use of hashes, the Etag hash should be a SHA-256.
-
# Recursion
To optimize queries of large lists, recursion is implemented for collections.
A "recursion" argument can be passed to a GET query against a collection.
@@ -459,8 +441,8 @@ Input (using a remote container, sent over the migration websocket):
"source": {"type": "migration", # Can be: "image", "migration", "copy" or "none"
"mode": "pull", # Only "pull" is supported for now
"operation": "https://10.0.2.3:8443/1.0/operations/<UUID>", # Full URL to the remote operation (pull mode only)
- "certificate": "PEM certificate", # Optional PEM certificate. If not mentioned, system CA is used.
- "base-image": "<some hash>" # Optional, the base image the container was created from
+ "certificate": "PEM certificate", # Optional PEM certificate. If not mentioned, system CA is used.
+ "base-image": "<fingerprint>", # Optional, the base image the container was created from
"secrets": {"control": "my-secret-string", # Secrets to use when talking to the migration source
"criu": "my-other-secret",
"fs": "my third secret"},
From a6da0e061f4ce9fe542a9933c0dc10569e960290 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 26 Feb 2016 00:43:46 -0500
Subject: [PATCH 4/4] specs: Fix rest-api layout
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>
---
specs/rest-api.md | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/specs/rest-api.md b/specs/rest-api.md
index d64fdbb..1c82ea7 100644
--- a/specs/rest-api.md
+++ b/specs/rest-api.md
@@ -147,6 +147,21 @@ they point to (typically a dict).
Recursion is implemented by simply replacing any pointer to an job (URL)
by the object itself.
+# Async operations
+Any operation which may take more than a second to be done must be done
+in the background, returning a background operation ID to the client.
+
+The client will then be able to either poll for a status update or wait
+for a notification using the long-poll API.
+
+# Notifications
+A websocket based API is available for notifications, different notification
+types exist to limit the traffic going to the client.
+
+It's recommended that the client always subscribes to the operations
+notification type before triggering remote operations so that it doesn't
+have to then poll for their status.
+
# API structure
* /
* /1.0
@@ -313,20 +328,6 @@ Input (none at present):
HTTP code for this should be 202 (Accepted).
-# Async operations
-Any operation which may take more than a second to be done must be done
-in the background, returning a background operation ID to the client.
-
-The client will then be able to either poll for a status update or wait
-for a notification using the long-poll API.
-
-# Notifications
-A long-poll API is available for notifications, different notification
-types exist to limit the traffic going to the client.
-
-It's recommend that the client always subscribes to the operations
-notification type before triggering remote operations so that it doesn't
-have to then poll for their status.
## /1.0/containers
### GET
* Description: List of containers
More information about the lxc-devel
mailing list