[lxc-devel] [lxd/master] Bugfixes

stgraber on Github lxc-bot at linuxcontainers.org
Wed Apr 5 02:56:02 UTC 2017


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/20170405/10456e8c/attachment.bin>
-------------- next part --------------
From 3b57301b9329088f61ebbc873f9bdc85a542e6d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 4 Apr 2017 22:50:19 -0400
Subject: [PATCH 1/2] api: Add the Stateful field to ContainerPut
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>
---
 lxd/container_lxc.go    | 2 +-
 shared/api/container.go | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 76bdeff..df710be 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -2503,7 +2503,6 @@ func (c *containerLXC) Render() (interface{}, interface{}, error) {
 			Name:            c.name,
 			Status:          statusCode.String(),
 			StatusCode:      statusCode,
-			Stateful:        c.stateful,
 		}
 
 		ct.Architecture = architectureName
@@ -2513,6 +2512,7 @@ func (c *containerLXC) Render() (interface{}, interface{}, error) {
 		ct.Ephemeral = c.ephemeral
 		ct.LastUsedAt = c.lastUsedDate
 		ct.Profiles = c.profiles
+		ct.Stateful = c.stateful
 
 		return &ct, etag, nil
 	}
diff --git a/shared/api/container.go b/shared/api/container.go
index e81219c..849b9bf 100644
--- a/shared/api/container.go
+++ b/shared/api/container.go
@@ -34,7 +34,10 @@ type ContainerPut struct {
 	Devices      map[string]map[string]string `json:"devices" yaml:"devices"`
 	Ephemeral    bool                         `json:"ephemeral" yaml:"ephemeral"`
 	Profiles     []string                     `json:"profiles" yaml:"profiles"`
-	Restore      string                       `json:"restore,omitempty" yaml:"restore,omitempty"`
+
+	// For snapshot restore
+	Restore  string `json:"restore,omitempty" yaml:"restore,omitempty"`
+	Stateful bool   `json:"stateful" yaml:"stateful"`
 }
 
 // Container represents a LXD container
@@ -45,7 +48,6 @@ type Container struct {
 	ExpandedConfig  map[string]string            `json:"expanded_config" yaml:"expanded_config"`
 	ExpandedDevices map[string]map[string]string `json:"expanded_devices" yaml:"expanded_devices"`
 	Name            string                       `json:"name" yaml:"name"`
-	Stateful        bool                         `json:"stateful" yaml:"stateful"`
 	Status          string                       `json:"status" yaml:"status"`
 	StatusCode      StatusCode                   `json:"status_code" yaml:"status_code"`
 

From 5e2ed6a4055fc3f15895a2b30df2111f83e141bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 4 Apr 2017 00:34:45 -0400
Subject: [PATCH 2/2] config: Fix SaveConfig's DeepCopy call
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/file.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxc/config/file.go b/lxc/config/file.go
index 220f29b..7162774 100644
--- a/lxc/config/file.go
+++ b/lxc/config/file.go
@@ -45,7 +45,7 @@ func LoadConfig(path string) (*Config, error) {
 func (c *Config) SaveConfig(path string) error {
 	// Create a new copy for the config file
 	conf := Config{}
-	err := shared.DeepCopy(c, conf)
+	err := shared.DeepCopy(c, &conf)
 	if err != nil {
 		return fmt.Errorf("Unable to copy the configuration: %v", err)
 	}


More information about the lxc-devel mailing list