[lxc-devel] [lxd/master] Fix build
tych0 on Github
lxc-bot at linuxcontainers.org
Wed Jun 1 18:17:36 UTC 2016
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/20160601/dfb610f9/attachment.bin>
-------------- next part --------------
From 7a86bdc9cb1cb184ce4587cbc2709de0ef82d3ae Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Wed, 1 Jun 2016 12:09:04 -0600
Subject: [PATCH 1/2] PreservesInodes needs to be implemented for storageMock
too
Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
lxd/storage_test.go | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lxd/storage_test.go b/lxd/storage_test.go
index eec78cc..7f0929b 100644
--- a/lxd/storage_test.go
+++ b/lxd/storage_test.go
@@ -131,6 +131,10 @@ func (s *storageMock) MigrationType() MigrationFSType {
return MigrationFSType_RSYNC
}
+func (s *storageMock) PreservesInodes() bool {
+ return false
+}
+
func (s *storageMock) MigrationSource(container container) (MigrationStorageSourceDriver, error) {
return nil, fmt.Errorf("not implemented")
}
From b27b5e0adffa3b22d237c77b19d67190788c9775 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Wed, 1 Jun 2016 12:16:59 -0600
Subject: [PATCH 2/2] don't try to update /var/lib/lxd/containers in go tests
Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
lxd/db_update.go | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lxd/db_update.go b/lxd/db_update.go
index 0726fcf..c7e9159 100644
--- a/lxd/db_update.go
+++ b/lxd/db_update.go
@@ -17,7 +17,13 @@ import (
log "gopkg.in/inconshreveable/log15.v2"
)
-func dbUpdateFromV30(db *sql.DB) error {
+func dbUpdateFromV30(db *sql.DB, mockMode bool) error {
+ if mockMode {
+ stmt := `INSERT INTO schema (version, updated_at) VALUES (?, strftime("%s"));`
+ _, err := db.Exec(stmt, 31)
+ return err
+ }
+
entries, err := ioutil.ReadDir(shared.VarPath("containers"))
if err != nil {
return err
@@ -1055,7 +1061,7 @@ func dbUpdate(d *Daemon, prevVersion int) error {
}
}
if prevVersion < 31 {
- err = dbUpdateFromV30(db)
+ err = dbUpdateFromV30(db, d.MockMode)
if err != nil {
return err
}
More information about the lxc-devel
mailing list