From aae5d0dc33334dfc04124a0744f07782063bd8e0 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Tue, 4 Feb 2020 16:45:54 +0800 Subject: [PATCH 1/2] hostman: fix detection of ovn controller version --- pkg/hostman/hostinfo/hostovn.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/hostman/hostinfo/hostovn.go b/pkg/hostman/hostinfo/hostovn.go index a3e2d5c843..34678f4664 100644 --- a/pkg/hostman/hostinfo/hostovn.go +++ b/pkg/hostman/hostinfo/hostovn.go @@ -107,7 +107,7 @@ func (oh *OvnHelper) mustPrepService() { } func MustGetOvnVersion() string { - output, err := procutils.NewCommand("ovn-controller", "--version").Output() + output, err := procutils.NewRemoteCommandAsFarAsPossible("ovn-controller", "--version").Output() if err != nil { return "" } From cd34e0db95521d356003d7d0801d2a4d72760cfb Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Tue, 4 Feb 2020 16:50:11 +0800 Subject: [PATCH 2/2] hostman: skip setting up ovn chassis when env support is not ready --- pkg/hostman/hostinfo/hostinfo.go | 7 +++++-- pkg/hostman/hostinfo/hostovn.go | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pkg/hostman/hostinfo/hostinfo.go b/pkg/hostman/hostinfo/hostinfo.go index 4b5d5b4e36..f45e35b881 100644 --- a/pkg/hostman/hostinfo/hostinfo.go +++ b/pkg/hostman/hostinfo/hostinfo.go @@ -141,8 +141,11 @@ func (h *SHostInfo) Init() error { if err := h.parseConfig(); err != nil { return err } - if err := h.setupOvnChassis(); err != nil { - return err + if HasOvnSupport() { + if err := h.setupOvnChassis(); err != nil { + return err + } + return nil } log.Infof("Start detectHostInfo") if err := h.detectHostInfo(); err != nil { diff --git a/pkg/hostman/hostinfo/hostovn.go b/pkg/hostman/hostinfo/hostovn.go index 34678f4664..502e758bf2 100644 --- a/pkg/hostman/hostinfo/hostovn.go +++ b/pkg/hostman/hostinfo/hostovn.go @@ -114,6 +114,14 @@ func MustGetOvnVersion() string { return ovnExtractVersion(string(output)) } +func HasOvnSupport() bool { + ver := MustGetOvnVersion() + if ver != "" { + return true + } + return false +} + func ovnExtractVersion(in string) string { r := make([]rune, 0, 8) var (