[lxc-devel] [lxd/master] Fix API inconsistency with backups
stgraber on Github
lxc-bot at linuxcontainers.org
Wed Aug 14 14:34:31 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 467 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190814/f29c7135/attachment.bin>
-------------- next part --------------
From 6e6106add5e551dc7a3396f15134d8fdc803c7f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 14 Aug 2019 10:27:16 -0400
Subject: [PATCH 1/3] shared/api: Fix backup timestamps
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/api/container_backup.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/shared/api/container_backup.go b/shared/api/container_backup.go
index 15b3b5234d..8fe35e9964 100644
--- a/shared/api/container_backup.go
+++ b/shared/api/container_backup.go
@@ -6,7 +6,7 @@ import "time"
// API extension: container_backup
type ContainerBackupsPost struct {
Name string `json:"name" yaml:"name"`
- ExpiryDate time.Time `json:"expiry" yaml:"expiry"`
+ ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`
ContainerOnly bool `json:"container_only" yaml:"container_only"`
OptimizedStorage bool `json:"optimized_storage" yaml:"optimized_storage"`
}
@@ -15,8 +15,8 @@ type ContainerBackupsPost struct {
// API extension: container_backup
type ContainerBackup struct {
Name string `json:"name" yaml:"name"`
- CreationDate time.Time `json:"creation_date" yaml:"creation_date"`
- ExpiryDate time.Time `json:"expiry_date" yaml:"expiry_date"`
+ CreatedAt time.Time `json:"created_at" yaml:"created_at"`
+ ExpiresAt time.Time `json:"expires_at" yaml:"expires_at"`
ContainerOnly bool `json:"container_only" yaml:"container_only"`
OptimizedStorage bool `json:"optimized_storage" yaml:"optimized_storage"`
}
From ed661678f4e5942f0f4c4800c84429d1b3955ad3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 14 Aug 2019 10:27:42 -0400
Subject: [PATCH 2/3] lxc: Update for fixed backup fields
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/export.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxc/export.go b/lxc/export.go
index e4e3025818..6266bbe0b5 100644
--- a/lxc/export.go
+++ b/lxc/export.go
@@ -65,7 +65,7 @@ func (c *cmdExport) Run(cmd *cobra.Command, args []string) error {
req := api.ContainerBackupsPost{
Name: "",
- ExpiryDate: time.Now().Add(24 * time.Hour),
+ ExpiresAt: time.Now().Add(24 * time.Hour),
ContainerOnly: c.flagContainerOnly,
OptimizedStorage: c.flagOptimizedStorage,
}
From d76012345465e1e3533aac75da84a95855638929 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 14 Aug 2019 10:27:49 -0400
Subject: [PATCH 3/3] lxd: Update for fixed backup fields
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/backup.go | 4 ++--
lxd/container_backup.go | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lxd/backup.go b/lxd/backup.go
index 5bd1b77138..8e5a926a56 100644
--- a/lxd/backup.go
+++ b/lxd/backup.go
@@ -149,8 +149,8 @@ func (b *backup) Delete() error {
func (b *backup) Render() *api.ContainerBackup {
return &api.ContainerBackup{
Name: strings.SplitN(b.name, "/", 2)[1],
- CreationDate: b.creationDate,
- ExpiryDate: b.expiryDate,
+ CreatedAt: b.creationDate,
+ ExpiresAt: b.expiryDate,
ContainerOnly: b.containerOnly,
OptimizedStorage: b.optimizedStorage,
}
diff --git a/lxd/container_backup.go b/lxd/container_backup.go
index 6425becae8..bbf436e126 100644
--- a/lxd/container_backup.go
+++ b/lxd/container_backup.go
@@ -149,7 +149,7 @@ func containerBackupsPost(d *Daemon, r *http.Request) Response {
Name: fullName,
ContainerID: c.Id(),
CreationDate: time.Now(),
- ExpiryDate: req.ExpiryDate,
+ ExpiryDate: req.ExpiresAt,
ContainerOnly: req.ContainerOnly,
OptimizedStorage: req.OptimizedStorage,
}
More information about the lxc-devel
mailing list