[lxc-devel] [lxc/master] disable ipv6 upon creating a bridge in lxc-net.in and enable it on user specifications

2020-12-05 Thread AndrewElvisDeng on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3591

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 the proposed solution; please let me know if there's an issue with this solution.
From f22affcce77bb35f1f961cb154f5141370cd1815 Mon Sep 17 00:00:00 2001
From: Andrew Deng 
Date: Sat, 5 Dec 2020 17:32:56 -0600
Subject: [PATCH] disable ipv6 upon creating a bridge in lxc-net.in and enable
 it on user specifications

Signed-off-by: Andrew Deng 
---
 config/init/common/lxc-net.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/config/init/common/lxc-net.in b/config/init/common/lxc-net.in
index a7dfa6f199..923b1ccd10 100644
--- a/config/init/common/lxc-net.in
+++ b/config/init/common/lxc-net.in
@@ -78,6 +78,7 @@ start() {
 [ ! -d /sys/class/net/${LXC_BRIDGE} ] && ip link add dev ${LXC_BRIDGE} 
type bridge
 echo 1 > /proc/sys/net/ipv4/ip_forward
 echo 0 > /proc/sys/net/ipv6/conf/${LXC_BRIDGE}/accept_dad || true
+echo 1 > /proc/sys/net/ipv6/conf/${LXC_BRIDGE}/disable_ipv6
 
 # if we are run from systemd on a system with selinux enabled,
 # the mkdir will create /run/lxc as init_var_run_t which dnsmasq
@@ -93,6 +94,7 @@ start() {
 
 LXC_IPV6_ARG=""
 if [ -n "$LXC_IPV6_ADDR" ] && [ -n "$LXC_IPV6_MASK" ] && [ -n 
"$LXC_IPV6_NETWORK" ]; then
+echo 0 > /proc/sys/net/ipv6/conf/${LXC_BRIDGE}/disable_ipv6
 echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
 echo 0 > /proc/sys/net/ipv6/conf/${LXC_BRIDGE}/autoconf
 ip -6 addr add dev ${LXC_BRIDGE} ${LXC_IPV6_ADDR}/${LXC_IPV6_MASK}
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxc/master] implemented requested changes

2020-11-20 Thread AndrewElvisDeng on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3585

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: Andrew Deng 
Fixes #1507 
From 27408d595c926591db9eb906d41ba43997f61c38 Mon Sep 17 00:00:00 2001
From: Andrew Deng 
Date: Fri, 20 Nov 2020 19:57:09 -0600
Subject: [PATCH] implemented requested changes

Signed-off-by: Andrew Deng 
---
 templates/lxc-download.in | 4 
 1 file changed, 4 insertions(+)

diff --git a/templates/lxc-download.in b/templates/lxc-download.in
index 278487d22c..39fafc2358 100644
--- a/templates/lxc-download.in
+++ b/templates/lxc-download.in
@@ -130,6 +130,10 @@ gpg_setup() {
 
   mkdir -p "${DOWNLOAD_TEMP}/gpg"
   chmod 700 "${DOWNLOAD_TEMP}/gpg"
+
+  if [ -z "${STANDARD_RESOLVER:-}" ]; then
+echo "standard-resolver" > "${DOWNLOAD_TEMP}/gpg/dirmngr.conf"
+  fi
   export GNUPGHOME="${DOWNLOAD_TEMP}/gpg"
 
   success=
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxc/master] Issue 1507

2020-11-20 Thread AndrewElvisDeng on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3584

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) ===
We have implemented the requested changes in #1507. 
From f7c2c9e4e3cbcdcda8728f296507c0d1d0b3471d Mon Sep 17 00:00:00 2001
From: Andrew Deng 
Date: Thu, 19 Nov 2020 21:32:22 -0600
Subject: [PATCH 1/2] test commit

Signed-off-by: Andrew Deng 
---
 src/lxc/af_unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/af_unix.c b/src/lxc/af_unix.c
index bd29b09da0..1759e81de4 100644
--- a/src/lxc/af_unix.c
+++ b/src/lxc/af_unix.c
@@ -4,7 +4,7 @@
 #define _GNU_SOURCE 1
 #endif
 #include 
-#include 
+#include  
 #include 
 #include 
 #include 

From 435b06260fd1facf49245d1e5c9f98d9164fdebc Mon Sep 17 00:00:00 2001
From: Andrew Deng 
Date: Fri, 20 Nov 2020 19:35:22 -0600
Subject: [PATCH 2/2] implemented changes requested for 1507

Signed-off-by: Andrew Deng 
---
 templates/lxc-download.in | 4 
 1 file changed, 4 insertions(+)

diff --git a/templates/lxc-download.in b/templates/lxc-download.in
index 278487d22c..39fafc2358 100644
--- a/templates/lxc-download.in
+++ b/templates/lxc-download.in
@@ -130,6 +130,10 @@ gpg_setup() {
 
   mkdir -p "${DOWNLOAD_TEMP}/gpg"
   chmod 700 "${DOWNLOAD_TEMP}/gpg"
+
+  if [ -z "${STANDARD_RESOLVER:-}" ]; then
+echo "standard-resolver" > "${DOWNLOAD_TEMP}/gpg/dirmngr.conf"
+  fi
   export GNUPGHOME="${DOWNLOAD_TEMP}/gpg"
 
   success=
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxd/master] fixed typo, created patch

2020-10-11 Thread AndrewElvisDeng on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/8022

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) ===
**lxd/db/storage_pools.go:**
renamed 'lvm.thinpool' to 'lvm.thinpool_name'

**lxd/patches.go**
created a patch to rename existing, incorrectly set configs from the typo

Signed-off-by: Andrew Deng 
From b2df1fc1618355a26659724041613a4f19f43260 Mon Sep 17 00:00:00 2001
From: Andrew Deng 
Date: Sun, 11 Oct 2020 14:51:29 -0500
Subject: [PATCH] fixed typo, created patch

Signed-off-by: Andrew Deng 
---
 lxd/db/storage_pools.go |  2 +-
 lxd/patches.go  | 65 +++--
 2 files changed, 64 insertions(+), 3 deletions(-)

diff --git a/lxd/db/storage_pools.go b/lxd/db/storage_pools.go
index e27a3d1e12..76d12693d1 100644
--- a/lxd/db/storage_pools.go
+++ b/lxd/db/storage_pools.go
@@ -885,7 +885,7 @@ var StoragePoolNodeConfigKeys = []string{
"source",
"volatile.initial_source",
"zfs.pool_name",
-   "lvm.thinpool",
+   "lvm.thinpool_name",
"lvm.vg_name",
 }
 
diff --git a/lxd/patches.go b/lxd/patches.go
index 170976700f..9ae66d6af1 100644
--- a/lxd/patches.go
+++ b/lxd/patches.go
@@ -101,6 +101,7 @@ var patches = []patch{
{name: "clustering_drop_database_role", stage: patchPostDaemonStorage, 
run: patchClusteringDropDatabaseRole},
{name: "network_clear_bridge_volatile_hwaddr", stage: 
patchPostDaemonStorage, run: patchNetworkCearBridgeVolatileHwaddr},
{name: "move_backups_instances", stage: patchPostDaemonStorage, run: 
patchMoveBackupsInstances},
+   {name: "thinpool_typo_fix", stage: patchPostDaemonStorage, run: 
patchThinpoolTypoFix},
 }
 
 type patch struct {
@@ -163,8 +164,6 @@ func patchesApply(d *Daemon, stage patchStage) error {
return nil
 }
 
-// Patches begin here
-
 // Moves backups from shared.VarPath("backups") to shared.VarPath("backups", 
"instances").
 func patchMoveBackupsInstances(name string, d *Daemon) error {
if !shared.PathExists(shared.VarPath("backups")) {
@@ -3714,3 +3713,65 @@ func patchUpdateFromV30(_ *sql.Tx) error {
 
return nil
 }
+
+//  renames any config incorrectly set config file entries due to the 
lvm.thinpool_name typo
+func patchThinpoolTypoFix(name string, d *Daemon) error {
+   tx, err := d.cluster.Begin()
+   if err != nil {
+   return errors.Wrap(err, "failed to begin transaction")
+   }
+
+   // Fetch the IDs of all existing nodes.
+   nodeIDs, err := query.SelectIntegers(tx, "SELECT id FROM nodes")
+   if err != nil {
+   return errors.Wrap(err, "failed to get IDs of current nodes")
+   }
+
+   // Fetch the IDs of all existing lvm pools.
+   poolIDs, err := query.SelectIntegers(tx, "SELECT id FROM storage_pools 
WHERE driver='lvm'")
+   if err != nil {
+   return errors.Wrap(err, "failed to get IDs of current lvm 
pools")
+   }
+
+   for _, poolID := range poolIDs {
+   // Fetch the config for this lvm pool and check if it has the
+   // lvn.thinpool_name key.
+   config, err := query.SelectConfig(
+   tx, "storage_pools_config", "storage_pool_id=?", poolID)
+   if err != nil {
+   return errors.Wrap(err, "failed a fetch of lvm pool 
config")
+   }
+
+   value, ok := "lvm.thinpool"
+   if !ok {
+   continue
+   }
+
+   // Delete the current key
+   _, err = tx.Exec(`
+   DELETE FROM storage_pools_config WHERE 
key='lvm.thinpool' AND storage_pool_id=?`, poolID)
+   if err != nil {
+   return errors.Wrapf(err, "failed to delete %s config", 
key)
+   }
+   
+   // Add the config entry for each node
+   for _, nodeID := range nodeIDs {
+   _, err := tx.Exec(`
+   INSERT INTO storage_pools_config(storage_pool_id, 
node_id, key, value)
+   VALUES(?, ?, 'lvm.thinpool_name', ?)
+   `, poolID, curNodeID, value)
+   if err != nil {
+   return errors.Wrapf(err, "failed to create %s 
node config", key)
+   }
+   }
+   }
+   }
+   
+   err = tx.Commit()
+   if err != nil {
+   return errors.Wrap(err, "failed to commit transaction")
+   }
+   
+   return err
+
+}
\ No newline at end of file
___
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel


[lxc-devel] [lxd/master] Fix thinpool typo

2020-10-11 Thread AndrewElvisDeng on Github
The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/8021

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) ===
**lxd/db/storage_pools.go:**
renamed 'lvm.thinpool' to 'lvm.thinpool_name'

**lxd/patches.go**
created a patch to rename existing, incorrectly set configs from the typo
From 47d218473ca0ecf9fd8af16bad056c5549a018f6 Mon Sep 17 00:00:00 2001
From: Andrew Deng 
Date: Fri, 2 Oct 2020 15:46:30 -0500
Subject: [PATCH 1/3] fixed typo in storage_pools.go

---
 lxd/db/storage_pools.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/db/storage_pools.go b/lxd/db/storage_pools.go
index e27a3d1e12..76d12693d1 100644
--- a/lxd/db/storage_pools.go
+++ b/lxd/db/storage_pools.go
@@ -885,7 +885,7 @@ var StoragePoolNodeConfigKeys = []string{
"source",
"volatile.initial_source",
"zfs.pool_name",
-   "lvm.thinpool",
+   "lvm.thinpool_name",
"lvm.vg_name",
 }
 

From 24f0a70f543ae88bce0eb4f3e021081f400dc90d Mon Sep 17 00:00:00 2001
From: Andrew Deng 
Date: Fri, 2 Oct 2020 17:30:49 -0500
Subject: [PATCH 2/3] initial patch fix implementation done

---
 lxd/patches.go | 63 ++
 1 file changed, 63 insertions(+)

diff --git a/lxd/patches.go b/lxd/patches.go
index 170976700f..54967ecffd 100644
--- a/lxd/patches.go
+++ b/lxd/patches.go
@@ -101,6 +101,7 @@ var patches = []patch{
{name: "clustering_drop_database_role", stage: patchPostDaemonStorage, 
run: patchClusteringDropDatabaseRole},
{name: "network_clear_bridge_volatile_hwaddr", stage: 
patchPostDaemonStorage, run: patchNetworkCearBridgeVolatileHwaddr},
{name: "move_backups_instances", stage: patchPostDaemonStorage, run: 
patchMoveBackupsInstances},
+   {name: "TEMPNAME", stage: TEMP, run: patchTEMPNAME},
 }
 
 type patch struct {
@@ -165,6 +166,68 @@ func patchesApply(d *Daemon, stage patchStage) error {
 
 // Patches begin here
 
+//
+func patchTEMPNAME(name string, d *Daemon) error {
+   tx, err := d.cluster.Begin()
+   if err != nil {
+   return errors.Wrap(err, "failed to begin transaction")
+   }
+
+   // Fetch the IDs of all existing nodes.
+   nodeIDs, err := query.SelectIntegers(tx, "SELECT id FROM nodes")
+   if err != nil {
+   return errors.Wrap(err, "failed to get IDs of current nodes")
+   }
+
+   // Fetch the IDs of all existing lvm pools.
+   poolIDs, err := query.SelectIntegers(tx, "SELECT id FROM storage_pools 
WHERE driver='lvm'")
+   if err != nil {
+   return errors.Wrap(err, "failed to get IDs of current lvm 
pools")
+   }
+
+   for _, poolID := range poolIDs {
+   // Fetch the config for this lvm pool and check if it has the
+   // lvn.thinpool_name key.
+   config, err := query.SelectConfig(
+   tx, "storage_pools_config", "storage_pool_id=?", poolID)
+   if err != nil {
+   return errors.Wrap(err, "failed a fetch of lvm pool 
config")
+   }
+
+   value, ok := "lvm.thinpool"
+   if !ok {
+   continue
+   }
+
+   // Delete the current key
+   _, err = tx.Exec(`
+   DELETE FROM storage_pools_config WHERE 
key='lvm.thinpool' AND storage_pool_id=?`, poolID)
+   if err != nil {
+   return errors.Wrapf(err, "failed to delete %s config", 
key)
+   }
+   
+   // Add the config entry for each node
+   for _, nodeID := range nodeIDs {
+   _, err := tx.Exec(`
+   INSERT INTO storage_pools_config(storage_pool_id, 
node_id, key, value)
+   VALUES(?, ?, 'lvm.thinpool_name', ?)
+   `, poolID, curNodeID, value)
+   if err != nil {
+   return errors.Wrapf(err, "failed to create %s 
node config", key)
+   }
+   }
+   }
+   }
+   
+   err = tx.Commit()
+   if err != nil {
+   return errors.Wrap(err, "failed to commit transaction")
+   }
+   
+   return err
+
+}
+
 // Moves backups from shared.VarPath("backups") to shared.VarPath("backups", 
"instances").
 func patchMoveBackupsInstances(name string, d *Daemon) error {
if !shared.PathExists(shared.VarPath("backups")) {

From 133825f12eabc5c8fef70049d8504a1c6ba6b908 Mon Sep 17 00:00:00 2001
From: Andrew Deng 
Date: Sun, 11 Oct 2020 14:10:11 -0500
Subject: [PATCH 3/3] renamed functions, comments, adhered to patches.go's
 style

---
 lxd/patches.go | 128 -
 1 file changed,