[lxc-devel] [lxd/master] Don't include container name in backups/snapshots
stgraber on Github
lxc-bot at linuxcontainers.org
Thu Jul 26 18:32:42 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180726/3525c5f4/attachment.bin>
-------------- next part --------------
From 124ff68da0b7b56401aef74b165bf83739c08701 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 26 Jul 2018 14:32:09 -0400
Subject: [PATCH] Don't include container name in backups/snapshots
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 | 3 ++-
lxd/container_lxc.go | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lxd/backup.go b/lxd/backup.go
index 789a39862..4888776bb 100644
--- a/lxd/backup.go
+++ b/lxd/backup.go
@@ -7,6 +7,7 @@ import (
"io"
"os"
"path/filepath"
+ "strings"
"time"
"gopkg.in/yaml.v2"
@@ -110,7 +111,7 @@ func (b *backup) Dump() ([]byte, error) {
func (b *backup) Render() interface{} {
return &api.ContainerBackup{
- Name: b.name,
+ Name: strings.SplitN(b.name, "/", 2)[1],
CreationDate: b.creationDate,
ExpiryDate: b.expiryDate,
ContainerOnly: b.containerOnly,
diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index ad7b4ebc6..8498c874a 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -3014,7 +3014,7 @@ func (c *containerLXC) Render() (interface{}, interface{}, error) {
ExpandedConfig: c.expandedConfig,
ExpandedDevices: c.expandedDevices,
LastUsedDate: c.lastUsedDate,
- Name: c.name,
+ Name: strings.SplitN(c.name, "/", 2)[1],
Profiles: c.profiles,
Stateful: c.stateful,
}, etag, nil
More information about the lxc-devel
mailing list