From 4f7cc186224fa9e724dc503f98dbebbb151bd2c8 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 14 Sep 2021 12:09:08 +0800 Subject: [PATCH 1/4] runtime: refactor commandline code directory Move all command line code to `cmd` and move containerd-shim-v2 to pkg. Fixes: #2627 Signed-off-by: Peng Tao --- docs/design/architecture.md | 2 +- docs/how-to/containerd-kata.md | 2 +- src/runtime/.gitignore | 12 ++------ src/runtime/Makefile | 28 ++++++++++--------- .../{cli => cmd}/config-generated.go.in | 0 .../containerd-shim-kata-v2/main.go | 9 +++--- src/runtime/{cli => cmd}/kata-monitor/main.go | 0 src/runtime/{cli => cmd/kata-runtime}/exit.go | 0 .../{cli => cmd/kata-runtime}/exit_test.go | 0 .../{cli => cmd/kata-runtime}/factory.go | 0 .../{cli => cmd/kata-runtime}/factory_test.go | 0 .../{cli => cmd/kata-runtime}/kata-check.go | 0 .../kata-runtime}/kata-check_amd64.go | 0 .../kata-runtime}/kata-check_amd64_test.go | 0 .../kata-runtime}/kata-check_arm64.go | 0 .../kata-runtime}/kata-check_arm64_test.go | 0 .../kata-check_data_amd64_test.go | 0 .../kata-check_data_arm64_test.go | 0 .../kata-check_data_ppc64le_test.go | 0 .../kata-check_data_s390x_test.go | 2 +- .../kata-runtime}/kata-check_generic_test.go | 0 .../kata-runtime}/kata-check_ppc64le.go | 0 .../kata-runtime}/kata-check_ppc64le_test.go | 0 .../kata-runtime}/kata-check_s390x.go | 0 .../kata-runtime}/kata-check_s390x_test.go | 0 .../kata-runtime}/kata-check_test.go | 0 .../{cli => cmd/kata-runtime}/kata-env.go | 0 .../kata-runtime}/kata-env_amd64_test.go | 0 .../kata-runtime}/kata-env_arm64_test.go | 0 .../kata-runtime}/kata-env_generic_test.go | 0 .../kata-runtime}/kata-env_ppc64le_test.go | 0 .../kata-runtime}/kata-env_s390x_test.go | 0 .../kata-runtime}/kata-env_test.go | 0 .../{cli => cmd/kata-runtime}/kata-exec.go | 0 .../{cli => cmd/kata-runtime}/kata-metrics.go | 0 src/runtime/{cli => cmd/kata-runtime}/main.go | 0 .../{cli => cmd/kata-runtime}/main_test.go | 0 .../{cli => cmd/kata-runtime}/release.go | 0 .../{cli => cmd/kata-runtime}/release_test.go | 0 .../{cli => cmd/kata-runtime}/utils.go | 0 .../{cli => cmd/kata-runtime}/utils_test.go | 0 .../{cli => cmd/kata-runtime}/version.go | 0 .../{cli => cmd/kata-runtime}/version_test.go | 0 src/runtime/{ => cmd}/netmon/netmon.go | 0 src/runtime/{ => cmd}/netmon/netmon_test.go | 0 .../config/configuration-acrn.toml.in | 0 .../config/configuration-clh.toml.in | 0 .../{cli => }/config/configuration-fc.toml.in | 0 .../config/configuration-qemu.toml.in | 2 +- .../{ => pkg}/containerd-shim-v2/container.go | 0 .../containerd-shim-v2/container_test.go | 0 .../{ => pkg}/containerd-shim-v2/create.go | 0 .../containerd-shim-v2/create_test.go | 0 .../{ => pkg}/containerd-shim-v2/delete.go | 0 .../containerd-shim-v2/delete_test.go | 0 .../{ => pkg}/containerd-shim-v2/errors.go | 0 .../containerd-shim-v2/errors_test.go | 0 .../{ => pkg}/containerd-shim-v2/exec.go | 0 .../{ => pkg}/containerd-shim-v2/exec_test.go | 0 .../{ => pkg}/containerd-shim-v2/metrics.go | 0 .../containerd-shim-v2/metrics_test.go | 0 .../containerd-shim-v2/pause_test.go | 0 .../{ => pkg}/containerd-shim-v2/service.go | 0 .../containerd-shim-v2/service_test.go | 0 .../containerd-shim-v2/shim_management.go | 0 .../shim_management_test.go | 0 .../containerd-shim-v2/shim_metrics.go | 0 .../containerd-shim-v2/shim_metrics_test.go | 0 .../{ => pkg}/containerd-shim-v2/start.go | 0 .../containerd-shim-v2/start_test.go | 0 .../{ => pkg}/containerd-shim-v2/stream.go | 0 .../containerd-shim-v2/stream_test.go | 0 .../{ => pkg}/containerd-shim-v2/utils.go | 0 .../containerd-shim-v2/utils_test.go | 0 .../{ => pkg}/containerd-shim-v2/wait.go | 0 src/runtime/pkg/kata-monitor/pprof.go | 5 ++-- src/runtime/pkg/kata-monitor/shim_client.go | 3 +- 77 files changed, 32 insertions(+), 33 deletions(-) rename src/runtime/{cli => cmd}/config-generated.go.in (100%) rename src/runtime/{cli => cmd}/containerd-shim-kata-v2/main.go (64%) rename src/runtime/{cli => cmd}/kata-monitor/main.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/exit.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/exit_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/factory.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/factory_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check_amd64.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check_amd64_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check_arm64.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check_arm64_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check_data_amd64_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check_data_arm64_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check_data_ppc64le_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check_data_s390x_test.go (98%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check_generic_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check_ppc64le.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check_ppc64le_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check_s390x.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check_s390x_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-check_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-env.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-env_amd64_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-env_arm64_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-env_generic_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-env_ppc64le_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-env_s390x_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-env_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-exec.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/kata-metrics.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/main.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/main_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/release.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/release_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/utils.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/utils_test.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/version.go (100%) rename src/runtime/{cli => cmd/kata-runtime}/version_test.go (100%) rename src/runtime/{ => cmd}/netmon/netmon.go (100%) rename src/runtime/{ => cmd}/netmon/netmon_test.go (100%) rename src/runtime/{cli => }/config/configuration-acrn.toml.in (100%) rename src/runtime/{cli => }/config/configuration-clh.toml.in (100%) rename src/runtime/{cli => }/config/configuration-fc.toml.in (100%) rename src/runtime/{cli => }/config/configuration-qemu.toml.in (99%) rename src/runtime/{ => pkg}/containerd-shim-v2/container.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/container_test.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/create.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/create_test.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/delete.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/delete_test.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/errors.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/errors_test.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/exec.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/exec_test.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/metrics.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/metrics_test.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/pause_test.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/service.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/service_test.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/shim_management.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/shim_management_test.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/shim_metrics.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/shim_metrics_test.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/start.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/start_test.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/stream.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/stream_test.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/utils.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/utils_test.go (100%) rename src/runtime/{ => pkg}/containerd-shim-v2/wait.go (100%) diff --git a/docs/design/architecture.md b/docs/design/architecture.md index 17a2ea8d5a..d8b0113223 100644 --- a/docs/design/architecture.md +++ b/docs/design/architecture.md @@ -14,7 +14,7 @@ through the [CRI-O\*](https://github.com/kubernetes-incubator/cri-o) and Kata Containers creates a QEMU\*/KVM virtual machine for pod that `kubelet` (Kubernetes) creates respectively. -The [`containerd-shim-kata-v2` (shown as `shimv2` from this point onwards)](../../src/runtime/containerd-shim-v2) +The [`containerd-shim-kata-v2` (shown as `shimv2` from this point onwards)](../../src/runtime/cmd/containerd-shim-kata-v2/) is the Kata Containers entrypoint, which implements the [Containerd Runtime V2 (Shim API)](https://github.com/containerd/containerd/tree/master/runtime/v2) for Kata. diff --git a/docs/how-to/containerd-kata.md b/docs/how-to/containerd-kata.md index 3a1bc5f0e0..b03f879504 100644 --- a/docs/how-to/containerd-kata.md +++ b/docs/how-to/containerd-kata.md @@ -39,7 +39,7 @@ use `RuntimeClass` instead of the deprecated annotations. ### Containerd Runtime V2 API: Shim V2 API -The [`containerd-shim-kata-v2` (short as `shimv2` in this documentation)](../../src/runtime/containerd-shim-v2) +The [`containerd-shim-kata-v2` (short as `shimv2` in this documentation)](../../src/runtime/cmd/containerd-shim-kata-v2/) implements the [Containerd Runtime V2 (Shim API)](https://github.com/containerd/containerd/tree/master/runtime/v2) for Kata. With `shimv2`, Kubernetes can launch Pod and OCI-compatible containers with one shim per Pod. Prior to `shimv2`, `2N+1` shims (i.e. a `containerd-shim` and a `kata-shim` for each container and the Pod sandbox itself) and no standalone `kata-proxy` diff --git a/src/runtime/.gitignore b/src/runtime/.gitignore index 52b9e4e51c..ab7467bd45 100644 --- a/src/runtime/.gitignore +++ b/src/runtime/.gitignore @@ -5,16 +5,10 @@ coverage.txt coverage.html .git-commit .git-commit.tmp -/cli/config/configuration-acrn.toml -/cli/config/configuration-clh.toml -/cli/config/configuration-fc.toml -/cli/config/configuration-qemu.toml -/cli/config/configuration-clh.toml -/cli/config-generated.go -/cli/containerd-shim-kata-v2/config-generated.go -/cli/coverage.html +/config/*.toml +config-generated.go /containerd-shim-kata-v2 -/containerd-shim-v2/monitor_address +/cmd/containerd-shim-v2/monitor_address /data/kata-collect-data.sh /kata-monitor /kata-netmon diff --git a/src/runtime/Makefile b/src/runtime/Makefile index 9efdbbff73..2657a20f0b 100644 --- a/src/runtime/Makefile +++ b/src/runtime/Makefile @@ -51,12 +51,13 @@ PROJECT_DIR = $(PROJECT_TAG) IMAGENAME = $(PROJECT_TAG).img TARGET = $(BIN_PREFIX)-runtime -TARGET_OUTPUT = $(CURDIR)/$(TARGET) +RUNTIME_OUTPUT = $(CURDIR)/$(TARGET) +RUNTIME_DIR = $(CLI_DIR)/$(TARGET) BINLIST += $(TARGET) -NETMON_DIR = netmon +NETMON_DIR = $(CLI_DIR)/netmon NETMON_TARGET = $(PROJECT_TYPE)-netmon -NETMON_TARGET_OUTPUT = $(CURDIR)/$(NETMON_TARGET) +NETMON_RUNTIME_OUTPUT = $(CURDIR)/$(NETMON_TARGET) BINLIBEXECLIST += $(NETMON_TARGET) DESTDIR ?= / @@ -200,7 +201,7 @@ FEATURE_SELINUX ?= check SED = sed -CLI_DIR = cli +CLI_DIR = cmd SHIMV2 = containerd-shim-kata-v2 SHIMV2_OUTPUT = $(CURDIR)/$(SHIMV2) SHIMV2_DIR = $(CLI_DIR)/$(SHIMV2) @@ -225,7 +226,7 @@ ifneq (,$(QEMUCMD)) KNOWN_HYPERVISORS += $(HYPERVISOR_QEMU) CONFIG_FILE_QEMU = configuration-qemu.toml - CONFIG_QEMU = $(CLI_DIR)/config/$(CONFIG_FILE_QEMU) + CONFIG_QEMU = config/$(CONFIG_FILE_QEMU) CONFIG_QEMU_IN = $(CONFIG_QEMU).in CONFIG_PATH_QEMU = $(abspath $(CONFDIR)/$(CONFIG_FILE_QEMU)) @@ -248,7 +249,7 @@ ifneq (,$(CLHCMD)) KNOWN_HYPERVISORS += $(HYPERVISOR_CLH) CONFIG_FILE_CLH = configuration-clh.toml - CONFIG_CLH = $(CLI_DIR)/config/$(CONFIG_FILE_CLH) + CONFIG_CLH = config/$(CONFIG_FILE_CLH) CONFIG_CLH_IN = $(CONFIG_CLH).in CONFIG_PATH_CLH = $(abspath $(CONFDIR)/$(CONFIG_FILE_CLH)) @@ -271,7 +272,7 @@ ifneq (,$(FCCMD)) KNOWN_HYPERVISORS += $(HYPERVISOR_FC) CONFIG_FILE_FC = configuration-fc.toml - CONFIG_FC = $(CLI_DIR)/config/$(CONFIG_FILE_FC) + CONFIG_FC = config/$(CONFIG_FILE_FC) CONFIG_FC_IN = $(CONFIG_FC).in CONFIG_PATH_FC = $(abspath $(CONFDIR)/$(CONFIG_FILE_FC)) @@ -294,7 +295,7 @@ ifneq (,$(ACRNCMD)) KNOWN_HYPERVISORS += $(HYPERVISOR_ACRN) CONFIG_FILE_ACRN = configuration-acrn.toml - CONFIG_ACRN = $(CLI_DIR)/config/$(CONFIG_FILE_ACRN) + CONFIG_ACRN = config/$(CONFIG_FILE_ACRN) CONFIG_ACRN_IN = $(CONFIG_ACRN).in CONFIG_PATH_ACRN = $(abspath $(CONFDIR)/$(CONFIG_FILE_ACRN)) @@ -522,12 +523,12 @@ containerd-shim-v2: $(SHIMV2_OUTPUT) monitor: $(MONITOR_OUTPUT) -netmon: $(NETMON_TARGET_OUTPUT) +netmon: $(NETMON_RUNTIME_OUTPUT) -$(NETMON_TARGET_OUTPUT): $(SOURCES) VERSION +$(NETMON_RUNTIME_OUTPUT): $(SOURCES) VERSION $(QUIET_BUILD)(cd $(NETMON_DIR) && go build $(BUILDFLAGS) -o $@ -ldflags "-X main.version=$(VERSION)" $(KATA_LDFLAGS)) -runtime: $(TARGET_OUTPUT) $(CONFIGS) +runtime: $(RUNTIME_OUTPUT) $(CONFIGS) .DEFAULT: default build: default @@ -563,8 +564,9 @@ GENERATED_CONFIG = $(abspath $(CLI_DIR)/config-generated.go) GENERATED_FILES += $(GENERATED_CONFIG) GENERATED_FILES += pkg/katautils/config-settings.go -$(TARGET_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) | show-summary - $(QUIET_BUILD)(cd $(CLI_DIR) && go build $(KATA_LDFLAGS) $(BUILDFLAGS) -o $@ .) +$(RUNTIME_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) | show-summary + $(QUIET_BUILD)(cd $(RUNTIME_DIR)/ && ln -fs $(GENERATED_CONFIG)) + $(QUIET_BUILD)(cd $(RUNTIME_DIR) && go build $(KATA_LDFLAGS) $(BUILDFLAGS) -o $@ .) $(SHIMV2_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) $(QUIET_BUILD)(cd $(SHIMV2_DIR)/ && ln -fs $(GENERATED_CONFIG)) diff --git a/src/runtime/cli/config-generated.go.in b/src/runtime/cmd/config-generated.go.in similarity index 100% rename from src/runtime/cli/config-generated.go.in rename to src/runtime/cmd/config-generated.go.in diff --git a/src/runtime/cli/containerd-shim-kata-v2/main.go b/src/runtime/cmd/containerd-shim-kata-v2/main.go similarity index 64% rename from src/runtime/cli/containerd-shim-kata-v2/main.go rename to src/runtime/cmd/containerd-shim-kata-v2/main.go index ed35338fa2..a05e8773ed 100644 --- a/src/runtime/cli/containerd-shim-kata-v2/main.go +++ b/src/runtime/cmd/containerd-shim-kata-v2/main.go @@ -9,12 +9,13 @@ import ( "fmt" "os" - "github.com/containerd/containerd/runtime/v2/shim" - containerdshim "github.com/kata-containers/kata-containers/src/runtime/containerd-shim-v2" + shimapi "github.com/containerd/containerd/runtime/v2/shim" + + shim "github.com/kata-containers/kata-containers/src/runtime/pkg/containerd-shim-v2" "github.com/kata-containers/kata-containers/src/runtime/pkg/types" ) -func shimConfig(config *shim.Config) { +func shimConfig(config *shimapi.Config) { config.NoReaper = true config.NoSubreaper = true } @@ -26,5 +27,5 @@ func main() { os.Exit(0) } - shim.Run(types.DefaultKataRuntimeName, containerdshim.New, shimConfig) + shimapi.Run(types.DefaultKataRuntimeName, shim.New, shimConfig) } diff --git a/src/runtime/cli/kata-monitor/main.go b/src/runtime/cmd/kata-monitor/main.go similarity index 100% rename from src/runtime/cli/kata-monitor/main.go rename to src/runtime/cmd/kata-monitor/main.go diff --git a/src/runtime/cli/exit.go b/src/runtime/cmd/kata-runtime/exit.go similarity index 100% rename from src/runtime/cli/exit.go rename to src/runtime/cmd/kata-runtime/exit.go diff --git a/src/runtime/cli/exit_test.go b/src/runtime/cmd/kata-runtime/exit_test.go similarity index 100% rename from src/runtime/cli/exit_test.go rename to src/runtime/cmd/kata-runtime/exit_test.go diff --git a/src/runtime/cli/factory.go b/src/runtime/cmd/kata-runtime/factory.go similarity index 100% rename from src/runtime/cli/factory.go rename to src/runtime/cmd/kata-runtime/factory.go diff --git a/src/runtime/cli/factory_test.go b/src/runtime/cmd/kata-runtime/factory_test.go similarity index 100% rename from src/runtime/cli/factory_test.go rename to src/runtime/cmd/kata-runtime/factory_test.go diff --git a/src/runtime/cli/kata-check.go b/src/runtime/cmd/kata-runtime/kata-check.go similarity index 100% rename from src/runtime/cli/kata-check.go rename to src/runtime/cmd/kata-runtime/kata-check.go diff --git a/src/runtime/cli/kata-check_amd64.go b/src/runtime/cmd/kata-runtime/kata-check_amd64.go similarity index 100% rename from src/runtime/cli/kata-check_amd64.go rename to src/runtime/cmd/kata-runtime/kata-check_amd64.go diff --git a/src/runtime/cli/kata-check_amd64_test.go b/src/runtime/cmd/kata-runtime/kata-check_amd64_test.go similarity index 100% rename from src/runtime/cli/kata-check_amd64_test.go rename to src/runtime/cmd/kata-runtime/kata-check_amd64_test.go diff --git a/src/runtime/cli/kata-check_arm64.go b/src/runtime/cmd/kata-runtime/kata-check_arm64.go similarity index 100% rename from src/runtime/cli/kata-check_arm64.go rename to src/runtime/cmd/kata-runtime/kata-check_arm64.go diff --git a/src/runtime/cli/kata-check_arm64_test.go b/src/runtime/cmd/kata-runtime/kata-check_arm64_test.go similarity index 100% rename from src/runtime/cli/kata-check_arm64_test.go rename to src/runtime/cmd/kata-runtime/kata-check_arm64_test.go diff --git a/src/runtime/cli/kata-check_data_amd64_test.go b/src/runtime/cmd/kata-runtime/kata-check_data_amd64_test.go similarity index 100% rename from src/runtime/cli/kata-check_data_amd64_test.go rename to src/runtime/cmd/kata-runtime/kata-check_data_amd64_test.go diff --git a/src/runtime/cli/kata-check_data_arm64_test.go b/src/runtime/cmd/kata-runtime/kata-check_data_arm64_test.go similarity index 100% rename from src/runtime/cli/kata-check_data_arm64_test.go rename to src/runtime/cmd/kata-runtime/kata-check_data_arm64_test.go diff --git a/src/runtime/cli/kata-check_data_ppc64le_test.go b/src/runtime/cmd/kata-runtime/kata-check_data_ppc64le_test.go similarity index 100% rename from src/runtime/cli/kata-check_data_ppc64le_test.go rename to src/runtime/cmd/kata-runtime/kata-check_data_ppc64le_test.go diff --git a/src/runtime/cli/kata-check_data_s390x_test.go b/src/runtime/cmd/kata-runtime/kata-check_data_s390x_test.go similarity index 98% rename from src/runtime/cli/kata-check_data_s390x_test.go rename to src/runtime/cmd/kata-runtime/kata-check_data_s390x_test.go index 258f1e1b0c..b6b5226fca 100644 --- a/src/runtime/cli/kata-check_data_s390x_test.go +++ b/src/runtime/cmd/kata-runtime/kata-check_data_s390x_test.go @@ -10,7 +10,7 @@ vendor_id : IBM/S390 # processors : 4 bogomips per cpu: 20325.00 max thread id : 0 -features : esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs te vx sie +features : esan3 zarch stfle msa ldisp eimm dfp edat etf3eh highgprs te vx sie cache0 : level=1 type=Data scope=Private size=128K line_size=256 associativity=8 cache1 : level=1 type=Instruction scope=Private size=96K line_size=256 associativity=6 cache2 : level=2 type=Data scope=Private size=2048K line_size=256 associativity=8 diff --git a/src/runtime/cli/kata-check_generic_test.go b/src/runtime/cmd/kata-runtime/kata-check_generic_test.go similarity index 100% rename from src/runtime/cli/kata-check_generic_test.go rename to src/runtime/cmd/kata-runtime/kata-check_generic_test.go diff --git a/src/runtime/cli/kata-check_ppc64le.go b/src/runtime/cmd/kata-runtime/kata-check_ppc64le.go similarity index 100% rename from src/runtime/cli/kata-check_ppc64le.go rename to src/runtime/cmd/kata-runtime/kata-check_ppc64le.go diff --git a/src/runtime/cli/kata-check_ppc64le_test.go b/src/runtime/cmd/kata-runtime/kata-check_ppc64le_test.go similarity index 100% rename from src/runtime/cli/kata-check_ppc64le_test.go rename to src/runtime/cmd/kata-runtime/kata-check_ppc64le_test.go diff --git a/src/runtime/cli/kata-check_s390x.go b/src/runtime/cmd/kata-runtime/kata-check_s390x.go similarity index 100% rename from src/runtime/cli/kata-check_s390x.go rename to src/runtime/cmd/kata-runtime/kata-check_s390x.go diff --git a/src/runtime/cli/kata-check_s390x_test.go b/src/runtime/cmd/kata-runtime/kata-check_s390x_test.go similarity index 100% rename from src/runtime/cli/kata-check_s390x_test.go rename to src/runtime/cmd/kata-runtime/kata-check_s390x_test.go diff --git a/src/runtime/cli/kata-check_test.go b/src/runtime/cmd/kata-runtime/kata-check_test.go similarity index 100% rename from src/runtime/cli/kata-check_test.go rename to src/runtime/cmd/kata-runtime/kata-check_test.go diff --git a/src/runtime/cli/kata-env.go b/src/runtime/cmd/kata-runtime/kata-env.go similarity index 100% rename from src/runtime/cli/kata-env.go rename to src/runtime/cmd/kata-runtime/kata-env.go diff --git a/src/runtime/cli/kata-env_amd64_test.go b/src/runtime/cmd/kata-runtime/kata-env_amd64_test.go similarity index 100% rename from src/runtime/cli/kata-env_amd64_test.go rename to src/runtime/cmd/kata-runtime/kata-env_amd64_test.go diff --git a/src/runtime/cli/kata-env_arm64_test.go b/src/runtime/cmd/kata-runtime/kata-env_arm64_test.go similarity index 100% rename from src/runtime/cli/kata-env_arm64_test.go rename to src/runtime/cmd/kata-runtime/kata-env_arm64_test.go diff --git a/src/runtime/cli/kata-env_generic_test.go b/src/runtime/cmd/kata-runtime/kata-env_generic_test.go similarity index 100% rename from src/runtime/cli/kata-env_generic_test.go rename to src/runtime/cmd/kata-runtime/kata-env_generic_test.go diff --git a/src/runtime/cli/kata-env_ppc64le_test.go b/src/runtime/cmd/kata-runtime/kata-env_ppc64le_test.go similarity index 100% rename from src/runtime/cli/kata-env_ppc64le_test.go rename to src/runtime/cmd/kata-runtime/kata-env_ppc64le_test.go diff --git a/src/runtime/cli/kata-env_s390x_test.go b/src/runtime/cmd/kata-runtime/kata-env_s390x_test.go similarity index 100% rename from src/runtime/cli/kata-env_s390x_test.go rename to src/runtime/cmd/kata-runtime/kata-env_s390x_test.go diff --git a/src/runtime/cli/kata-env_test.go b/src/runtime/cmd/kata-runtime/kata-env_test.go similarity index 100% rename from src/runtime/cli/kata-env_test.go rename to src/runtime/cmd/kata-runtime/kata-env_test.go diff --git a/src/runtime/cli/kata-exec.go b/src/runtime/cmd/kata-runtime/kata-exec.go similarity index 100% rename from src/runtime/cli/kata-exec.go rename to src/runtime/cmd/kata-runtime/kata-exec.go diff --git a/src/runtime/cli/kata-metrics.go b/src/runtime/cmd/kata-runtime/kata-metrics.go similarity index 100% rename from src/runtime/cli/kata-metrics.go rename to src/runtime/cmd/kata-runtime/kata-metrics.go diff --git a/src/runtime/cli/main.go b/src/runtime/cmd/kata-runtime/main.go similarity index 100% rename from src/runtime/cli/main.go rename to src/runtime/cmd/kata-runtime/main.go diff --git a/src/runtime/cli/main_test.go b/src/runtime/cmd/kata-runtime/main_test.go similarity index 100% rename from src/runtime/cli/main_test.go rename to src/runtime/cmd/kata-runtime/main_test.go diff --git a/src/runtime/cli/release.go b/src/runtime/cmd/kata-runtime/release.go similarity index 100% rename from src/runtime/cli/release.go rename to src/runtime/cmd/kata-runtime/release.go diff --git a/src/runtime/cli/release_test.go b/src/runtime/cmd/kata-runtime/release_test.go similarity index 100% rename from src/runtime/cli/release_test.go rename to src/runtime/cmd/kata-runtime/release_test.go diff --git a/src/runtime/cli/utils.go b/src/runtime/cmd/kata-runtime/utils.go similarity index 100% rename from src/runtime/cli/utils.go rename to src/runtime/cmd/kata-runtime/utils.go diff --git a/src/runtime/cli/utils_test.go b/src/runtime/cmd/kata-runtime/utils_test.go similarity index 100% rename from src/runtime/cli/utils_test.go rename to src/runtime/cmd/kata-runtime/utils_test.go diff --git a/src/runtime/cli/version.go b/src/runtime/cmd/kata-runtime/version.go similarity index 100% rename from src/runtime/cli/version.go rename to src/runtime/cmd/kata-runtime/version.go diff --git a/src/runtime/cli/version_test.go b/src/runtime/cmd/kata-runtime/version_test.go similarity index 100% rename from src/runtime/cli/version_test.go rename to src/runtime/cmd/kata-runtime/version_test.go diff --git a/src/runtime/netmon/netmon.go b/src/runtime/cmd/netmon/netmon.go similarity index 100% rename from src/runtime/netmon/netmon.go rename to src/runtime/cmd/netmon/netmon.go diff --git a/src/runtime/netmon/netmon_test.go b/src/runtime/cmd/netmon/netmon_test.go similarity index 100% rename from src/runtime/netmon/netmon_test.go rename to src/runtime/cmd/netmon/netmon_test.go diff --git a/src/runtime/cli/config/configuration-acrn.toml.in b/src/runtime/config/configuration-acrn.toml.in similarity index 100% rename from src/runtime/cli/config/configuration-acrn.toml.in rename to src/runtime/config/configuration-acrn.toml.in diff --git a/src/runtime/cli/config/configuration-clh.toml.in b/src/runtime/config/configuration-clh.toml.in similarity index 100% rename from src/runtime/cli/config/configuration-clh.toml.in rename to src/runtime/config/configuration-clh.toml.in diff --git a/src/runtime/cli/config/configuration-fc.toml.in b/src/runtime/config/configuration-fc.toml.in similarity index 100% rename from src/runtime/cli/config/configuration-fc.toml.in rename to src/runtime/config/configuration-fc.toml.in diff --git a/src/runtime/cli/config/configuration-qemu.toml.in b/src/runtime/config/configuration-qemu.toml.in similarity index 99% rename from src/runtime/cli/config/configuration-qemu.toml.in rename to src/runtime/config/configuration-qemu.toml.in index 2113a527ee..9f4da58bed 100644 --- a/src/runtime/cli/config/configuration-qemu.toml.in +++ b/src/runtime/config/configuration-qemu.toml.in @@ -360,7 +360,7 @@ valid_entropy_sources = @DEFVALIDENTROPYSOURCES@ # When enable_guest_swap is enabled, insert a raw file to the guest as the swap device # if the swappiness of a container (set by annotation "io.katacontainers.container.resource.swappiness") # is bigger than 0. -# The size of the swap device should be +# The size of the swap device should be # swap_in_bytes (set by annotation "io.katacontainers.container.resource.swap_in_bytes") - memory_limit_in_bytes. # If swap_in_bytes is not set, the size should be memory_limit_in_bytes. # If swap_in_bytes and memory_limit_in_bytes is not set, the size should diff --git a/src/runtime/containerd-shim-v2/container.go b/src/runtime/pkg/containerd-shim-v2/container.go similarity index 100% rename from src/runtime/containerd-shim-v2/container.go rename to src/runtime/pkg/containerd-shim-v2/container.go diff --git a/src/runtime/containerd-shim-v2/container_test.go b/src/runtime/pkg/containerd-shim-v2/container_test.go similarity index 100% rename from src/runtime/containerd-shim-v2/container_test.go rename to src/runtime/pkg/containerd-shim-v2/container_test.go diff --git a/src/runtime/containerd-shim-v2/create.go b/src/runtime/pkg/containerd-shim-v2/create.go similarity index 100% rename from src/runtime/containerd-shim-v2/create.go rename to src/runtime/pkg/containerd-shim-v2/create.go diff --git a/src/runtime/containerd-shim-v2/create_test.go b/src/runtime/pkg/containerd-shim-v2/create_test.go similarity index 100% rename from src/runtime/containerd-shim-v2/create_test.go rename to src/runtime/pkg/containerd-shim-v2/create_test.go diff --git a/src/runtime/containerd-shim-v2/delete.go b/src/runtime/pkg/containerd-shim-v2/delete.go similarity index 100% rename from src/runtime/containerd-shim-v2/delete.go rename to src/runtime/pkg/containerd-shim-v2/delete.go diff --git a/src/runtime/containerd-shim-v2/delete_test.go b/src/runtime/pkg/containerd-shim-v2/delete_test.go similarity index 100% rename from src/runtime/containerd-shim-v2/delete_test.go rename to src/runtime/pkg/containerd-shim-v2/delete_test.go diff --git a/src/runtime/containerd-shim-v2/errors.go b/src/runtime/pkg/containerd-shim-v2/errors.go similarity index 100% rename from src/runtime/containerd-shim-v2/errors.go rename to src/runtime/pkg/containerd-shim-v2/errors.go diff --git a/src/runtime/containerd-shim-v2/errors_test.go b/src/runtime/pkg/containerd-shim-v2/errors_test.go similarity index 100% rename from src/runtime/containerd-shim-v2/errors_test.go rename to src/runtime/pkg/containerd-shim-v2/errors_test.go diff --git a/src/runtime/containerd-shim-v2/exec.go b/src/runtime/pkg/containerd-shim-v2/exec.go similarity index 100% rename from src/runtime/containerd-shim-v2/exec.go rename to src/runtime/pkg/containerd-shim-v2/exec.go diff --git a/src/runtime/containerd-shim-v2/exec_test.go b/src/runtime/pkg/containerd-shim-v2/exec_test.go similarity index 100% rename from src/runtime/containerd-shim-v2/exec_test.go rename to src/runtime/pkg/containerd-shim-v2/exec_test.go diff --git a/src/runtime/containerd-shim-v2/metrics.go b/src/runtime/pkg/containerd-shim-v2/metrics.go similarity index 100% rename from src/runtime/containerd-shim-v2/metrics.go rename to src/runtime/pkg/containerd-shim-v2/metrics.go diff --git a/src/runtime/containerd-shim-v2/metrics_test.go b/src/runtime/pkg/containerd-shim-v2/metrics_test.go similarity index 100% rename from src/runtime/containerd-shim-v2/metrics_test.go rename to src/runtime/pkg/containerd-shim-v2/metrics_test.go diff --git a/src/runtime/containerd-shim-v2/pause_test.go b/src/runtime/pkg/containerd-shim-v2/pause_test.go similarity index 100% rename from src/runtime/containerd-shim-v2/pause_test.go rename to src/runtime/pkg/containerd-shim-v2/pause_test.go diff --git a/src/runtime/containerd-shim-v2/service.go b/src/runtime/pkg/containerd-shim-v2/service.go similarity index 100% rename from src/runtime/containerd-shim-v2/service.go rename to src/runtime/pkg/containerd-shim-v2/service.go diff --git a/src/runtime/containerd-shim-v2/service_test.go b/src/runtime/pkg/containerd-shim-v2/service_test.go similarity index 100% rename from src/runtime/containerd-shim-v2/service_test.go rename to src/runtime/pkg/containerd-shim-v2/service_test.go diff --git a/src/runtime/containerd-shim-v2/shim_management.go b/src/runtime/pkg/containerd-shim-v2/shim_management.go similarity index 100% rename from src/runtime/containerd-shim-v2/shim_management.go rename to src/runtime/pkg/containerd-shim-v2/shim_management.go diff --git a/src/runtime/containerd-shim-v2/shim_management_test.go b/src/runtime/pkg/containerd-shim-v2/shim_management_test.go similarity index 100% rename from src/runtime/containerd-shim-v2/shim_management_test.go rename to src/runtime/pkg/containerd-shim-v2/shim_management_test.go diff --git a/src/runtime/containerd-shim-v2/shim_metrics.go b/src/runtime/pkg/containerd-shim-v2/shim_metrics.go similarity index 100% rename from src/runtime/containerd-shim-v2/shim_metrics.go rename to src/runtime/pkg/containerd-shim-v2/shim_metrics.go diff --git a/src/runtime/containerd-shim-v2/shim_metrics_test.go b/src/runtime/pkg/containerd-shim-v2/shim_metrics_test.go similarity index 100% rename from src/runtime/containerd-shim-v2/shim_metrics_test.go rename to src/runtime/pkg/containerd-shim-v2/shim_metrics_test.go diff --git a/src/runtime/containerd-shim-v2/start.go b/src/runtime/pkg/containerd-shim-v2/start.go similarity index 100% rename from src/runtime/containerd-shim-v2/start.go rename to src/runtime/pkg/containerd-shim-v2/start.go diff --git a/src/runtime/containerd-shim-v2/start_test.go b/src/runtime/pkg/containerd-shim-v2/start_test.go similarity index 100% rename from src/runtime/containerd-shim-v2/start_test.go rename to src/runtime/pkg/containerd-shim-v2/start_test.go diff --git a/src/runtime/containerd-shim-v2/stream.go b/src/runtime/pkg/containerd-shim-v2/stream.go similarity index 100% rename from src/runtime/containerd-shim-v2/stream.go rename to src/runtime/pkg/containerd-shim-v2/stream.go diff --git a/src/runtime/containerd-shim-v2/stream_test.go b/src/runtime/pkg/containerd-shim-v2/stream_test.go similarity index 100% rename from src/runtime/containerd-shim-v2/stream_test.go rename to src/runtime/pkg/containerd-shim-v2/stream_test.go diff --git a/src/runtime/containerd-shim-v2/utils.go b/src/runtime/pkg/containerd-shim-v2/utils.go similarity index 100% rename from src/runtime/containerd-shim-v2/utils.go rename to src/runtime/pkg/containerd-shim-v2/utils.go diff --git a/src/runtime/containerd-shim-v2/utils_test.go b/src/runtime/pkg/containerd-shim-v2/utils_test.go similarity index 100% rename from src/runtime/containerd-shim-v2/utils_test.go rename to src/runtime/pkg/containerd-shim-v2/utils_test.go diff --git a/src/runtime/containerd-shim-v2/wait.go b/src/runtime/pkg/containerd-shim-v2/wait.go similarity index 100% rename from src/runtime/containerd-shim-v2/wait.go rename to src/runtime/pkg/containerd-shim-v2/wait.go diff --git a/src/runtime/pkg/kata-monitor/pprof.go b/src/runtime/pkg/kata-monitor/pprof.go index 2060fe3dd3..5dac2da03c 100644 --- a/src/runtime/pkg/kata-monitor/pprof.go +++ b/src/runtime/pkg/kata-monitor/pprof.go @@ -7,12 +7,13 @@ package katamonitor import ( "fmt" - cdshim "github.com/containerd/containerd/runtime/v2/shim" "io" "net" "net/http" - shim "github.com/kata-containers/kata-containers/src/runtime/containerd-shim-v2" + cdshim "github.com/containerd/containerd/runtime/v2/shim" + + shim "github.com/kata-containers/kata-containers/src/runtime/pkg/containerd-shim-v2" ) func serveError(w http.ResponseWriter, status int, txt string) { diff --git a/src/runtime/pkg/kata-monitor/shim_client.go b/src/runtime/pkg/kata-monitor/shim_client.go index 31d014e091..77d95e744d 100644 --- a/src/runtime/pkg/kata-monitor/shim_client.go +++ b/src/runtime/pkg/kata-monitor/shim_client.go @@ -13,7 +13,8 @@ import ( "time" cdshim "github.com/containerd/containerd/runtime/v2/shim" - shim "github.com/kata-containers/kata-containers/src/runtime/containerd-shim-v2" + + shim "github.com/kata-containers/kata-containers/src/runtime/pkg/containerd-shim-v2" ) const ( From e7c42fbc76fa9f1313d38046c8e8a024ad9cae56 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 14 Sep 2021 13:47:17 +0800 Subject: [PATCH 2/4] runtime: unify generated config We don't need to maintain two generated config.go and even have duplicates between them. Signed-off-by: Peng Tao --- src/runtime/Makefile | 8 --- src/runtime/cmd/config-generated.go.in | 40 -------------- .../cmd/containerd-shim-kata-v2/main.go | 3 +- src/runtime/cmd/kata-runtime/kata-check.go | 24 ++++----- src/runtime/cmd/kata-runtime/kata-env.go | 12 +++-- src/runtime/cmd/kata-runtime/kata-env_test.go | 4 +- src/runtime/cmd/kata-runtime/main.go | 26 +++++----- src/runtime/cmd/kata-runtime/main_test.go | 52 +++++++++---------- src/runtime/cmd/kata-runtime/release.go | 10 ++-- src/runtime/cmd/kata-runtime/release_test.go | 5 +- .../pkg/katautils/config-settings.go.in | 35 +++++++++++-- src/runtime/pkg/katautils/config.go | 6 +-- src/runtime/pkg/katautils/config_test.go | 14 ++--- src/runtime/pkg/katautils/create_test.go | 2 +- src/runtime/pkg/katautils/logger.go | 2 +- src/runtime/pkg/katautils/utils_test.go | 2 +- 16 files changed, 114 insertions(+), 131 deletions(-) delete mode 100644 src/runtime/cmd/config-generated.go.in diff --git a/src/runtime/Makefile b/src/runtime/Makefile index 2657a20f0b..1865e480e3 100644 --- a/src/runtime/Makefile +++ b/src/runtime/Makefile @@ -559,17 +559,12 @@ define MAKE_KERNEL_VIRTIOFS_NAME $(if $(findstring uncompressed,$1),vmlinux-virtiofs.container,vmlinuz-virtiofs.container) endef -GENERATED_CONFIG = $(abspath $(CLI_DIR)/config-generated.go) - -GENERATED_FILES += $(GENERATED_CONFIG) GENERATED_FILES += pkg/katautils/config-settings.go $(RUNTIME_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) | show-summary - $(QUIET_BUILD)(cd $(RUNTIME_DIR)/ && ln -fs $(GENERATED_CONFIG)) $(QUIET_BUILD)(cd $(RUNTIME_DIR) && go build $(KATA_LDFLAGS) $(BUILDFLAGS) -o $@ .) $(SHIMV2_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) - $(QUIET_BUILD)(cd $(SHIMV2_DIR)/ && ln -fs $(GENERATED_CONFIG)) $(QUIET_BUILD)(cd $(SHIMV2_DIR)/ && go build $(KATA_LDFLAGS) $(BUILDFLAGS) -o $@ .) $(MONITOR_OUTPUT): $(SOURCES) $(GENERATED_FILES) $(MAKEFILE_LIST) .git-commit @@ -612,7 +607,6 @@ ifeq ($(shell id -u), 0) endif go-test: $(GENERATED_FILES) - $(QUIET_BUILD)(cd $(SHIMV2_DIR)/ && ln -fs $(GENERATED_CONFIG)) go clean -testcache go test -v -mod=vendor ./... @@ -621,7 +615,6 @@ check-go-static: $(QUIET_CHECK)../../ci/go-no-os-exit.sh ./virtcontainers coverage: - $(QUIET_BUILD)(cd $(SHIMV2_DIR)/ && ln -fs $(GENERATED_CONFIG)) go test -v -mod=vendor -covermode=atomic -coverprofile=coverage.txt ./... go tool cover -html=coverage.txt -o coverage.html @@ -668,7 +661,6 @@ clean: $(NETMON_TARGET) \ $(MONITOR) \ $(SHIMV2) \ - $(SHIMV2_DIR)/$(notdir $(GENERATED_CONFIG)) \ $(TARGET) \ .git-commit .git-commit.tmp diff --git a/src/runtime/cmd/config-generated.go.in b/src/runtime/cmd/config-generated.go.in deleted file mode 100644 index baa6d9cd0c..0000000000 --- a/src/runtime/cmd/config-generated.go.in +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright (c) 2018-2019 Intel Corporation -// -// SPDX-License-Identifier: Apache-2.0 -// -// WARNING: This file is auto-generated - DO NOT EDIT! -// -// Note that some variables are "var" to allow them to be modified -// by the tests. -package main - -// name is the name of the runtime -const name = "@RUNTIME_NAME@" - -// name of the project -const project = "@PROJECT_NAME@" - -// prefix used to denote non-standard CLI commands and options. -const projectPrefix = "@PROJECT_TYPE@" - -// original URL for this project -const projectURL = "@PROJECT_URL@" - -// Project URL's organisation name -const projectORG = "@PROJECT_ORG@" - -const defaultRootDirectory = "@PKGRUNDIR@" - -// commit is the git commit the runtime is compiled from. -var commit = "@COMMIT@" - -// version is the runtime version. -var version = "@VERSION@" - -// Default config file used by stateless systems. -var defaultRuntimeConfiguration = "@CONFIG_PATH@" - -// Alternate config file that takes precedence over -// defaultRuntimeConfiguration. -var defaultSysConfRuntimeConfiguration = "@SYSCONFIG@" diff --git a/src/runtime/cmd/containerd-shim-kata-v2/main.go b/src/runtime/cmd/containerd-shim-kata-v2/main.go index a05e8773ed..412dec6ec3 100644 --- a/src/runtime/cmd/containerd-shim-kata-v2/main.go +++ b/src/runtime/cmd/containerd-shim-kata-v2/main.go @@ -12,6 +12,7 @@ import ( shimapi "github.com/containerd/containerd/runtime/v2/shim" shim "github.com/kata-containers/kata-containers/src/runtime/pkg/containerd-shim-v2" + "github.com/kata-containers/kata-containers/src/runtime/pkg/katautils" "github.com/kata-containers/kata-containers/src/runtime/pkg/types" ) @@ -23,7 +24,7 @@ func shimConfig(config *shimapi.Config) { func main() { if len(os.Args) == 2 && os.Args[1] == "--version" { - fmt.Printf("%s containerd shim: id: %q, version: %s, commit: %v\n", project, types.DefaultKataRuntimeName, version, commit) + fmt.Printf("%s containerd shim: id: %q, version: %s, commit: %v\n", katautils.PROJECT, types.DefaultKataRuntimeName, katautils.VERSION, katautils.COMMIT) os.Exit(0) } diff --git a/src/runtime/cmd/kata-runtime/kata-check.go b/src/runtime/cmd/kata-runtime/kata-check.go index 076fb0525d..991a3fd3ad 100644 --- a/src/runtime/cmd/kata-runtime/kata-check.go +++ b/src/runtime/cmd/kata-runtime/kata-check.go @@ -61,9 +61,9 @@ type vmContainerCapableDetails struct { const ( moduleParamDir = "parameters" - successMessageCapable = "System is capable of running " + project - successMessageCreate = "System can currently create " + project - failMessage = "System is not capable of running " + project + successMessageCapable = "System is capable of running " + katautils.PROJECT + successMessageCreate = "System can currently create " + katautils.PROJECT + failMessage = "System is not capable of running " + katautils.PROJECT kernelPropertyCorrect = "Kernel property value correct" // these refer to fields in the procCPUINFO file @@ -313,7 +313,7 @@ func genericHostIsVMContainerCapable(details vmContainerCapableDetails) error { var kataCheckCLICommand = cli.Command{ Name: "check", Aliases: []string{"kata-check"}, - Usage: "tests if system can run " + project, + Usage: "tests if system can run " + katautils.PROJECT, Flags: []cli.Flag{ cli.BoolFlag{ Name: "check-version-only", @@ -372,14 +372,14 @@ EXAMPLES: $ %s check --only-list-releases --include-all-releases `, - project, + katautils.PROJECT, noNetworkEnvVar, - name, - name, - name, - name, - name, - name, + katautils.NAME, + katautils.NAME, + katautils.NAME, + katautils.NAME, + katautils.NAME, + katautils.NAME, ), Action: func(context *cli.Context) error { @@ -398,7 +398,7 @@ EXAMPLES: if os.Geteuid() == 0 { kataLog.Warn("Not running network checks as super user") } else { - err := HandleReleaseVersions(cmd, version, context.Bool("include-all-releases")) + err := HandleReleaseVersions(cmd, katautils.VERSION, context.Bool("include-all-releases")) if err != nil { return err } diff --git a/src/runtime/cmd/kata-runtime/kata-env.go b/src/runtime/cmd/kata-runtime/kata-env.go index 87e803825b..13861b174f 100644 --- a/src/runtime/cmd/kata-runtime/kata-env.go +++ b/src/runtime/cmd/kata-runtime/kata-env.go @@ -13,14 +13,16 @@ import ( "strings" "github.com/BurntSushi/toml" + specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/prometheus/procfs" + "github.com/urfave/cli" + + "github.com/kata-containers/kata-containers/src/runtime/pkg/katautils" "github.com/kata-containers/kata-containers/src/runtime/pkg/utils" vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers" exp "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/experimental" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/oci" vcUtils "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/utils" - specs "github.com/opencontainers/runtime-spec/specs-go" - "github.com/prometheus/procfs" - "github.com/urfave/cli" ) // Semantic version for the output of the command. @@ -169,8 +171,8 @@ func getMetaInfo() MetaInfo { } func getRuntimeInfo(configFile string, config oci.RuntimeConfig) RuntimeInfo { - runtimeVersionInfo := constructVersionInfo(version) - runtimeVersionInfo.Commit = commit + runtimeVersionInfo := constructVersionInfo(katautils.VERSION) + runtimeVersionInfo.Commit = katautils.COMMIT runtimeVersion := RuntimeVersionInfo{ Version: runtimeVersionInfo, diff --git a/src/runtime/cmd/kata-runtime/kata-env_test.go b/src/runtime/cmd/kata-runtime/kata-env_test.go index ec5b297cef..6193f05e6f 100644 --- a/src/runtime/cmd/kata-runtime/kata-env_test.go +++ b/src/runtime/cmd/kata-runtime/kata-env_test.go @@ -314,8 +314,8 @@ func getExpectedKernel(config oci.RuntimeConfig) KernelInfo { func getExpectedRuntimeDetails(config oci.RuntimeConfig, configFile string) RuntimeInfo { runtimePath, _ := os.Executable() - runtimeVersionInfo := constructVersionInfo(version) - runtimeVersionInfo.Commit = commit + runtimeVersionInfo := constructVersionInfo(katautils.VERSION) + runtimeVersionInfo.Commit = katautils.COMMIT return RuntimeInfo{ Version: RuntimeVersionInfo{ Version: runtimeVersionInfo, diff --git a/src/runtime/cmd/kata-runtime/main.go b/src/runtime/cmd/kata-runtime/main.go index eaef71aeeb..a2a930abbd 100644 --- a/src/runtime/cmd/kata-runtime/main.go +++ b/src/runtime/cmd/kata-runtime/main.go @@ -39,18 +39,18 @@ const arch = goruntime.GOARCH var usage = fmt.Sprintf(`%s runtime %s is a command line program for running applications packaged -according to the Open Container Initiative (OCI).`, name, name) +according to the Open Container Initiative (OCI).`, katautils.NAME, katautils.NAME) var notes = fmt.Sprintf(` NOTES: -- Commands starting "%s-" and options starting "--%s-" are `+project+` extensions. +- Commands starting "%s-" and options starting "--%s-" are `+katautils.PROJECT+` extensions. URL: The canonical URL for this project is: %s -`, projectPrefix, projectPrefix, projectURL) +`, katautils.PROJECTPREFIX, katautils.PROJECTPREFIX, katautils.PROJECTURL) // kataLog is the logger used to record all messages var kataLog *logrus.Entry @@ -82,7 +82,7 @@ var defaultErrorFile = os.Stderr var runtimeFlags = []cli.Flag{ cli.StringFlag{ Name: "config, kata-config", - Usage: project + " config file path", + Usage: katautils.PROJECT + " config file path", }, cli.StringFlag{ Name: "log", @@ -96,7 +96,7 @@ var runtimeFlags = []cli.Flag{ }, cli.StringFlag{ Name: "root", - Value: defaultRootDirectory, + Value: katautils.DEFAULTROOTDIRECTORY, Usage: "root directory for storage of container state (this should be located in tmpfs)", }, cli.StringFlag{ @@ -145,7 +145,7 @@ var savedCLIErrWriter = cli.ErrWriter func init() { kataLog = logrus.WithFields(logrus.Fields{ - "name": name, + "name": katautils.NAME, "source": "runtime", "arch": arch, "pid": os.Getpid(), @@ -222,7 +222,7 @@ func beforeSubcommands(c *cli.Context) error { var runtimeConfig oci.RuntimeConfig var err error - katautils.SetConfigOptions(name, defaultRuntimeConfiguration, defaultSysConfRuntimeConfiguration) + katautils.SetConfigOptions(katautils.NAME, katautils.DEFAULTRUNTIMECONFIGURATION, katautils.DEFAULTSYSCONFRUNTIMECONFIGURATION) handleShowConfig(c) @@ -302,8 +302,8 @@ func beforeSubcommands(c *cli.Context) error { args := strings.Join(c.Args(), " ") fields := logrus.Fields{ - "version": version, - "commit": commit, + "version": katautils.VERSION, + "commit": katautils.COMMIT, "arguments": `"` + args + `"`, } @@ -365,14 +365,14 @@ func commandNotFound(c *cli.Context, command string) { func makeVersionString() string { v := make([]string, 0, 3) - versionStr := version + versionStr := katautils.VERSION if versionStr == "" { versionStr = unknown } - v = append(v, name+" : "+versionStr) + v = append(v, katautils.NAME+" : "+versionStr) - commitStr := commit + commitStr := katautils.COMMIT if commitStr == "" { commitStr = unknown } @@ -411,7 +411,7 @@ func setCLIGlobals() { func createRuntimeApp(ctx context.Context, args []string) error { app := cli.NewApp() - app.Name = name + app.Name = katautils.NAME app.Writer = defaultOutputFile app.Usage = usage app.CommandNotFound = runtimeCommandNotFound diff --git a/src/runtime/cmd/kata-runtime/main_test.go b/src/runtime/cmd/kata-runtime/main_test.go index b6a6f634b4..c18d19b507 100644 --- a/src/runtime/cmd/kata-runtime/main_test.go +++ b/src/runtime/cmd/kata-runtime/main_test.go @@ -57,19 +57,19 @@ var ( var testingImpl = &vcmock.VCMock{} func init() { - if version == "" { + if katautils.VERSION == "" { panic("ERROR: invalid build: version not set") } - if commit == "" { + if katautils.COMMIT == "" { panic("ERROR: invalid build: commit not set") } - if defaultSysConfRuntimeConfiguration == "" { + if katautils.DEFAULTSYSCONFRUNTIMECONFIGURATION == "" { panic("ERROR: invalid build: defaultSysConfRuntimeConfiguration not set") } - if defaultRuntimeConfiguration == "" { + if katautils.DEFAULTRUNTIMECONFIGURATION == "" { panic("ERROR: invalid build: defaultRuntimeConfiguration not set") } @@ -82,7 +82,7 @@ func init() { var err error fmt.Printf("INFO: creating test directory\n") - testDir, err = ioutil.TempDir("", fmt.Sprintf("%s-", name)) + testDir, err = ioutil.TempDir("", fmt.Sprintf("%s-", katautils.NAME)) if err != nil { panic(fmt.Sprintf("ERROR: failed to create test directory: %v", err)) } @@ -153,8 +153,8 @@ func runUnitTests(m *testing.M) { func TestMain(m *testing.M) { // If the test binary name is kata-runtime.coverage, we've are being asked to // run the coverage-instrumented kata-runtime. - if path.Base(os.Args[0]) == name+".coverage" || - path.Base(os.Args[0]) == name { + if path.Base(os.Args[0]) == katautils.NAME+".coverage" || + path.Base(os.Args[0]) == katautils.NAME { main() exit(0) } @@ -666,9 +666,9 @@ func TestMainBeforeSubCommandsShowCCConfigPaths(t *testing.T) { for i, line := range lines { switch i { case 0: - assert.Equal(line, defaultSysConfRuntimeConfiguration) + assert.Equal(line, katautils.DEFAULTSYSCONFRUNTIMECONFIGURATION) case 1: - assert.Equal(line, defaultRuntimeConfiguration) + assert.Equal(line, katautils.DEFAULTRUNTIMECONFIGURATION) } } } @@ -715,7 +715,7 @@ func testVersionString(assert *assert.Assertions, versionString, expectedVersion foundCommit := false foundOCIVersion := false - versionRE := regexp.MustCompile(fmt.Sprintf(`%s\s*:\s*%v`, name, expectedVersion)) + versionRE := regexp.MustCompile(fmt.Sprintf(`%s\s*:\s*%v`, katautils.NAME, expectedVersion)) commitRE := regexp.MustCompile(fmt.Sprintf(`%s\s*:\s*%v`, "commit", expectedCommit)) ociRE := regexp.MustCompile(fmt.Sprintf(`%s\s*:\s*%v`, "OCI specs", expectedOCIVersion)) @@ -753,37 +753,37 @@ func TestMainMakeVersionString(t *testing.T) { v := makeVersionString() - testVersionString(assert, v, version, commit, specs.Version) + testVersionString(assert, v, katautils.VERSION, katautils.COMMIT, specs.Version) } func TestMainMakeVersionStringNoVersion(t *testing.T) { assert := assert.New(t) - savedVersion := version - version = "" + savedVersion := katautils.VERSION + katautils.VERSION = "" defer func() { - version = savedVersion + katautils.VERSION = savedVersion }() v := makeVersionString() - testVersionString(assert, v, unknown, commit, specs.Version) + testVersionString(assert, v, unknown, katautils.COMMIT, specs.Version) } func TestMainMakeVersionStringNoCommit(t *testing.T) { assert := assert.New(t) - savedCommit := commit - commit = "" + savedCommit := katautils.COMMIT + katautils.COMMIT = "" defer func() { - commit = savedCommit + katautils.COMMIT = savedCommit }() v := makeVersionString() - testVersionString(assert, v, version, unknown, specs.Version) + testVersionString(assert, v, katautils.VERSION, unknown, specs.Version) } func TestMainMakeVersionStringNoOCIVersion(t *testing.T) { @@ -798,7 +798,7 @@ func TestMainMakeVersionStringNoOCIVersion(t *testing.T) { v := makeVersionString() - testVersionString(assert, v, version, commit, unknown) + testVersionString(assert, v, katautils.VERSION, katautils.COMMIT, unknown) } func TestMainCreateRuntimeApp(t *testing.T) { @@ -824,7 +824,7 @@ func TestMainCreateRuntimeApp(t *testing.T) { defaultOutputFile = savedOutputFile }() - args := []string{name} + args := []string{katautils.NAME} err = createRuntimeApp(context.Background(), args) assert.NoError(err, "%v", args) @@ -849,7 +849,7 @@ func TestMainCreateRuntimeAppInvalidSubCommand(t *testing.T) { }() // calls fatal() so no return - _ = createRuntimeApp(context.Background(), []string{name, "i-am-an-invalid-sub-command"}) + _ = createRuntimeApp(context.Background(), []string{katautils.NAME, "i-am-an-invalid-sub-command"}) assert.NotEqual(exitStatus, 0) } @@ -869,7 +869,7 @@ func TestMainCreateRuntime(t *testing.T) { savedBefore := runtimeBeforeSubcommands savedCommands := runtimeCommands - os.Args = []string{name, cmd} + os.Args = []string{katautils.NAME, cmd} exitFunc = func(status int) { exitStatus = status } // disable @@ -920,10 +920,10 @@ func TestMainVersionPrinter(t *testing.T) { setCLIGlobals() - err = createRuntimeApp(context.Background(), []string{name, "--version"}) + err = createRuntimeApp(context.Background(), []string{katautils.NAME, "--version"}) assert.NoError(err) - err = grep(fmt.Sprintf(`%s\s*:\s*%s`, name, version), output) + err = grep(fmt.Sprintf(`%s\s*:\s*%s`, katautils.NAME, katautils.VERSION), output) assert.NoError(err) } @@ -968,7 +968,7 @@ func TestMainFatalWriter(t *testing.T) { setCLIGlobals() - err := createRuntimeApp(context.Background(), []string{name, cmd}) + err := createRuntimeApp(context.Background(), []string{katautils.NAME, cmd}) assert.Error(err) re := regexp.MustCompile( diff --git a/src/runtime/cmd/kata-runtime/release.go b/src/runtime/cmd/kata-runtime/release.go index 560541c48c..3acfae71d8 100644 --- a/src/runtime/cmd/kata-runtime/release.go +++ b/src/runtime/cmd/kata-runtime/release.go @@ -16,6 +16,8 @@ import ( "strings" "github.com/blang/semver" + + "github.com/kata-containers/kata-containers/src/runtime/pkg/katautils" ) type ReleaseCmd int @@ -29,7 +31,7 @@ type releaseDetails struct { const ( // A release URL is expected to be prefixed with this value - projectAPIURL = "https://api.github.com/repos/" + projectORG + projectAPIURL = "https://api.github.com/repos/" + katautils.PROJECTORG releasesSuffix = "/releases" downloadsSuffix = releasesSuffix + "/download" @@ -37,12 +39,12 @@ const ( // Kata 1.x kata1xRepo = "runtime" kataLegacyReleaseURL = projectAPIURL + "/" + kata1xRepo + releasesSuffix - kataLegacyDownloadURL = projectURL + "/" + kata1xRepo + downloadsSuffix + kataLegacyDownloadURL = katautils.PROJECTURL + "/" + kata1xRepo + downloadsSuffix // Kata 2.x or newer kata2xRepo = "kata-containers" kataReleaseURL = projectAPIURL + "/" + kata2xRepo + releasesSuffix - kataDownloadURL = projectURL + "/" + kata2xRepo + downloadsSuffix + kataDownloadURL = katautils.PROJECTURL + "/" + kata2xRepo + downloadsSuffix // Environment variable that can be used to override a release URL ReleaseURLEnvVar = "KATA_RELEASE_URL" @@ -377,7 +379,7 @@ func HandleReleaseVersions(cmd ReleaseCmd, currentVersion string, includeAll boo currentSemver, err := semver.Make(currentVersion) if err != nil { - return fmt.Errorf("BUG: Current version of %s (%s) has invalid SemVer version: %v", name, currentVersion, err) + return fmt.Errorf("BUG: Current version of %s (%s) has invalid SemVer version: %v", katautils.NAME, currentVersion, err) } releaseURL, err := getReleaseURL(currentSemver) diff --git a/src/runtime/cmd/kata-runtime/release_test.go b/src/runtime/cmd/kata-runtime/release_test.go index 275a2b5db4..a40cd00d9d 100644 --- a/src/runtime/cmd/kata-runtime/release_test.go +++ b/src/runtime/cmd/kata-runtime/release_test.go @@ -12,6 +12,7 @@ import ( "testing" "github.com/blang/semver" + "github.com/kata-containers/kata-containers/src/runtime/pkg/katautils" "github.com/stretchr/testify/assert" ) @@ -20,7 +21,7 @@ var expectedReleasesURL string func init() { var err error - currentSemver, err = semver.Make(version) + currentSemver, err = semver.Make(katautils.VERSION) if err != nil { panic(fmt.Sprintf("failed to create semver for testing: %v", err)) @@ -307,7 +308,7 @@ func TestDownloadURLIsValid(t *testing.T) { {"foo", true}, {"foo bar", true}, {"https://google.com", true}, - {projectURL, true}, + {katautils.PROJECTURL, true}, {validKata1xDownload, false}, {validKata2xDownload, false}, } diff --git a/src/runtime/pkg/katautils/config-settings.go.in b/src/runtime/pkg/katautils/config-settings.go.in index d03f5406ac..4b92b4390b 100644 --- a/src/runtime/pkg/katautils/config-settings.go.in +++ b/src/runtime/pkg/katautils/config-settings.go.in @@ -1,5 +1,6 @@ // Copyright (c) 2018 Intel Corporation // Copyright (c) 2018 HyperHQ Inc. +// Copyright (c) 2021 Ant Group // // SPDX-License-Identifier: Apache-2.0 // @@ -8,6 +9,35 @@ package katautils +// name is the name of the runtime +var NAME = "@RUNTIME_NAME@" + +// name of the project +const PROJECT = "@PROJECT_NAME@" + +// prefix used to denote non-standard CLI commands and options. +const PROJECTPREFIX = "@PROJECT_TYPE@" + +// original URL for this project +const PROJECTURL = "@PROJECT_URL@" + +// Project URL's organisation name +const PROJECTORG = "@PROJECT_ORG@" + +const DEFAULTROOTDIRECTORY = "@PKGRUNDIR@" + +// commit is the git commit the runtime is compiled from. +var COMMIT = "@COMMIT@" + +// version is the runtime version. +var VERSION = "@VERSION@" + +// Default config file used by stateless systems. +var DEFAULTRUNTIMECONFIGURATION = "@CONFIG_PATH@" + +// Alternate config file that takes precedence over +// defaultRuntimeConfiguration. +var DEFAULTSYSCONFRUNTIMECONFIGURATION = "@SYSCONFIG@" var defaultHypervisorPath = "/usr/bin/qemu-system-x86_64" var defaultHypervisorCtlPath = "/usr/bin/acrnctl" var defaultJailerPath = "/usr/bin/jailer" @@ -65,9 +95,4 @@ const defaultVMCacheEndpoint string = "/var/run/kata-containers/cache.sock" // Default config file used by stateless systems. var defaultRuntimeConfiguration = "@CONFIG_PATH@" -// Alternate config file that takes precedence over -// defaultRuntimeConfiguration. -var defaultSysConfRuntimeConfiguration = "@SYSCONFIG@" - -var name = "kata" var defaultNetmonPath = "/usr/libexec/kata-containers/kata-netmon" diff --git a/src/runtime/pkg/katautils/config.go b/src/runtime/pkg/katautils/config.go index edf882c5f9..6be937726b 100644 --- a/src/runtime/pkg/katautils/config.go +++ b/src/runtime/pkg/katautils/config.go @@ -1343,7 +1343,7 @@ func checkHypervisorConfig(config vc.HypervisorConfig) error { func GetDefaultConfigFilePaths() []string { return []string{ // normally below "/etc" - defaultSysConfRuntimeConfiguration, + DEFAULTSYSCONFRUNTIMECONFIGURATION, // normally below "/usr/share" defaultRuntimeConfiguration, @@ -1371,7 +1371,7 @@ func getDefaultConfigFile() (string, error) { // SetConfigOptions will override some of the defaults settings. func SetConfigOptions(n, runtimeConfig, sysRuntimeConfig string) { if n != "" { - name = n + NAME = n } if runtimeConfig != "" { @@ -1379,6 +1379,6 @@ func SetConfigOptions(n, runtimeConfig, sysRuntimeConfig string) { } if sysRuntimeConfig != "" { - defaultSysConfRuntimeConfiguration = sysRuntimeConfig + DEFAULTSYSCONFRUNTIMECONFIGURATION = sysRuntimeConfig } } diff --git a/src/runtime/pkg/katautils/config_test.go b/src/runtime/pkg/katautils/config_test.go index e6df8985b5..39497264b9 100644 --- a/src/runtime/pkg/katautils/config_test.go +++ b/src/runtime/pkg/katautils/config_test.go @@ -250,7 +250,7 @@ func testLoadConfiguration(t *testing.T, dir string, // override defaultRuntimeConfiguration = testConfig.ConfigPath - defaultSysConfRuntimeConfiguration = "" + DEFAULTSYSCONFRUNTIMECONFIGURATION = "" for _, file := range configFiles { var err error @@ -1193,24 +1193,24 @@ func TestGetDefaultConfigFile(t *testing.T) { assert.NoError(err) savedConf := defaultRuntimeConfiguration - savedSysConf := defaultSysConfRuntimeConfiguration + savedSysConf := DEFAULTSYSCONFRUNTIMECONFIGURATION defaultRuntimeConfiguration = confDirConfig.ConfigPath - defaultSysConfRuntimeConfiguration = sysConfDirConfig.ConfigPath + DEFAULTSYSCONFRUNTIMECONFIGURATION = sysConfDirConfig.ConfigPath defer func() { defaultRuntimeConfiguration = savedConf - defaultSysConfRuntimeConfiguration = savedSysConf + DEFAULTSYSCONFRUNTIMECONFIGURATION = savedSysConf }() got, err := getDefaultConfigFile() assert.NoError(err) - // defaultSysConfRuntimeConfiguration has priority over defaultRuntimeConfiguration - assert.Equal(got, defaultSysConfRuntimeConfiguration) + // DEFAULTSYSCONFRUNTIMECONFIGURATION has priority over defaultRuntimeConfiguration + assert.Equal(got, DEFAULTSYSCONFRUNTIMECONFIGURATION) // force defaultRuntimeConfiguration to be returned - os.Remove(defaultSysConfRuntimeConfiguration) + os.Remove(DEFAULTSYSCONFRUNTIMECONFIGURATION) got, err = getDefaultConfigFile() assert.NoError(err) diff --git a/src/runtime/pkg/katautils/create_test.go b/src/runtime/pkg/katautils/create_test.go index fa6b434d09..46693fcaa6 100644 --- a/src/runtime/pkg/katautils/create_test.go +++ b/src/runtime/pkg/katautils/create_test.go @@ -161,7 +161,7 @@ func findLastParam(key string, params []vc.Param) (string, error) { } } - return "", fmt.Errorf("no param called %q found", name) + return "", fmt.Errorf("no param called %q found", NAME) } func TestSetEphemeralStorageType(t *testing.T) { diff --git a/src/runtime/pkg/katautils/logger.go b/src/runtime/pkg/katautils/logger.go index 699d5a95ed..4c456798b3 100644 --- a/src/runtime/pkg/katautils/logger.go +++ b/src/runtime/pkg/katautils/logger.go @@ -61,7 +61,7 @@ func (h *sysLogHook) Fire(e *logrus.Entry) (err error) { } func newSystemLogHook(network, raddr string) (*sysLogHook, error) { - hook, err := lSyslog.NewSyslogHook(network, raddr, syslog.LOG_INFO, name) + hook, err := lSyslog.NewSyslogHook(network, raddr, syslog.LOG_INFO, NAME) if err != nil { return nil, err } diff --git a/src/runtime/pkg/katautils/utils_test.go b/src/runtime/pkg/katautils/utils_test.go index 0beedc2ff9..af95931184 100644 --- a/src/runtime/pkg/katautils/utils_test.go +++ b/src/runtime/pkg/katautils/utils_test.go @@ -45,7 +45,7 @@ func init() { var err error fmt.Printf("INFO: creating test directory\n") - testDir, err = ioutil.TempDir("", fmt.Sprintf("%s-", name)) + testDir, err = ioutil.TempDir("", fmt.Sprintf("%s-", NAME)) if err != nil { panic(fmt.Sprintf("ERROR: failed to create test directory: %v", err)) } From 9a311a2b58b40968234874e65d97de45a7961de6 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Tue, 14 Sep 2021 19:25:46 +0800 Subject: [PATCH 3/4] docs: fix invalid kernel dax doc url And use a released version instead of the master branch so that it no longer gets invalidated. Depends-on: github.com/kata-containers/kata-containers#2645 Signed-off-by: Peng Tao --- docs/design/architecture.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/design/architecture.md b/docs/design/architecture.md index d8b0113223..1446f56839 100644 --- a/docs/design/architecture.md +++ b/docs/design/architecture.md @@ -259,7 +259,7 @@ With `RuntimeClass`, users can define Kata Containers as a `RuntimeClass` and th ## DAX -Kata Containers utilizes the Linux kernel DAX [(Direct Access filesystem)](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/dax.txt) +Kata Containers utilizes the Linux kernel DAX [(Direct Access filesystem)](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/dax.rst?h=v5.14) feature to efficiently map some host-side files into the guest VM space. In particular, Kata Containers uses the QEMU NVDIMM feature to provide a memory-mapped virtual device that can be used to DAX map the virtual machine's From 067c44d0b647ac166284726a4f26892f3dba1b9d Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Thu, 16 Sep 2021 19:42:02 +0800 Subject: [PATCH 4/4] runtime: fix UT build failure storeContainer has been removed. Signed-off-by: Peng Tao --- src/runtime/virtcontainers/container_test.go | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/runtime/virtcontainers/container_test.go b/src/runtime/virtcontainers/container_test.go index 6824694d06..0c70b6b37e 100644 --- a/src/runtime/virtcontainers/container_test.go +++ b/src/runtime/virtcontainers/container_test.go @@ -689,18 +689,3 @@ func TestConfigValid(t *testing.T) { result = config.valid() assert.True(result) } - -func TestStoreContainer(t *testing.T) { - hConfig := newHypervisorConfig(nil, nil) - sandbox, err := testCreateSandbox(t, testSandboxID, MockHypervisor, hConfig, NetworkConfig{}, nil, nil) - assert.NoError(t, err) - defer cleanUp() - - container := &Container{ - sandbox: sandbox, - } - - err = container.storeContainer() - assert.Nil(t, err, "store container should succeed") - -}