[lxc-devel] [lxd/master] [DO NOT MERGE]: jenkins debugging

brauner on Github lxc-bot at linuxcontainers.org
Sat Mar 25 13:22:58 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170325/39cd051c/attachment.bin>
-------------- next part --------------
From f8cf5797f8f8df3427db9af89a33c8b1d74ef88a Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Sat, 25 Mar 2017 14:14:23 +0100
Subject: [PATCH] [DO NOT MERGE]: jenkins debugging

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 Makefile               | 2 +-
 lxd/container_lxc.go   | 3 +++
 lxd/containers_post.go | 4 ++--
 lxd/storage_lvm.go     | 8 ++++----
 4 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 05e5f0b..8d36990 100644
--- a/Makefile
+++ b/Makefile
@@ -42,7 +42,7 @@ protobuf:
 	protoc --go_out=. ./lxd/migrate.proto
 
 .PHONY: check
-check: default
+check: debug
 	go get -v -x github.com/rogpeppe/godeps
 	go get -v -x github.com/remyoudompheng/go-misc/deadcode
 	go get -v -x github.com/golang/lint/golint
diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 79753e6..418390b 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -2951,6 +2951,7 @@ type backupFile struct {
 func writeBackupFile(c container) error {
 	/* we only write backup files out for actual containers */
 	if c.IsSnapshot() {
+		shared.LogDebugf("Container \"%s\" is a snapshot. Not writing a \"backup.yaml\" file.", c.Name())
 		return nil
 	}
 
@@ -2988,12 +2989,14 @@ func writeBackupFile(c container) error {
 
 	poolName, err := c.StoragePool()
 	if err != nil {
+		shared.LogWarnf("Failed to retrieve storage pool name for \"%s\": %s", c.Name(), err)
 		return err
 	}
 
 	db := c.Daemon().db
 	poolID, pool, err := dbStoragePoolGet(c.Daemon().db, poolName)
 	if err != nil {
+		shared.LogWarnf("Failed to retrieve storage pool \"%s\" for \"%s\": %s", poolName, c.Name(), err)
 		return err
 	}
 
diff --git a/lxd/containers_post.go b/lxd/containers_post.go
index afa955f..68be979 100644
--- a/lxd/containers_post.go
+++ b/lxd/containers_post.go
@@ -309,7 +309,7 @@ func createFromMigration(d *Daemon, req *api.ContainersPost) Response {
 
 		ps, err := storagePoolInit(d, storagePool)
 		if err != nil {
-			return InternalError(err)
+			return InternalError(fmt.Errorf("Failed to initialize storage pool: %s.", err))
 		}
 
 		if ps.MigrationType() == MigrationFSType_RSYNC {
@@ -366,7 +366,7 @@ func createFromMigration(d *Daemon, req *api.ContainersPost) Response {
 	sink, err := NewMigrationSink(&migrationArgs)
 	if err != nil {
 		c.Delete()
-		return InternalError(err)
+		return InternalError(fmt.Errorf("Failed to initialize a new migration sink: %s.", err)
 	}
 
 	run := func(op *operation) error {
diff --git a/lxd/storage_lvm.go b/lxd/storage_lvm.go
index afe56b7..72ab836 100644
--- a/lxd/storage_lvm.go
+++ b/lxd/storage_lvm.go
@@ -1606,8 +1606,6 @@ func (s *storageLvm) ContainerSnapshotCreate(snapshotContainer container, source
 }
 
 func (s *storageLvm) createSnapshotContainer(snapshotContainer container, sourceContainer container, readonly bool) error {
-	tryUndo := true
-
 	sourceContainerName := sourceContainer.Name()
 	targetContainerName := snapshotContainer.Name()
 	sourceContainerLvmName := containerNameToLVName(sourceContainerName)
@@ -1619,10 +1617,12 @@ func (s *storageLvm) createSnapshotContainer(snapshotContainer container, source
 	if err != nil {
 		return fmt.Errorf("Error creating snapshot LV: %s", err)
 	}
+	tryUndo := true
 	defer func() {
-		if tryUndo {
-			s.ContainerCreate(snapshotContainer)
+		if !tryUndo {
+			return
 		}
+		s.ContainerDelete(snapshotContainer)
 	}()
 
 	targetContainerMntPoint := ""


More information about the lxc-devel mailing list