[lxc-devel] [lxc/lxc] 9b6819: log: fix too wide or inconsistent non-owner permis...

2018-11-02 Thread GitHub
  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 9b681921e597541226eb9ecccb4a7d9e3f410879
  https://github.com/lxc/lxc/commit/9b681921e597541226eb9ecccb4a7d9e3f410879
  Author: 2xsec 
  Date:   2018-11-02 (Fri, 02 Nov 2018)

  Changed paths:
M src/lxc/log.c

  Log Message:
  ---
  log: fix too wide or inconsistent non-owner permissions

Signed-off-by: 2xsec 


  Commit: 3bcfbee1522c1824d19d911856486d590196931b
  https://github.com/lxc/lxc/commit/3bcfbee1522c1824d19d911856486d590196931b
  Author: Christian Brauner 
  Date:   2018-11-02 (Fri, 02 Nov 2018)

  Changed paths:
M src/lxc/log.c

  Log Message:
  ---
  Merge pull request #2716 from 2xsec/tizen

log: fix too wide or inconsistent non-owner permissions


Compare: https://github.com/lxc/lxc/compare/a8c7d037e32a...3bcfbee1522c
  **NOTE:** This service has been marked for deprecation: 
https://developer.github.com/changes/2018-04-25-github-services-deprecation/

  Functionality will be removed from GitHub.com on January 31st, 2019.
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxc/lxc] 5f76b9: lxcmntent: coding rules

2018-11-02 Thread GitHub
  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: 5f76b90f47ea88b3ec3e44fb945519bfbe2ba31e
  https://github.com/lxc/lxc/commit/5f76b90f47ea88b3ec3e44fb945519bfbe2ba31e
  Author: 2xsec 
  Date:   2018-11-02 (Fri, 02 Nov 2018)

  Changed paths:
M src/include/lxcmntent.c

  Log Message:
  ---
  lxcmntent: coding rules

Signed-off-by: 2xsec 


  Commit: b9bb8bbbf35a388fda0f996c1116cfa5566e
  https://github.com/lxc/lxc/commit/b9bb8bbbf35a388fda0f996c1116cfa5566e
  Author: 2xsec 
  Date:   2018-11-02 (Fri, 02 Nov 2018)

  Changed paths:
M src/lxc/string_utils.c

  Log Message:
  ---
  string_utils: coding rules

Signed-off-by: 2xsec 


  Commit: 1409ee16ff60fa227268b8b59f704539d18ec162
  https://github.com/lxc/lxc/commit/1409ee16ff60fa227268b8b59f704539d18ec162
  Author: Christian Brauner 
  Date:   2018-11-02 (Fri, 02 Nov 2018)

  Changed paths:
M src/include/lxcmntent.c
M src/lxc/string_utils.c

  Log Message:
  ---
  Merge pull request #2715 from 2xsec/bugfix

lxcmntent: coding rules


Compare: https://github.com/lxc/lxc/compare/3bcfbee1522c...1409ee16ff60
  **NOTE:** This service has been marked for deprecation: 
https://developer.github.com/changes/2018-04-25-github-services-deprecation/

  Functionality will be removed from GitHub.com on January 31st, 2019.
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] Still Failing: lxc/lxc#6161 (master - 3bcfbee)

2018-11-02 Thread Travis CI
Build Update for lxc/lxc
-

Build: #6161
Status: Still Failing

Duration: 45 secs
Commit: 3bcfbee (master)
Author: Christian Brauner
Message: Merge pull request #2716 from 2xsec/tizen

log: fix too wide or inconsistent non-owner permissions

View the changeset: 
https://github.com/lxc/lxc/compare/a8c7d037e32a...3bcfbee1522c

View the full build log and details: 
https://travis-ci.org/lxc/lxc/builds/449782326?utm_medium=notification&utm_source=email

--

You can unsubscribe from build emails from the lxc/lxc repository going to 
https://travis-ci.org/account/preferences/unsubscribe?repository=1693277&utm_medium=notification&utm_source=email.
Or unsubscribe from *all* email updating your settings at 
https://travis-ci.org/account/preferences/unsubscribe?utm_medium=notification&utm_source=email.
Or configure specific recipients for build notifications in your .travis.yml 
file. See https://docs.travis-ci.com/user/notifications.

___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] Still Failing: lxc/lxc#6162 (master - 1409ee1)

2018-11-02 Thread Travis CI
Build Update for lxc/lxc
-

Build: #6162
Status: Still Failing

Duration: 44 secs
Commit: 1409ee1 (master)
Author: Christian Brauner
Message: Merge pull request #2715 from 2xsec/bugfix

lxcmntent: coding rules

View the changeset: 
https://github.com/lxc/lxc/compare/3bcfbee1522c...1409ee16ff60

View the full build log and details: 
https://travis-ci.org/lxc/lxc/builds/449782545?utm_medium=notification&utm_source=email

--

You can unsubscribe from build emails from the lxc/lxc repository going to 
https://travis-ci.org/account/preferences/unsubscribe?repository=1693277&utm_medium=notification&utm_source=email.
Or unsubscribe from *all* email updating your settings at 
https://travis-ci.org/account/preferences/unsubscribe?utm_medium=notification&utm_source=email.
Or configure specific recipients for build notifications in your .travis.yml 
file. See https://docs.travis-ci.com/user/notifications.

___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxc/lxc] e81429: coverity: move to separate branch

2018-11-02 Thread GitHub
  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: e814299f2d98d98ae16e03340744ee4d371e67bc
  https://github.com/lxc/lxc/commit/e814299f2d98d98ae16e03340744ee4d371e67bc
  Author: Christian Brauner 
  Date:   2018-11-02 (Fri, 02 Nov 2018)

  Changed paths:
M .travis.yml

  Log Message:
  ---
  coverity: move to separate branch

Signed-off-by: Christian Brauner 



  **NOTE:** This service has been marked for deprecation: 
https://developer.github.com/changes/2018-04-25-github-services-deprecation/

  Functionality will be removed from GitHub.com on January 31st, 2019.
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxd/master] Increase go-dqlite client timeout when not-clustered

2018-11-02 Thread freeekanayaka on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/5236

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
This is a workaround for #5234. Later down the road we'll want to implement a
proper fix in dqlite, as described in the issue.

Signed-off-by: Free Ekanayaka 
From 0b7d1bc213a235c7c53bcd2b81e823511a84eb63 Mon Sep 17 00:00:00 2001
From: Free Ekanayaka 
Date: Fri, 2 Nov 2018 12:20:23 +0100
Subject: [PATCH] Increase go-dqlite client timeout when not-clustered

This is a workaround for #5234. Later down the road we'll want to implement a
proper fix in dqlite, as described in the issue.

Signed-off-by: Free Ekanayaka 
---
 lxd/api_cluster.go | 24 +++-
 lxd/daemon.go  | 20 +++-
 lxd/db/db.go   |  6 ++
 3 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/lxd/api_cluster.go b/lxd/api_cluster.go
index ee50c721f8..68b5be91c9 100644
--- a/lxd/api_cluster.go
+++ b/lxd/api_cluster.go
@@ -8,6 +8,7 @@ import (
"os"
"path/filepath"
"strconv"
+   "time"
 
"github.com/CanonicalLtd/go-dqlite"
"github.com/gorilla/mux"
@@ -184,7 +185,20 @@ func clusterPut(d *Daemon, r *http.Request) Response {
 
 func clusterPutBootstrap(d *Daemon, req api.ClusterPut) Response {
run := func(op *operation) error {
-   return cluster.Bootstrap(d.State(), d.gateway, req.ServerName)
+   // The default timeout when non-clustered is one minute, let's
+   // lower it down now that we'll likely have to make requests
+   // over the network.
+   //
+   // FIXME: this is a workaround for #5234.
+   d.cluster.SetDefaultTimeout(5 * time.Second)
+
+   err := cluster.Bootstrap(d.State(), d.gateway, req.ServerName)
+   if err != nil {
+   d.cluster.SetDefaultTimeout(time.Minute)
+   return err
+   }
+
+   return nil
}
resources := map[string][]string{}
resources["cluster"] = []string{}
@@ -348,8 +362,16 @@ func clusterPutJoin(d *Daemon, req api.ClusterPut) 
Response {
nodes[i].Address = node.Address
}
 
+   // The default timeout when non-clustered is one minute, let's
+   // lower it down now that we'll likely have to make requests
+   // over the network.
+   //
+   // FIXME: this is a workaround for #5234.
+   d.cluster.SetDefaultTimeout(5 * time.Second)
+
err = cluster.Join(d.State(), d.gateway, cert, req.ServerName, 
nodes)
if err != nil {
+   d.cluster.SetDefaultTimeout(time.Minute)
return err
}
 
diff --git a/lxd/daemon.go b/lxd/daemon.go
index 88c9c74db2..baa4ef2e00 100644
--- a/lxd/daemon.go
+++ b/lxd/daemon.go
@@ -529,17 +529,32 @@ func (d *Daemon) init() error {
return err
}
 
+   clustered, err := cluster.Enabled(d.db)
+   if err != nil {
+   return err
+   }
+
/* Open the cluster database */
for {
logger.Info("Initializing global database")
dir := filepath.Join(d.os.VarDir, "database")
store := d.gateway.ServerStore()
+
+   contextTimeout := 5 * time.Second
+   if !clustered {
+   // FIXME: this is a workaround for #5234. We set a very
+   // high timeout when we're not clustered, since there's
+   // actually no networking involved.
+   contextTimeout = time.Minute
+   }
+
d.cluster, err = db.OpenCluster(
"db.bin", store, address, dir,
d.config.DqliteSetupTimeout,
dqlite.WithDialFunc(d.gateway.DialFunc()),
dqlite.WithContext(d.gateway.Context()),
dqlite.WithConnectionTimeout(10*time.Second),
+   dqlite.WithContextTimeout(contextTimeout),
dqlite.WithLogFunc(cluster.DqliteLog),
)
if err == nil {
@@ -597,11 +612,6 @@ func (d *Daemon) init() error {
}
 
// Setup the user-agent
-   clustered, err := cluster.Enabled(d.db)
-   if err != nil {
-   return err
-   }
-
if clustered {
version.UserAgentFeatures([]string{"cluster"})
}
diff --git a/lxd/db/db.go b/lxd/db/db.go
index 02ab33ff11..b5718e8349 100644
--- a/lxd/db/db.go
+++ b/lxd/db/db.go
@@ -279,6 +279,12 @@ func ForLocalInspectionWithPreparedStmts(db *sql.DB) 
(*Cluster, error) {
return c, n

[lxc-devel] [lxc/lxc]

2018-11-02 Thread GitHub
  Branch: refs/heads/coverity
  Home:   https://github.com/lxc/lxc

  **NOTE:** This service has been marked for deprecation: 
https://developer.github.com/changes/2018-04-25-github-services-deprecation/

  Functionality will be removed from GitHub.com on January 31st, 2019.
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] Fixed: lxc/lxc#6163 (master - e814299)

2018-11-02 Thread Travis CI
Build Update for lxc/lxc
-

Build: #6163
Status: Fixed

Duration: 2 mins and 8 secs
Commit: e814299 (master)
Author: Christian Brauner
Message: coverity: move to separate branch

Signed-off-by: Christian Brauner 

View the changeset: 
https://github.com/lxc/lxc/compare/1409ee16ff60...e814299f2d98

View the full build log and details: 
https://travis-ci.org/lxc/lxc/builds/449797622?utm_medium=notification&utm_source=email

--

You can unsubscribe from build emails from the lxc/lxc repository going to 
https://travis-ci.org/account/preferences/unsubscribe?repository=1693277&utm_medium=notification&utm_source=email.
Or unsubscribe from *all* email updating your settings at 
https://travis-ci.org/account/preferences/unsubscribe?utm_medium=notification&utm_source=email.
Or configure specific recipients for build notifications in your .travis.yml 
file. See https://docs.travis-ci.com/user/notifications.

___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] Failed: lxc/lxc#6164 (coverity - e814299)

2018-11-02 Thread Travis CI
Build Update for lxc/lxc
-

Build: #6164
Status: Failed

Duration: 55 secs
Commit: e814299 (coverity)
Author: Christian Brauner
Message: coverity: move to separate branch

Signed-off-by: Christian Brauner 

View the changeset: https://github.com/lxc/lxc/compare/coverity

View the full build log and details: 
https://travis-ci.org/lxc/lxc/builds/449798556?utm_medium=notification&utm_source=email

--

You can unsubscribe from build emails from the lxc/lxc repository going to 
https://travis-ci.org/account/preferences/unsubscribe?repository=1693277&utm_medium=notification&utm_source=email.
Or unsubscribe from *all* email updating your settings at 
https://travis-ci.org/account/preferences/unsubscribe?utm_medium=notification&utm_source=email.
Or configure specific recipients for build notifications in your .travis.yml 
file. See https://docs.travis-ci.com/user/notifications.

___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxd/master] Detect and shrink large boltdb files

2018-11-02 Thread freeekanayaka on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/5237

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Free Ekanayaka 
From afc3095159b000d03862c7e064df7cf844f327fb Mon Sep 17 00:00:00 2001
From: Free Ekanayaka 
Date: Fri, 2 Nov 2018 15:11:49 +0100
Subject: [PATCH] Detect and shrink large boltdb files

Signed-off-by: Free Ekanayaka 
---
 lxd/daemon.go  |  33 ---
 lxd/patches.go | 110 +
 2 files changed, 138 insertions(+), 5 deletions(-)

diff --git a/lxd/daemon.go b/lxd/daemon.go
index 750e0585fd..0974ed420b 100644
--- a/lxd/daemon.go
+++ b/lxd/daemon.go
@@ -477,6 +477,34 @@ func (d *Daemon) init() error {
return err
}
 
+   clustered, err := cluster.Enabled(d.db)
+   if err != nil {
+   return err
+   }
+
+   // If not already applied, run the daemon patch that shrinks the boltdb
+   // file. We can't run this daemon patch later on along with the other
+   // ones because it needs to run before we open the cluster database.
+   appliedPatches, err := d.db.Patches()
+   if err != nil {
+   return errors.Wrap(err, "Fetch applied daemon patches")
+   }
+   if !shared.StringInSlice("shrink_logs_db_file", appliedPatches) {
+   if !clustered {
+   // We actually run the patch only if this lxd daemon is
+   // not clustered.
+   err := patchShrinkLogsDBFile("", d)
+   if err != nil {
+   return errors.Wrap(err, "Shrink logs.db file")
+   }
+   }
+
+   err = d.db.PatchesMarkApplied("shrink_logs_db_file")
+   if err != nil {
+   return err
+   }
+   }
+
/* Setup dqlite */
clusterLogLevel := "ERROR"
if shared.StringInSlice("dqlite", trace) {
@@ -529,11 +557,6 @@ func (d *Daemon) init() error {
return err
}
 
-   clustered, err := cluster.Enabled(d.db)
-   if err != nil {
-   return err
-   }
-
/* Open the cluster database */
for {
logger.Info("Initializing global database")
diff --git a/lxd/patches.go b/lxd/patches.go
index 3fa3252844..9c6b4bc72c 100644
--- a/lxd/patches.go
+++ b/lxd/patches.go
@@ -3,11 +3,16 @@ package main
 import (
"fmt"
"io/ioutil"
+   stdlog "log"
"os"
"path/filepath"
"strings"
"syscall"
+   "time"
 
+   "github.com/boltdb/bolt"
+   "github.com/hashicorp/raft"
+   "github.com/hashicorp/raft-boltdb"
"github.com/lxc/lxd/lxd/cluster"
"github.com/lxc/lxd/lxd/db"
"github.com/lxc/lxd/lxd/db/query"
@@ -36,6 +41,7 @@ import (
 */
 
 var patches = []patch{
+   {name: "shrink_logs_db_file", run: patchShrinkLogsDBFile},
{name: "invalid_profile_names", run: patchInvalidProfileNames},
{name: "leftover_profile_config", run: patchLeftoverProfileConfig},
{name: "network_permissions", run: patchNetworkPermissions},
@@ -173,6 +179,110 @@ func patchNetworkPermissions(name string, d *Daemon) 
error {
return nil
 }
 
+// Shrink a database/global/logs.db that grew unwildly due to a bug in the 3.6
+// release.
+func patchShrinkLogsDBFile(name string, d *Daemon) error {
+   dir := filepath.Join(d.os.VarDir, "database", "global")
+   info, err := os.Stat(filepath.Join(dir, "logs.db"))
+   if err != nil && !os.IsNotExist(err) {
+   return errors.Wrap(err, "Get the size of the boltdb database")
+   }
+
+   if info.Size() < 1024*1024*100 {
+   // Only try to shrink databases bigger than 100 Megabytes.
+   return nil
+   }
+
+   snaps, err := raft.NewFileSnapshotStoreWithLogger(
+   dir, 2, stdlog.New(ioutil.Discard, "", 0))
+   if err != nil {
+   return errors.Wrap(err, "Open snapshots")
+   }
+
+   metas, err := snaps.List()
+   if err != nil {
+   return errors.Wrap(err, "Fetch snapshots")
+   }
+
+   if len(metas) == 0 {
+   // No snapshot is available, we can't shrink. This should never
+   // happen, in practice.
+   logger.Warnf("Can't shrink boltdb store, no raft snapshot is 
available")
+   return nil
+   }
+
+   meta := metas[0] // The most recent snapshot.
+
+   // Copy all log entries from the current boltdb file into a new one,
+   // which will be smaller since it excludes all truncated entries that
+   pathCur := filepath.Join(dir, "logs.db")
+   // got allocated before the latest snapshot.
+   logsCur, err := raftboltdb.

[lxc-devel] [lxc/master] include: correctly include macro.h

2018-11-02 Thread brauner on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2717

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Christian Brauner 
From a9b8dbfa95f14d17ad014d3ee4400602933297ee Mon Sep 17 00:00:00 2001
From: Christian Brauner 
Date: Fri, 2 Nov 2018 23:20:46 +0100
Subject: [PATCH] include: correctly include macro.h

Signed-off-by: Christian Brauner 
---
 src/include/lxcmntent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/include/lxcmntent.c b/src/include/lxcmntent.c
index 5ada15ba7..4c1ad763b 100644
--- a/src/include/lxcmntent.c
+++ b/src/include/lxcmntent.c
@@ -22,10 +22,10 @@
 #define _GNU_SOURCE 1
 #endif
 #include 
-#include 
 #include 
 #include 
 #include 
+#include "../lxc/macro.h"
 
 /* Since the values in a line are separated by spaces, a name cannot
  * contain a space. Therefore some programs encode spaces in names
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxc/lxc] a9b8db: include: correctly include macro.h

2018-11-02 Thread GitHub
  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: a9b8dbfa95f14d17ad014d3ee4400602933297ee
  https://github.com/lxc/lxc/commit/a9b8dbfa95f14d17ad014d3ee4400602933297ee
  Author: Christian Brauner 
  Date:   2018-11-02 (Fri, 02 Nov 2018)

  Changed paths:
M src/include/lxcmntent.c

  Log Message:
  ---
  include: correctly include macro.h

Signed-off-by: Christian Brauner 


  Commit: acf50cfedf010bb13390821a52d964b99cd1c0d4
  https://github.com/lxc/lxc/commit/acf50cfedf010bb13390821a52d964b99cd1c0d4
  Author: Stéphane Graber 
  Date:   2018-11-02 (Fri, 02 Nov 2018)

  Changed paths:
M src/include/lxcmntent.c

  Log Message:
  ---
  Merge pull request #2717 from brauner/2018-11-02/fix_android

include: correctly include macro.h


Compare: https://github.com/lxc/lxc/compare/e814299f2d98...acf50cfedf01
  **NOTE:** This service has been marked for deprecation: 
https://developer.github.com/changes/2018-04-25-github-services-deprecation/

  Functionality will be removed from GitHub.com on January 31st, 2019.
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxd/master] lxd/main_forkmount: Use pkg-config

2018-11-02 Thread stgraber on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/5239

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Stéphane Graber 
From 5a6b7592892f3145b90fa0e4a3b5606e150d59b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= 
Date: Fri, 2 Nov 2018 20:02:24 -0400
Subject: [PATCH] lxd/main_forkmount: Use pkg-config
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber 
---
 lxd/main_forkmount.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lxd/main_forkmount.go b/lxd/main_forkmount.go
index 3a610f6026..d324bbdcef 100644
--- a/lxd/main_forkmount.go
+++ b/lxd/main_forkmount.go
@@ -343,6 +343,7 @@ void forkmount() {
 */
 // #cgo CFLAGS: -std=gnu11 -Wvla
 // #cgo LDFLAGS: -llxc
+// #cgo pkg-config: lxc
 import "C"
 
 type cmdForkmount struct {
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel