From bc41dcce9155f33359d8e4106e6a860873aa70a7 Mon Sep 17 00:00:00 2001 From: Adrian Moreno Date: Mon, 7 Jun 2021 11:54:35 +0200 Subject: [PATCH] ovn: make ovn probe building optional building ovn probe has become a bit more complicated. Make it optional so that the cost is not payed by users not wanting to use the probe Signed-off-by: Adrian Moreno --- .mk/ovn.mk | 12 ++++++------ Makefile | 6 +++++- topology/probes/ovn/no_ovn.go | 34 ++++++++++++++++++++++++++++++++++ topology/probes/ovn/ovn.go | 2 ++ 4 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 topology/probes/ovn/no_ovn.go diff --git a/.mk/ovn.mk b/.mk/ovn.mk index 9d99ceb1f5..c2d81e2659 100644 --- a/.mk/ovn.mk +++ b/.mk/ovn.mk @@ -14,14 +14,14 @@ $(GEN_BIN): .PHONY: .ovnmodel .ovnmodel: $(SCHEMA_FILE) $(GEN_BIN) -# TODO: add WITH_OVN flag -#ifeq ($(WITH_OVN), true) - go generate -tags "${BUILD_TAGS}" topology/probes/ovn/ovnmodel/gen.go -#endif +ifeq ($(WITH_OVN), true) + @go generate -tags "${BUILD_TAGS}" topology/probes/ovn/ovnmodel/gen.go +endif .PHONY: .ovnmodel.clean .ovnmodel.clean: - @grep -r 'generated by ovnmetagen' $(MODEL_DIR) | cut -d: -f 1 | xargs rm -f +ifeq ($(WITH_OVN), true) + @find $(MODEL_DIR) -name "*.go" | xargs grep 'generated by ovnmetagen' | cut -d: -f 1 | xargs rm -f @rm -f $(SCHEMA_FILE) @rm -f $(GEN_BIN) - +endif diff --git a/Makefile b/Makefile index a4d2087deb..bd348dd23c 100644 --- a/Makefile +++ b/Makefile @@ -98,8 +98,12 @@ ifeq ($(WITH_PACKETINJECT), true) BUILD_TAGS+=packetinject endif +ifeq ($(WITH_OVN), true) + BUILD_TAGS+=ovn +endif + ifeq ($(WITH_OVNK8S), true) - BUILD_TAGS+=k8s ovnk8s + BUILD_TAGS+=k8s ovn ovnk8s endif diff --git a/topology/probes/ovn/no_ovn.go b/topology/probes/ovn/no_ovn.go new file mode 100644 index 0000000000..a5031f55a2 --- /dev/null +++ b/topology/probes/ovn/no_ovn.go @@ -0,0 +1,34 @@ +// +build !ovn + +/* + * Copyright (C) 2019 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy ofthe License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specificlanguage governing permissions and + * limitations under the License. + * + */ + +package ovn + +import ( + "github.com/skydive-project/skydive/graffiti/graph" + "github.com/skydive-project/skydive/probe" +) + +// NewProbe returns a new OVN topology probe +func NewProbe(g *graph.Graph, address string, certFile string, keyFile string, cacertFile string) (probe.Handler, error) { + return nil, probe.ErrNotImplemented +} + +// Register registers graph metadata decoders +func Register() { +} diff --git a/topology/probes/ovn/ovn.go b/topology/probes/ovn/ovn.go index 6fe7ebc810..749c0cb1a4 100644 --- a/topology/probes/ovn/ovn.go +++ b/topology/probes/ovn/ovn.go @@ -1,3 +1,5 @@ +// +build ovn + /* * Copyright (C) 2019 Red Hat, Inc. *