[lxc-devel] [lxd/master] Storage misc changes

tomponline on Github lxc-bot at linuxcontainers.org
Fri Dec 20 17:20:44 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 534 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20191220/92432bea/attachment-0001.bin>
-------------- next part --------------
From 179360f3497feb4cf43fad844413ca2c7fa2d91a Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Wed, 18 Dec 2019 16:32:26 +0000
Subject: [PATCH 1/4] lxd/storage/utils: Clarifies comment on ImageUnpack

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/storage/utils.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/storage/utils.go b/lxd/storage/utils.go
index 22f24f7bae..ee89f7213d 100644
--- a/lxd/storage/utils.go
+++ b/lxd/storage/utils.go
@@ -575,7 +575,7 @@ func validateVolumeCommonRules(vol drivers.Volume) map[string]func(string) error
 // Container Format B: Combined tarball containing metadata files and root squashfs.
 //	- Unpack combined tarball into mountPath.
 // VM Format A: Separate metadata tarball and root qcow2 file.
-// 	- Unpack metadata tarball into mountPath (if file exists, convert to raw, if not just copy).
+// 	- Unpack metadata tarball into mountPath.
 //	- Check rootBlockPath is a file and convert qcow2 file into raw format in rootBlockPath.
 func ImageUnpack(imageFile, destPath, destBlockFile string, blockBackend, runningInUserns bool, tracker *ioprogress.ProgressTracker) error {
 	// For all formats, first unpack the metadata (or combined) tarball into destPath.

From cd87b26bf0c34c0734bcacf4408b005d9e687e94 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Fri, 20 Dec 2019 15:07:49 +0000
Subject: [PATCH 2/4] lxd/storage/backend/lxd: Typo in error

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/storage/backend_lxd.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/storage/backend_lxd.go b/lxd/storage/backend_lxd.go
index 3bc2029119..340168cfb6 100644
--- a/lxd/storage/backend_lxd.go
+++ b/lxd/storage/backend_lxd.go
@@ -2079,7 +2079,7 @@ func (b *lxdBackend) CreateCustomVolumeFromCopy(volName, desc string, config map
 	offerHeader := migration.TypesToHeader(offeredTypes...)
 	migrationType, err := migration.MatchTypes(offerHeader, migration.MigrationFSType_RSYNC, b.MigrationTypes(drivers.ContentTypeFS, false))
 	if err != nil {
-		return fmt.Errorf("Failed to neogotiate copy migration type: %v", err)
+		return fmt.Errorf("Failed to negotiate copy migration type: %v", err)
 	}
 
 	// Run sender and receiver in separate go routines to prevent deadlocks.

From fcdededa30cd2bd804089ac56bebe6244c3e401b Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Fri, 20 Dec 2019 16:25:02 +0000
Subject: [PATCH 3/4] lxd/storage/memorypipe: Increases channel buffer size to
 allow Close() cleanup

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/storage/memorypipe/memory_pipe.go | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lxd/storage/memorypipe/memory_pipe.go b/lxd/storage/memorypipe/memory_pipe.go
index 2484c30c3b..79a1b03c6e 100644
--- a/lxd/storage/memorypipe/memory_pipe.go
+++ b/lxd/storage/memorypipe/memory_pipe.go
@@ -4,6 +4,8 @@ import (
 	"io"
 )
 
+const bufferSize = 10
+
 // msg represents an internal structure sent between the pipes.
 type msg struct {
 	data []byte
@@ -59,11 +61,11 @@ func (p *pipe) Close() error {
 // indicate to the other end that the session has ended.
 func NewPipePair() (io.ReadWriteCloser, io.ReadWriteCloser) {
 	aEnd := &pipe{
-		ch: make(chan msg, 1),
+		ch: make(chan msg, bufferSize),
 	}
 
 	bEnd := &pipe{
-		ch: make(chan msg, 1),
+		ch: make(chan msg, bufferSize),
 	}
 
 	aEnd.otherEnd = bEnd

From f566e640148f12b8fafaf77270d91c2ad392cb89 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Fri, 20 Dec 2019 16:27:26 +0000
Subject: [PATCH 4/4] lxd/storage/backend/lxd: Close migration send end when
 error occurs

Prevents recv from hanging.

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/storage/backend_lxd.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lxd/storage/backend_lxd.go b/lxd/storage/backend_lxd.go
index 340168cfb6..c15b08edf5 100644
--- a/lxd/storage/backend_lxd.go
+++ b/lxd/storage/backend_lxd.go
@@ -2114,6 +2114,7 @@ func (b *lxdBackend) CreateCustomVolumeFromCopy(volName, desc string, config map
 	errs := []error{}
 	aEndErr := <-aEndErrCh
 	if aEndErr != nil {
+		aEnd.Close()
 		errs = append(errs, aEndErr)
 	}
 


More information about the lxc-devel mailing list