The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/2861
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) ===
From 9b3a84583979587386e3df589b8eb7b4ee405ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Wed, 8 Feb 2017 19:02:18 -0500 Subject: [PATCH 1/5] network: Skip ip6tables clear on non-ipv6 hosts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #2842 Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/networks_iptables.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lxd/networks_iptables.go b/lxd/networks_iptables.go index 1b1ff7d..fb2585e 100644 --- a/lxd/networks_iptables.go +++ b/lxd/networks_iptables.go @@ -41,6 +41,11 @@ func networkIptablesPrepend(protocol string, netName string, table string, chain } func networkIptablesClear(protocol string, netName string, table string) error { + // Detect kernels that lack IPv6 support + if !shared.PathExists("/proc/sys/net/ipv6") && protocol == "ipv6" { + return nil + } + cmd := "iptables" if protocol == "ipv6" { cmd = "ip6tables" From 91a607365786383f9d3e9dde38066e05f31518c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Wed, 8 Feb 2017 19:37:45 -0500 Subject: [PATCH 2/5] Disable IPv6 on host side veth when bridged MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #2845 Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/container_lxc.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go index dbfbb52..717d5d6 100644 --- a/lxd/container_lxc.go +++ b/lxd/container_lxc.go @@ -5323,6 +5323,11 @@ func (c *containerLXC) createNetworkDevice(name string, m types.Device) (string, deviceRemoveInterface(n2) return "", fmt.Errorf("Failed to add interface to bridge: %s", err) } + + // Attempt to disable IPv6 on the host side interface + if shared.PathExists(fmt.Sprintf("/proc/sys/net/ipv6/conf/%s/disable_ipv6", n1)) { + ioutil.WriteFile(fmt.Sprintf("/proc/sys/net/ipv6/conf/%s/disable_ipv6", n1), []byte("1"), 0644) + } } dev = n2 From 074990d14cf2fa7319cf79a681787f30bbe666d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Wed, 8 Feb 2017 19:50:04 -0500 Subject: [PATCH 3/5] tests: Switch to use gofmt instead of "go fmt" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- test/suites/static_analysis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/suites/static_analysis.sh b/test/suites/static_analysis.sh index 4d2608c..878bce7 100644 --- a/test/suites/static_analysis.sh +++ b/test/suites/static_analysis.sh @@ -62,7 +62,7 @@ test_static_analysis() { # go fmt git add -u :/ - go fmt ./... + gofmt -w -s ./ git diff --exit-code # make sure the .pot is updated From e7b0a3e1ce6680b6ff3b613477c390110d9f4474 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Wed, 8 Feb 2017 19:51:41 -0500 Subject: [PATCH 4/5] db: Rely on CASCADE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #2844 Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/db_certificates.go | 11 +++++------ lxd/db_containers.go | 16 ++-------------- lxd/db_images.go | 8 +------- lxd/db_networks.go | 16 ++-------------- lxd/db_profiles.go | 20 ++------------------ 5 files changed, 12 insertions(+), 59 deletions(-) diff --git a/lxd/db_certificates.go b/lxd/db_certificates.go index 09baed4..1f0c0b2 100644 --- a/lxd/db_certificates.go +++ b/lxd/db_certificates.go @@ -110,13 +110,12 @@ func dbCertSave(db *sql.DB, cert *dbCertInfo) error { // dbCertDelete deletes a certificate from the db. func dbCertDelete(db *sql.DB, fingerprint string) error { - _, err := dbExec( - db, - "DELETE FROM certificates WHERE fingerprint=?", - fingerprint, - ) + _, err := dbExec(db, "DELETE FROM certificates WHERE fingerprint=?", fingerprint) + if err != nil { + return err + } - return err + return nil } func dbCertUpdate(db *sql.DB, fingerprint string, certName string, certType int) error { diff --git a/lxd/db_containers.go b/lxd/db_containers.go index 74aacbf..d090178 100644 --- a/lxd/db_containers.go +++ b/lxd/db_containers.go @@ -24,24 +24,12 @@ func dbContainerRemove(db *sql.DB, name string) error { return err } - tx, err := dbBegin(db) + _, err = dbExec(db, "DELETE FROM containers WHERE id=?", id) if err != nil { return err } - err = dbContainerConfigClear(tx, id) - if err != nil { - tx.Rollback() - return err - } - - _, err = tx.Exec("DELETE FROM containers WHERE id=?", id) - if err != nil { - tx.Rollback() - return err - } - - return txCommit(tx) + return nil } func dbContainerName(db *sql.DB, id int) (string, error) { diff --git a/lxd/db_images.go b/lxd/db_images.go index 4672be0..081f1a3 100644 --- a/lxd/db_images.go +++ b/lxd/db_images.go @@ -243,17 +243,11 @@ func dbImageGet(db *sql.DB, fingerprint string, public bool, strictMatching bool } func dbImageDelete(db *sql.DB, id int) error { - tx, err := dbBegin(db) + _, err := dbExec(db, "DELETE FROM images WHERE id=?", id) if err != nil { return err } - _, _ = tx.Exec("DELETE FROM images WHERE id=?", id) - - if err := txCommit(tx); err != nil { - return err - } - return nil } diff --git a/lxd/db_networks.go b/lxd/db_networks.go index 6ddaa6d..3040617 100644 --- a/lxd/db_networks.go +++ b/lxd/db_networks.go @@ -232,24 +232,12 @@ func dbNetworkDelete(db *sql.DB, name string) error { return err } - tx, err := dbBegin(db) - if err != nil { - return err - } - - _, err = tx.Exec("DELETE FROM networks WHERE id=?", id) - if err != nil { - tx.Rollback() - return err - } - - err = dbNetworkConfigClear(tx, id) + _, err = dbExec(db, "DELETE FROM networks WHERE id=?", id) if err != nil { - tx.Rollback() return err } - return txCommit(tx) + return nil } func dbNetworkRename(db *sql.DB, oldName string, newName string) error { diff --git a/lxd/db_profiles.go b/lxd/db_profiles.go index b05bdf0..cfddf87 100644 --- a/lxd/db_profiles.go +++ b/lxd/db_profiles.go @@ -189,28 +189,12 @@ func dbProfileDelete(db *sql.DB, name string) error { return err } - tx, err := dbBegin(db) - if err != nil { - return err - } - - _, err = tx.Exec("DELETE FROM profiles WHERE id=?", id) + _, err = dbExec(db, "DELETE FROM profiles WHERE id=?", id) if err != nil { - tx.Rollback() return err } - err = dbProfileConfigClear(tx, id) - if err != nil { - return err - } - - _, err = tx.Exec("DELETE FROM containers_profiles WHERE profile_id=?", id) - if err != nil { - return err - } - - return txCommit(tx) + return nil } func dbProfileUpdate(db *sql.DB, name string, newName string) error { From 3554e493098c6f8487481b70640f424d12a40034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Wed, 8 Feb 2017 20:17:21 -0500 Subject: [PATCH 5/5] tests: Avoid a zfs race MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- test/backends/zfs.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/backends/zfs.sh b/test/backends/zfs.sh index 41013fe..b22c717 100644 --- a/test/backends/zfs.sh +++ b/test/backends/zfs.sh @@ -16,6 +16,10 @@ zfs_setup() { # prefix lxdtest- here, as zfs pools must start with a letter, but tempdir # won't necessarily generate one that does. zpool create "lxdtest-$(basename "${LXD_DIR}")" "${LXD_DIR}/zfspool" -m none + + # Avoid a zfs bug in "-p" handling during concurent create + zfs create -o mountpoint=none "lxdtest-$(basename "${LXD_DIR}")/containers" + zfs create -o mountpoint=none "lxdtest-$(basename "${LXD_DIR}")/images" } zfs_configure() {
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel