[lxc-devel] [lxd/master] Bugfixes
stgraber on Github
lxc-bot at linuxcontainers.org
Tue May 10 23:08:55 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/20160510/05ed7c6e/attachment.bin>
-------------- next part --------------
From 434c76566a8ee175380ccbdfb7374e4cd04c7f80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 10 May 2016 18:21:57 -0400
Subject: [PATCH 1/3] Properly record the source of all image copies
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #2010
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
client.go | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/client.go b/client.go
index 6338017..d1f07ea 100644
--- a/client.go
+++ b/client.go
@@ -580,27 +580,25 @@ func (c *Client) CopyImage(image string, dest *Client, copy_aliases bool, aliase
return err
}
- if c.Remote.Protocol != "simplestreams" {
- if !info.Public {
- var secret string
+ if c.Remote.Protocol != "simplestreams" && !info.Public {
+ var secret string
- resp, err := c.post("images/"+image+"/secret", nil, Async)
- if err != nil {
- return err
- }
-
- op, err := resp.MetadataAsOperation()
- if err != nil {
- return err
- }
+ resp, err := c.post("images/"+image+"/secret", nil, Async)
+ if err != nil {
+ return err
+ }
- secret, err = op.Metadata.GetString("secret")
- if err != nil {
- return err
- }
+ op, err := resp.MetadataAsOperation()
+ if err != nil {
+ return err
+ }
- source["secret"] = secret
+ secret, err = op.Metadata.GetString("secret")
+ if err != nil {
+ return err
}
+
+ source["secret"] = secret
source["fingerprint"] = image
}
From 19f39710c4ab67051d622f95baa87bfac7c63e4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 10 May 2016 18:51:27 -0400
Subject: [PATCH 2/3] Don't mark containers as ERROR while being created
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #1988
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/storage.go | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lxd/storage.go b/lxd/storage.go
index 68f30be..a17b205 100644
--- a/lxd/storage.go
+++ b/lxd/storage.go
@@ -234,6 +234,9 @@ func newStorageWithConfig(d *Daemon, sType storageType, config map[string]interf
}
func storageForFilename(d *Daemon, filename string) (storage, error) {
+ var filesystem string
+ var err error
+
config := make(map[string]interface{})
storageType := storageTypeDir
@@ -241,9 +244,11 @@ func storageForFilename(d *Daemon, filename string) (storage, error) {
return newStorageWithConfig(d, storageTypeMock, config)
}
- filesystem, err := filesystemDetect(filename)
- if err != nil {
- return nil, fmt.Errorf("couldn't detect filesystem for '%s': %v", filename, err)
+ if shared.PathExists(filename) {
+ filesystem, err = filesystemDetect(filename)
+ if err != nil {
+ return nil, fmt.Errorf("couldn't detect filesystem for '%s': %v", filename, err)
+ }
}
if shared.PathExists(filename + ".lv") {
From fa5861c5deb3dfc5ef3c899ba85d4ef35cae3b25 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 10 May 2016 19:07:33 -0400
Subject: [PATCH 3/3] Cleanup events sent for operations
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This fixes the following two issues:
- No-change events being emitted on websocket connects
- Out of order events on operation completion
Closes #1992
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/operations.go | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/lxd/operations.go b/lxd/operations.go
index 63e9ea9..b50d3c7 100644
--- a/lxd/operations.go
+++ b/lxd/operations.go
@@ -129,9 +129,11 @@ func (op *operation) Run() (chan error, error) {
op.done()
chanRun <- nil
+ op.lock.Lock()
shared.Debugf("Success for %s operation: %s", op.class.String(), op.id)
_, md, _ := op.Render()
eventSend("operation", md)
+ op.lock.Unlock()
}(op, chanRun)
}
op.lock.Unlock()
@@ -224,22 +226,16 @@ func (op *operation) Connect(r *http.Request, w http.ResponseWriter) (chan error
chanConnect <- err
shared.Debugf("Failed to handle %s operation: %s: %s", op.class.String(), op.id, err)
- _, md, _ := op.Render()
- eventSend("operation", md)
return
}
chanConnect <- nil
shared.Debugf("Handled %s operation: %s", op.class.String(), op.id)
- _, md, _ := op.Render()
- eventSend("operation", md)
}(op, chanConnect)
op.lock.Unlock()
shared.Debugf("Connected %s operation: %s", op.class.String(), op.id)
- _, md, _ := op.Render()
- eventSend("operation", md)
return chanConnect, nil
}
More information about the lxc-devel
mailing list