Merge pull request #6275 from amshinde/stable-3.0-backports

stable-3.0: Stable 3.0 backports
This commit is contained in:
Archana Shinde 2023-02-14 14:28:04 -08:00 committed by GitHub
commit 69e681961a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 10 deletions

7
src/agent/Cargo.lock generated
View File

@ -686,6 +686,7 @@ dependencies = [
"tracing-subscriber", "tracing-subscriber",
"ttrpc", "ttrpc",
"vsock-exporter", "vsock-exporter",
"which",
] ]
[[package]] [[package]]
@ -2172,13 +2173,13 @@ checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be"
[[package]] [[package]]
name = "which" name = "which"
version = "4.2.5" version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c4fb54e6113b6a8772ee41c3404fb0301ac79604489467e0a9ce1f3e97c24ae" checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b"
dependencies = [ dependencies = [
"either", "either",
"lazy_static",
"libc", "libc",
"once_cell",
] ]
[[package]] [[package]]

View File

@ -69,6 +69,7 @@ clap = { version = "3.0.1", features = ["derive"] }
[dev-dependencies] [dev-dependencies]
tempfile = "3.1.0" tempfile = "3.1.0"
test-utils = { path = "../libs/test-utils" } test-utils = { path = "../libs/test-utils" }
which = "4.3.0"
[workspace] [workspace]
members = [ members = [

View File

@ -2032,6 +2032,11 @@ mod tests {
use tempfile::{tempdir, TempDir}; use tempfile::{tempdir, TempDir};
use test_utils::{assert_result, skip_if_not_root}; use test_utils::{assert_result, skip_if_not_root};
use ttrpc::{r#async::TtrpcContext, MessageHeader}; use ttrpc::{r#async::TtrpcContext, MessageHeader};
use which::which;
fn check_command(cmd: &str) -> bool {
which(cmd).is_ok()
}
fn mk_ttrpc_context() -> TtrpcContext { fn mk_ttrpc_context() -> TtrpcContext {
TtrpcContext { TtrpcContext {
@ -2751,6 +2756,18 @@ OtherField:other
async fn test_ip_tables() { async fn test_ip_tables() {
skip_if_not_root!(); skip_if_not_root!();
if !check_command(IPTABLES_SAVE)
|| !check_command(IPTABLES_RESTORE)
|| !check_command(IP6TABLES_SAVE)
|| !check_command(IP6TABLES_RESTORE)
{
warn!(
sl!(),
"one or more commands for ip tables test are missing, skip it"
);
return;
}
let logger = slog::Logger::root(slog::Discard, o!()); let logger = slog::Logger::root(slog::Discard, o!());
let sandbox = Sandbox::new(&logger).unwrap(); let sandbox = Sandbox::new(&logger).unwrap();
let agent_service = Box::new(AgentService { let agent_service = Box::new(AgentService {

View File

@ -32,7 +32,7 @@ use regex::RegexSet;
use super::{default, ConfigOps, ConfigPlugin, TomlConfig}; use super::{default, ConfigOps, ConfigPlugin, TomlConfig};
use crate::annotations::KATA_ANNO_CFG_HYPERVISOR_PREFIX; use crate::annotations::KATA_ANNO_CFG_HYPERVISOR_PREFIX;
use crate::{eother, resolve_path, validate_path}; use crate::{eother, resolve_path, sl, validate_path};
mod dragonball; mod dragonball;
pub use self::dragonball::{DragonballConfig, HYPERVISOR_NAME_DRAGONBALL}; pub use self::dragonball::{DragonballConfig, HYPERVISOR_NAME_DRAGONBALL};
@ -830,6 +830,10 @@ impl SharedFsInfo {
if self.virtio_fs_cache.is_empty() { if self.virtio_fs_cache.is_empty() {
self.virtio_fs_cache = default::DEFAULT_VIRTIO_FS_CACHE_MODE.to_string(); self.virtio_fs_cache = default::DEFAULT_VIRTIO_FS_CACHE_MODE.to_string();
} }
if self.virtio_fs_cache == *"none" {
warn!(sl!(), "virtio-fs cache mode `none` is deprecated since Kata Containers 2.5.0 and will be removed in the future release, please use `never` instead. For more details please refer to https://github.com/kata-containers/kata-containers/issues/4234.");
self.virtio_fs_cache = default::DEFAULT_VIRTIO_FS_CACHE_MODE.to_string();
}
if self.virtio_fs_is_dax && self.virtio_fs_cache_size == 0 { if self.virtio_fs_is_dax && self.virtio_fs_cache_size == 0 {
self.virtio_fs_cache_size = default::DEFAULT_VIRTIO_FS_DAX_SIZE_MB; self.virtio_fs_cache_size = default::DEFAULT_VIRTIO_FS_DAX_SIZE_MB;
} }

View File

@ -120,10 +120,12 @@ func watchSandbox(ctx context.Context, s *service) {
if err == nil { if err == nil {
return return
} }
s.monitor = nil
s.mu.Lock() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
s.monitor = nil
// sandbox malfunctioning, cleanup as much as we can // sandbox malfunctioning, cleanup as much as we can
shimLog.WithError(err).Warn("sandbox stopped unexpectedly") shimLog.WithError(err).Warn("sandbox stopped unexpectedly")
err = s.sandbox.Stop(ctx, true) err = s.sandbox.Stop(ctx, true)

View File

@ -651,9 +651,6 @@ func (clh *cloudHypervisor) StartVM(ctx context.Context, timeout int) error {
span, _ := katatrace.Trace(ctx, clh.Logger(), "StartVM", clhTracingTags, map[string]string{"sandbox_id": clh.id}) span, _ := katatrace.Trace(ctx, clh.Logger(), "StartVM", clhTracingTags, map[string]string{"sandbox_id": clh.id})
defer span.End() defer span.End()
ctx, cancel := context.WithTimeout(context.Background(), clh.getClhAPITimeout()*time.Second)
defer cancel()
clh.Logger().WithField("function", "StartVM").Info("starting Sandbox") clh.Logger().WithField("function", "StartVM").Info("starting Sandbox")
vmPath := filepath.Join(clh.config.VMStorePath, clh.id) vmPath := filepath.Join(clh.config.VMStorePath, clh.id)
@ -692,6 +689,9 @@ func (clh *cloudHypervisor) StartVM(ctx context.Context, timeout int) error {
} }
clh.state.PID = pid clh.state.PID = pid
ctx, cancel := context.WithTimeout(ctx, clh.getClhAPITimeout()*time.Second)
defer cancel()
if err := clh.bootVM(ctx); err != nil { if err := clh.bootVM(ctx); err != nil {
return err return err
} }

View File

@ -261,7 +261,7 @@ func (q *qemuAmd64) appendProtectionDevice(devices []govmmQemu.Device, firmware,
Debug: false, Debug: false,
File: firmware, File: firmware,
CBitPos: cpuid.AMDMemEncrypt.CBitPosition, CBitPos: cpuid.AMDMemEncrypt.CBitPosition,
ReducedPhysBits: cpuid.AMDMemEncrypt.PhysAddrReduction, ReducedPhysBits: 1,
}), "", nil }), "", nil
case noneProtection: case noneProtection:
return devices, firmware, nil return devices, firmware, nil

View File

@ -287,7 +287,7 @@ func TestQemuAmd64AppendProtectionDevice(t *testing.T) {
Debug: false, Debug: false,
File: firmware, File: firmware,
CBitPos: cpuid.AMDMemEncrypt.CBitPosition, CBitPos: cpuid.AMDMemEncrypt.CBitPosition,
ReducedPhysBits: cpuid.AMDMemEncrypt.PhysAddrReduction, ReducedPhysBits: 1,
}, },
} }

View File

@ -57,6 +57,7 @@ init_env() {
LIBC="gnu" LIBC="gnu"
ARCH="powerpc64le" ARCH="powerpc64le"
ARCH_LIBC=${ARCH}-linux-${LIBC} ARCH_LIBC=${ARCH}-linux-${LIBC}
extra_rust_flags=""
;; ;;
"s390x") "s390x")
LIBC="gnu" LIBC="gnu"