[lxc-devel] [lxd/master] Typos and dnsmasq version check

stgraber on Github lxc-bot at linuxcontainers.org
Sat Sep 23 17:38:32 UTC 2017


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/20170923/c2e46cea/attachment.bin>
-------------- next part --------------
From 3583275fb69ad08084f77b1c547e15b6af06c290 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 21 Sep 2017 16:43:57 -0400
Subject: [PATCH 1/2] Fix typos
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/storage_ceph.go | 2 +-
 lxd/storage_lvm.go  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lxd/storage_ceph.go b/lxd/storage_ceph.go
index c73a4b4d8..fe58bacd0 100644
--- a/lxd/storage_ceph.go
+++ b/lxd/storage_ceph.go
@@ -695,7 +695,7 @@ func (s *storageCeph) StoragePoolVolumeUpdate(writable *api.StorageVolumePut, ch
 }
 
 func (s *storageCeph) StoragePoolUpdate(writable *api.StoragePoolPut, changedConfig []string) error {
-	return fmt.Errorf("ODS storage pool properties cannot be changed")
+	return fmt.Errorf("OSD storage pool properties cannot be changed")
 }
 
 func (s *storageCeph) ContainerStorageReady(name string) bool {
diff --git a/lxd/storage_lvm.go b/lxd/storage_lvm.go
index ece80e331..5e430a9ce 100644
--- a/lxd/storage_lvm.go
+++ b/lxd/storage_lvm.go
@@ -710,7 +710,7 @@ func (s *storageLvm) StoragePoolUpdate(writable *api.StoragePoolPut, changedConf
 
 	if shared.StringInSlice("lvm.thinpool_name", changedConfig) {
 		if !s.useThinpool {
-			return fmt.Errorf("the LVM storage pool \"%s\" does not use thin pools. The \"lvm.thinpool_name\" porperty cannot be set", s.pool.Name)
+			return fmt.Errorf("the LVM storage pool \"%s\" does not use thin pools. The \"lvm.thinpool_name\" property cannot be set", s.pool.Name)
 		}
 
 		newThinpoolName := writable.Config["lvm.thinpool_name"]

From 691dac3e0311ca3915f3ef92175d52f7b932f8b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 23 Sep 2017 13:37:57 -0400
Subject: [PATCH 2/2] network: Better handle dnsmasq version checks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #3837

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/networks.go       | 8 +++-----
 lxd/networks_utils.go | 9 ++++++---
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/lxd/networks.go b/lxd/networks.go
index 007706cb7..48adfe087 100644
--- a/lxd/networks.go
+++ b/lxd/networks.go
@@ -779,12 +779,10 @@ func (n *network) Start() error {
 
 	if !debug {
 		// --quiet options are only supported on >2.67
-		v, err := networkGetDnsmasqVersion()
-		if err != nil {
-			return err
-		}
 		minVer, _ := version.NewDottedVersion("2.67")
-		if v.Compare(minVer) > 0 {
+
+		v, err := networkGetDnsmasqVersion()
+		if err == nil && v.Compare(minVer) > 0 {
 			dnsmasqCmd = append(dnsmasqCmd, []string{"--quiet-dhcp", "--quiet-dhcp6", "--quiet-ra"}...)
 		}
 	}
diff --git a/lxd/networks_utils.go b/lxd/networks_utils.go
index 5e6594231..4cf455a84 100644
--- a/lxd/networks_utils.go
+++ b/lxd/networks_utils.go
@@ -12,6 +12,7 @@ import (
 	"math/rand"
 	"net"
 	"os"
+	"os/exec"
 	"path/filepath"
 	"regexp"
 	"strconv"
@@ -729,11 +730,13 @@ func networkKillDnsmasq(name string, reload bool) error {
 }
 
 func networkGetDnsmasqVersion() (*version.DottedVersion, error) {
-	output, err := shared.TryRunCommand("dnsmasq", "--version")
+	// Discard stderr on purpose (occasional linker errors)
+	output, err := exec.Command("dnsmasq", "--version").Output()
 	if err != nil {
-		return nil, fmt.Errorf("Failed to check dnsmasq version")
+		return nil, fmt.Errorf("Failed to check dnsmasq version: %v", err)
 	}
-	lines := strings.Split(output, " ")
+
+	lines := strings.Split(string(output), " ")
 	return version.NewDottedVersion(lines[2])
 }
 


More information about the lxc-devel mailing list