mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-28 18:54:37 +01:00
Merge pull request #7134 from stevenhorsman/CCv0-merge-19th-june
CCv0: Merge main into CCv0 branch
This commit is contained in:
@@ -254,7 +254,7 @@ DEFVIRTIOFSQUEUESIZE ?= 1024
|
||||
#
|
||||
# see `virtiofsd -h` for possible options.
|
||||
# Make sure you quote args.
|
||||
DEFVIRTIOFSEXTRAARGS ?= [\"--thread-pool-size=1\", \"-o\", \"announce_submounts\"]
|
||||
DEFVIRTIOFSEXTRAARGS ?= [\"--thread-pool-size=1\", \"--announce-submounts\"]
|
||||
DEFENABLEIOTHREADS := false
|
||||
DEFENABLEVHOSTUSERSTORE := false
|
||||
DEFVHOSTUSERSTOREPATH := $(PKGRUNDIR)/vhost-user
|
||||
@@ -387,31 +387,6 @@ ifneq (,$(QEMUCMD))
|
||||
|
||||
CONFIGS += $(CONFIG_REMOTE)
|
||||
|
||||
|
||||
CONFIG_FILE_QEMU_GPU = configuration-qemu-gpu.toml
|
||||
CONFIG_QEMU_GPU = config/$(CONFIG_FILE_QEMU_GPU)
|
||||
CONFIG_QEMU_GPU_IN = $(CONFIG_QEMU_GPU).in
|
||||
|
||||
CONFIG_PATH_QEMU_SEV = $(abspath $(CONFDIR)/$(CONFIG_FILE_QEMU_SEV))
|
||||
CONFIG_PATHS += $(CONFIG_PATH_QEMU_SEV)
|
||||
|
||||
SYSCONFIG_QEMU_SEV = $(abspath $(SYSCONFDIR)/$(CONFIG_FILE_QEMU_SEV))
|
||||
SYSCONFIG_PATHS_SEV += $(SYSCONFIG_QEMU_SEV)
|
||||
|
||||
CONFIGS += $(CONFIG_QEMU_SEV)
|
||||
|
||||
CONFIG_FILE_QEMU_SNP = configuration-qemu-snp.toml
|
||||
CONFIG_QEMU_SNP = config/$(CONFIG_FILE_QEMU_SNP)
|
||||
CONFIG_QEMU_SNP_IN = $(CONFIG_QEMU_SNP).in
|
||||
|
||||
CONFIG_PATH_QEMU_SNP = $(abspath $(CONFDIR)/$(CONFIG_FILE_QEMU_SNP))
|
||||
CONFIG_PATHS += $(CONFIG_PATH_QEMU_SNP)
|
||||
|
||||
SYSCONFIG_QEMU_SNP = $(abspath $(SYSCONFDIR)/$(CONFIG_FILE_QEMU_SNP))
|
||||
SYSCONFIG_PATHS_SNP += $(SYSCONFIG_QEMU_SNP)
|
||||
|
||||
CONFIGS += $(CONFIG_QEMU_SNP)
|
||||
|
||||
CONFIG_FILE_QEMU_NVIDIA_GPU = configuration-qemu-nvidia-gpu.toml
|
||||
CONFIG_QEMU_NVIDIA_GPU = config/$(CONFIG_FILE_QEMU_NVIDIA_GPU)
|
||||
CONFIG_QEMU_NVIDIA_GPU_IN = $(CONFIG_QEMU_NVIDIA_GPU).in
|
||||
|
||||
@@ -32,8 +32,6 @@ to work seamlessly with both Docker and Kubernetes respectively.
|
||||
|
||||
## Download and install
|
||||
|
||||
[](https://snapcraft.io/kata-containers)
|
||||
|
||||
See the [installation guides](../../docs/install/README.md)
|
||||
available for various operating systems.
|
||||
|
||||
|
||||
@@ -150,9 +150,9 @@ virtio_fs_queue_size = @DEFVIRTIOFSQUEUESIZE@
|
||||
# Extra args for virtiofsd daemon
|
||||
#
|
||||
# Format example:
|
||||
# ["-o", "arg1=xxx,arg2", "-o", "hello world", "--arg3=yyy"]
|
||||
# ["--arg1=xxx", "--arg2=yyy"]
|
||||
# Examples:
|
||||
# Set virtiofsd log level to debug : ["-o", "log_level=debug"] or ["-d"]
|
||||
# Set virtiofsd log level to debug : ["--log-level=debug"]
|
||||
# see `virtiofsd -h` for possible options.
|
||||
virtio_fs_extra_args = @DEFVIRTIOFSEXTRAARGS@
|
||||
|
||||
|
||||
@@ -225,9 +225,9 @@ virtio_fs_queue_size = @DEFVIRTIOFSQUEUESIZE@
|
||||
# Extra args for virtiofsd daemon
|
||||
#
|
||||
# Format example:
|
||||
# ["-o", "arg1=xxx,arg2", "-o", "hello world", "--arg3=yyy"]
|
||||
# ["--arg1=xxx", "--arg2=yyy"]
|
||||
# Examples:
|
||||
# Set virtiofsd log level to debug : ["-o", "log_level=debug"] or ["-d"]
|
||||
# Set virtiofsd log level to debug : ["--log-level=debug"]
|
||||
#
|
||||
# see `virtiofsd -h` for possible options.
|
||||
virtio_fs_extra_args = @DEFVIRTIOFSEXTRAARGS@
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"context"
|
||||
|
||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/image"
|
||||
persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api"
|
||||
pbTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols"
|
||||
@@ -120,7 +121,7 @@ type agent interface {
|
||||
|
||||
// onlineCPUMem will online CPUs and Memory inside the Sandbox.
|
||||
// This function should be called after hot adding vCPUs or Memory.
|
||||
// cpus specifies the number of CPUs that were added and the agent should online
|
||||
// cpus specifies the number of CPUs that should be onlined in the guest, and special value 0 means agent will skip this check.
|
||||
// cpuOnly specifies that we should online cpu or online memory or both
|
||||
onlineCPUMem(ctx context.Context, cpus uint32, cpuOnly bool) error
|
||||
|
||||
|
||||
@@ -1924,7 +1924,8 @@ type OnlineCPUMemRequest struct {
|
||||
// If true the agent returns once all resources have been connected, otherwise all
|
||||
// resources are connected asynchronously and the agent returns immediately.
|
||||
Wait bool `protobuf:"varint,1,opt,name=wait,proto3" json:"wait,omitempty"`
|
||||
// NbCpus specifies the number of CPUs that were added and the agent has to online.
|
||||
// NbCpus specifies the number of CPUs that should be onlined in the guest.
|
||||
// Special value 0 means agent will skip this check.
|
||||
NbCpus uint32 `protobuf:"varint,2,opt,name=nb_cpus,json=nbCpus,proto3" json:"nb_cpus,omitempty"`
|
||||
// CpuOnly specifies whether only online CPU or not.
|
||||
CpuOnly bool `protobuf:"varint,3,opt,name=cpu_only,json=cpuOnly,proto3" json:"cpu_only,omitempty"`
|
||||
|
||||
@@ -1207,22 +1207,21 @@ func (q *qemu) StopVM(ctx context.Context, waitOnly bool) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
pids := q.GetPids()
|
||||
if len(pids) == 0 {
|
||||
return errors.New("cannot determine QEMU PID")
|
||||
}
|
||||
pid := pids[0]
|
||||
|
||||
if waitOnly {
|
||||
pids := q.GetPids()
|
||||
if len(pids) == 0 {
|
||||
return errors.New("cannot determine QEMU PID")
|
||||
}
|
||||
|
||||
pid := pids[0]
|
||||
|
||||
err := utils.WaitLocalProcess(pid, qemuStopSandboxTimeoutSecs, syscall.Signal(0), q.Logger())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
err := q.qmpMonitorCh.qmp.ExecuteQuit(q.qmpMonitorCh.ctx)
|
||||
err = syscall.Kill(pid, syscall.SIGKILL)
|
||||
if err != nil {
|
||||
q.Logger().WithError(err).Error("Fail to execute qmp QUIT")
|
||||
q.Logger().WithError(err).Error("Fail to send SIGKILL to qemu")
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2131,9 +2131,8 @@ func (s *Sandbox) updateResources(ctx context.Context) error {
|
||||
s.Logger().Debugf("Request to hypervisor to update oldCPUs/newCPUs: %d/%d", oldCPUs, newCPUs)
|
||||
// If the CPUs were increased, ask agent to online them
|
||||
if oldCPUs < newCPUs {
|
||||
vcpusAdded := newCPUs - oldCPUs
|
||||
s.Logger().Debugf("Request to onlineCPUMem with %d CPUs", vcpusAdded)
|
||||
if err := s.agent.onlineCPUMem(ctx, vcpusAdded, true); err != nil {
|
||||
s.Logger().Debugf("Request to onlineCPUMem with %d CPUs", newCPUs)
|
||||
if err := s.agent.onlineCPUMem(ctx, newCPUs, true); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,16 +186,11 @@ func (v *virtiofsd) args(FdSocketNumber uint) ([]string, error) {
|
||||
// Send logs to syslog
|
||||
"--syslog",
|
||||
// cache mode for virtiofsd
|
||||
"-o", "cache=" + v.cache,
|
||||
// disable posix locking in daemon: bunch of basic posix locks properties are broken
|
||||
// apt-get update is broken if enabled
|
||||
"-o", "no_posix_lock",
|
||||
"--cache=" + v.cache,
|
||||
// shared directory tree
|
||||
"-o", "source=" + v.sourcePath,
|
||||
"--shared-dir=" + v.sourcePath,
|
||||
// fd number of vhost-user socket
|
||||
fmt.Sprintf("--fd=%v", FdSocketNumber),
|
||||
// foreground operation
|
||||
"-f",
|
||||
}
|
||||
|
||||
if len(v.extraArgs) != 0 {
|
||||
|
||||
@@ -79,12 +79,12 @@ func TestVirtiofsdArgs(t *testing.T) {
|
||||
cache: "none",
|
||||
}
|
||||
|
||||
expected := "--syslog -o cache=none -o no_posix_lock -o source=/run/kata-shared/foo --fd=123 -f"
|
||||
expected := "--syslog --cache=none --shared-dir=/run/kata-shared/foo --fd=123"
|
||||
args, err := v.args(123)
|
||||
assert.NoError(err)
|
||||
assert.Equal(expected, strings.Join(args, " "))
|
||||
|
||||
expected = "--syslog -o cache=none -o no_posix_lock -o source=/run/kata-shared/foo --fd=456 -f"
|
||||
expected = "--syslog --cache=none --shared-dir=/run/kata-shared/foo --fd=456"
|
||||
args, err = v.args(456)
|
||||
assert.NoError(err)
|
||||
assert.Equal(expected, strings.Join(args, " "))
|
||||
|
||||
@@ -293,7 +293,7 @@ func (v *VM) AddMemory(ctx context.Context, numMB uint32) error {
|
||||
// OnlineCPUMemory puts the hotplugged CPU and memory online.
|
||||
func (v *VM) OnlineCPUMemory(ctx context.Context) error {
|
||||
v.logger().Infof("online CPU %d and memory", v.cpuDelta)
|
||||
err := v.agent.onlineCPUMem(ctx, v.cpuDelta, false)
|
||||
err := v.agent.onlineCPUMem(ctx, v.cpu, false)
|
||||
if err == nil {
|
||||
v.cpuDelta = 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user