Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Makefile: Provide default hypervisor CMD settings#1168

Merged
jodh-intel merged 1 commit into
kata-containers:masterfrom
bryteise:hypervisor-cmd-defaults
Jan 30, 2019
Merged

Makefile: Provide default hypervisor CMD settings#1168
jodh-intel merged 1 commit into
kata-containers:masterfrom
bryteise:hypervisor-cmd-defaults

Conversation

@bryteise
Copy link
Copy Markdown
Contributor

As arch detection isn't being done and KNOWN_HYPERVISORS was only
being populated via environment variable settings (and is a runtime
rather than build time dependency anyway) just provide a set of
defaults that can be overridden as needed at build time.

This will also cause any hypervisor configuration to always be
installed.

@bryteise bryteise force-pushed the hypervisor-cmd-defaults branch from 8efaaea to 9dc3e5e Compare January 23, 2019 20:45
@grahamwhaley
Copy link
Copy Markdown
Contributor

quick feedback - you'll need to modify the PR to match the project format/requirements to pass the initial CI - see link in the travis logs as per https://github.com/kata-containers/community/blob/master/CONTRIBUTING.md#patch-format below:

Found 1 commit between commit 9dc3e5e56c18d8cb483924ed98815445ae949fbc and branch master
ERROR: No "Fixes" found
ERROR: checkcommits failed. See the document below for help on formatting
commits for the project.
https://github.com/kata-containers/community/blob/master/CONTRIBUTING.md#patch-format
The command ".ci/static-checks.sh" failed and exited with 1 during .

@bryteise
Copy link
Copy Markdown
Contributor Author

@grahamwhaley Thanks for the pointer, I had just tossed it up and was looking to see what stuck. I'll open an issue as that seems like the only thing I'm failing on with the patch-format now after fixing the signoff.

@bryteise bryteise force-pushed the hypervisor-cmd-defaults branch from 9dc3e5e to 7b1752d Compare January 24, 2019 00:43
@amshinde
Copy link
Copy Markdown
Member

/test

Copy link
Copy Markdown
Member

@amshinde amshinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Copy Markdown

@jodh-intel jodh-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for raising but either I'm misunderstanding what your PR does, or you are misunderstanding what our build system does :)

The way it currently works is to load arch-specific settings from arch/*.mk. That sets the correct QEMUCMD (which is architecture dependent btw) and also sets FCCMD for those architectures that FC supports.

Providing a default qemu binary name is meaningless if you look at how they vary by platform.

Comment thread Makefile Outdated
LOCALSTATEDIR := /var

# default CMD names if not
QEMUCMD ?= kata-qemu-lite-system-x86_64
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this? We don't use a kata prefix as this is not a Kata-developed component.

@jodh-intel
Copy link
Copy Markdown

Ah - I think I might see what you were trying to do now; the build currently requires GOPATH. To resolve that, something like the following would work:

diff --git a/Makefile b/Makefile
index 1c11f74..86ce694 100644
--- a/Makefile
+++ b/Makefile
@@ -23,22 +23,20 @@ ifeq ($(SKIP_GO_VERSION_CHECK),)
     include golang.mk
 endif
 
-ifneq ($(GOPATH),)
-    GOARCH=$(shell go env GOARCH)
-    ifeq ($(ARCH),)
-        ARCH = $(GOARCH)
-    endif
-
-    ARCH_DIR = arch
-    ARCH_FILE_SUFFIX = -options.mk
-    ARCH_FILE = $(ARCH_DIR)/$(ARCH)$(ARCH_FILE_SUFFIX)
-    ARCH_FILES = $(wildcard arch/*$(ARCH_FILE_SUFFIX))
-    ALL_ARCHES = $(patsubst $(ARCH_DIR)/%$(ARCH_FILE_SUFFIX),%,$(ARCH_FILES))
-
-    # Load architecture-dependent settings
-    include $(ARCH_FILE)
+GOARCH=$(shell go env GOARCH)
+ifeq ($(ARCH),)
+    ARCH = $(GOARCH)
 endif
 
+ARCH_DIR = arch
+ARCH_FILE_SUFFIX = -options.mk
+ARCH_FILE = $(ARCH_DIR)/$(ARCH)$(ARCH_FILE_SUFFIX)
+ARCH_FILES = $(wildcard arch/*$(ARCH_FILE_SUFFIX))
+ALL_ARCHES = $(patsubst $(ARCH_DIR)/%$(ARCH_FILE_SUFFIX),%,$(ARCH_FILES))
+
+# Load architecture-dependent settings
+include $(ARCH_FILE)
+
 PROJECT_TYPE = kata
 PROJECT_NAME = Kata Containers
 PROJECT_TAG = kata-containers

@bryteise
Copy link
Copy Markdown
Contributor Author

@jodh-intel So the issue raised is when the GOPATH is set, the autodetection using the arch scripts isn't run is that something that could be modified then?

@bryteise
Copy link
Copy Markdown
Contributor Author

@jodh-intel Okay, I'll give that a try.

@jcvenegas
Copy link
Copy Markdown
Member

@jodh-intel I tested your patch, it as I was expecting, what I dont really get is that the GOPATH is actually set en my environment

Architecture-dependent settings were not being populated when GOPATH
was set. This change ensures they are always set.

Fixes kata-containers#1169

Signed-off-by: William Douglas <william.douglas@intel.com>
@bryteise bryteise force-pushed the hypervisor-cmd-defaults branch from 7b1752d to a02c39e Compare January 24, 2019 20:25
@bryteise
Copy link
Copy Markdown
Contributor Author

@jodh-intel Okay, I just applied your suggestion directly and am happy with the result, thanks!

Copy link
Copy Markdown

@jodh-intel jodh-intel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bryteise.

lgtm

Comment thread Makefile
# Load architecture-dependent settings
include $(ARCH_FILE)
GOARCH=$(shell go env GOARCH)
ifeq ($(ARCH),)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth adding a comment here explaining this is to allow the user to set ARCH before we overwrite it.

More info

A quick look makes it appear as though this is wrong since ARCH isn't set yet. However, since ARCH is added to the USER_VARS variable, that check is to allow the user to define the architecture they want to build with (cross build). If not specified, we default to the host architecture (using go's naming rather than that of arch(1)):

$ make ARCH=foo ...

Copy link
Copy Markdown

@devimc devimc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@devimc
Copy link
Copy Markdown

devimc commented Jan 28, 2019

/test

@jodh-intel
Copy link
Copy Markdown

/retest

@jodh-intel
Copy link
Copy Markdown

fedora vsocks CI failed due to network timeout. But since all the other CI's are passing (ignoring the known ARM issue), I'm going to merge anyway since this code is not distro specific...

@jodh-intel jodh-intel merged commit 91c454d into kata-containers:master Jan 30, 2019
@teawater
Copy link
Copy Markdown
Member

Ah - I think I might see what you were trying to do now; the build currently requires GOPATH. To resolve that, something like the following would work:

diff --git a/Makefile b/Makefile
index 1c11f74..86ce694 100644
--- a/Makefile
+++ b/Makefile
@@ -23,22 +23,20 @@ ifeq ($(SKIP_GO_VERSION_CHECK),)
     include golang.mk
 endif
 
-ifneq ($(GOPATH),)
-    GOARCH=$(shell go env GOARCH)
-    ifeq ($(ARCH),)
-        ARCH = $(GOARCH)
-    endif
-
-    ARCH_DIR = arch
-    ARCH_FILE_SUFFIX = -options.mk
-    ARCH_FILE = $(ARCH_DIR)/$(ARCH)$(ARCH_FILE_SUFFIX)
-    ARCH_FILES = $(wildcard arch/*$(ARCH_FILE_SUFFIX))
-    ALL_ARCHES = $(patsubst $(ARCH_DIR)/%$(ARCH_FILE_SUFFIX),%,$(ARCH_FILES))
-
-    # Load architecture-dependent settings
-    include $(ARCH_FILE)
+GOARCH=$(shell go env GOARCH)
+ifeq ($(ARCH),)
+    ARCH = $(GOARCH)
 endif
 
+ARCH_DIR = arch
+ARCH_FILE_SUFFIX = -options.mk
+ARCH_FILE = $(ARCH_DIR)/$(ARCH)$(ARCH_FILE_SUFFIX)
+ARCH_FILES = $(wildcard arch/*$(ARCH_FILE_SUFFIX))
+ALL_ARCHES = $(patsubst $(ARCH_DIR)/%$(ARCH_FILE_SUFFIX),%,$(ARCH_FILES))
+
+# Load architecture-dependent settings
+include $(ARCH_FILE)
+
 PROJECT_TYPE = kata
 PROJECT_NAME = Kata Containers
 PROJECT_TAG = kata-containers

@jodh-intel does makefile call "go" without GOPATH? If so, maybe I can update "GOPATH not set mode" to non-go mode because:

$ sudo go
sudo: go: command not found

@jodh-intel
Copy link
Copy Markdown

I think you probably want sudo -E go - that's what we do in our CI. I personally set GOPATH to make my life easier ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants