The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3681
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) === Closes #3678 Signed-off-by: Stéphane Graber <[email protected]>
From 1b83c2a137e8a30430bdbef09ab1ba54be01d906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]> Date: Fri, 18 Aug 2017 15:55:45 -0400 Subject: [PATCH] network: Allow starting LXD without dnsmasq MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #3678 Signed-off-by: Stéphane Graber <[email protected]> --- lxd/main_daemon.go | 2 +- lxd/main_init.go | 6 ++++++ lxd/networks.go | 7 +++++++ test/main.sh | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lxd/main_daemon.go b/lxd/main_daemon.go index 7195e3551..b8454a80b 100644 --- a/lxd/main_daemon.go +++ b/lxd/main_daemon.go @@ -33,7 +33,7 @@ func cmdDaemon() error { go memProfiler(*argMemProfile) } - neededPrograms := []string{"dnsmasq", "setfacl", "rsync", "tar", "unsquashfs", "xz"} + neededPrograms := []string{"setfacl", "rsync", "tar", "unsquashfs", "xz"} for _, p := range neededPrograms { _, err := exec.LookPath(p) if err != nil { diff --git a/lxd/main_init.go b/lxd/main_init.go index 9c9628b99..c74ef2919 100644 --- a/lxd/main_init.go +++ b/lxd/main_init.go @@ -151,6 +151,11 @@ func (cmd *CmdInit) fillDataInteractive(data *cmdInitData, client lxd.ContainerS imagesAutoUpdate := cmd.askImages() bridge := cmd.askBridge(client) + _, err = exec.LookPath("dnsmasq") + if err != nil && bridge != nil { + return fmt.Errorf("LXD managed bridges require \"dnsmasq\". Install it and try again.") + } + err = cmd.fillDataWithStorage(data, storage, existingPools) if err != nil { return err @@ -884,6 +889,7 @@ func (cmd *CmdInit) askBridge(client lxd.ContainerServer) *cmdInitBridgeParams { if !cmd.Context.AskBool("Would you like to create a new network bridge (yes/no) [default=yes]? ", "yes") { return nil } + bridge := &cmdInitBridgeParams{} for { bridge.Name = cmd.Context.AskString("What should the new bridge be called [default=lxdbr0]? ", "lxdbr0", networkValidName) diff --git a/lxd/networks.go b/lxd/networks.go index a567de196..0330c1a4d 100644 --- a/lxd/networks.go +++ b/lxd/networks.go @@ -8,6 +8,7 @@ import ( "net" "net/http" "os" + "os/exec" "strconv" "strings" @@ -1213,6 +1214,12 @@ func (n *network) Start() error { break } + // Check for dnsmasq + _, err := exec.LookPath("dnsmasq") + if err != nil { + return fmt.Errorf("dnsmasq is required for LXD managed bridges.") + } + // Start dnsmasq (occasionally races, try a few times) output, err := shared.TryRunCommand(dnsmasqCmd[0], dnsmasqCmd[1:]...) if err != nil { diff --git a/test/main.sh b/test/main.sh index 1f38cd70d..6204d78a2 100755 --- a/test/main.sh +++ b/test/main.sh @@ -37,7 +37,7 @@ import_subdir_files() { import_subdir_files includes echo "==> Checking for dependencies" -check_dependencies lxd lxc curl jq git xgettext sqlite3 msgmerge msgfmt shuf setfacl uuidgen +check_dependencies lxd lxc curl dnsmasq jq git xgettext sqlite3 msgmerge msgfmt shuf setfacl uuidgen if [ "${USER:-'root'}" != "root" ]; then echo "The testsuite must be run as root." >&2
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
