Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust 1.80.0 #2869

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 39 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/libcgroups/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ pub struct PSIStats {
pub full: PSIData,
}

///
#[derive(Debug, Default, PartialEq, Serialize)]
pub struct PSIData {
/// Running average over the last 10 seconds
Expand Down
1 change: 1 addition & 0 deletions crates/libcgroups/src/systemd/dbus_native/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use super::serialize::Variant;
use super::utils::SystemdClientError;

pub trait SystemdClient {
#[allow(dead_code)]
fn is_system(&self) -> bool;

fn transient_unit_exists(&self, unit_name: &str) -> bool;
Expand Down
1 change: 1 addition & 0 deletions crates/libcgroups/src/systemd/dbus_native/dbus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const REPLY_BUF_SIZE: usize = 128; // seems good enough tradeoff between extra s
// For more information see https://www.freedesktop.org/wiki/Software/systemd/dbus/
pub struct DbusConnection {
/// Is the socket system level or session specific
#[allow(dead_code)]
system: bool,
/// socket fd
socket: i32,
Expand Down
8 changes: 4 additions & 4 deletions crates/libcgroups/src/v2/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,15 @@ mod tests {
// check the limit file is set as expected
let limit_content = read_to_string(tmp.path().join(CGROUP_MEMORY_MAX)).expect("read memory limit to string");
let limit_check = match linux_memory.limit() {
Some(limit) if limit == -1 => limit_content == "max",
Some(-1) => limit_content == "max",
Some(limit) => limit_content == limit.to_string(),
None => limit_content == "0",
};

// check the swap file is set as expected
let swap_content = read_to_string(tmp.path().join(CGROUP_MEMORY_SWAP)).expect("read swap limit to string");
let swap_check = match linux_memory.swap() {
Some(swap) if swap == -1 => swap_content == "max",
Some(-1)=> swap_content == "max",
Some(swap) => {
if let Some(limit) = linux_memory.limit() {
if limit == -1 {
Expand All @@ -339,7 +339,7 @@ mod tests {
}
None => {
match linux_memory.limit() {
Some(limit) if limit == -1 => swap_content == "max",
Some(-1) => swap_content == "max",
_ => swap_content == "0",
}
}
Expand All @@ -349,7 +349,7 @@ mod tests {
// check the reservation file is set as expected
let reservation_content = read_to_string(tmp.path().join(CGROUP_MEMORY_LOW)).expect("read memory reservation to string");
let reservation_check = match linux_memory.reservation() {
Some(reservation) if reservation == -1 => reservation_content == "max",
Some(-1) => reservation_content == "max",
Some(reservation) => reservation_content == reservation.to_string(),
None => reservation_content == "0",
};
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ homepage = "https://containers.github.io/youki"
readme = "README.md"
authors = ["youki team"]
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.63.0"
keywords = ["youki", "container", "cgroups"]

[features]
Expand Down
9 changes: 2 additions & 7 deletions crates/libcontainer/src/container/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ use serde::{Deserialize, Serialize};
use tracing::instrument;

/// Indicates status of the container
#[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq)]
#[derive(Serialize, Deserialize, Debug, Copy, Clone, PartialEq, Eq, Default)]
#[serde(rename_all = "camelCase")]
pub enum ContainerStatus {
// The container is being created
#[default]
Creating,
// The runtime has finished the create operation
Created,
Expand All @@ -26,12 +27,6 @@ pub enum ContainerStatus {
Paused,
}

impl Default for ContainerStatus {
fn default() -> Self {
ContainerStatus::Creating
}
}

impl ContainerStatus {
pub fn can_start(&self) -> bool {
matches!(self, ContainerStatus::Created)
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn run_hooks(
tracing::debug!("run_hooks arg0: {:?}, args: {:?}", arg0, args);
hook_command.arg0(arg0).args(args)
} else {
hook_command.arg0(&hook.path().display().to_string())
hook_command.arg0(hook.path().display().to_string())
};

let envs: HashMap<String, String> = if let Some(env) = hook.env() {
Expand Down
4 changes: 1 addition & 3 deletions crates/libcontainer/src/notify_socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,7 @@ mod test {
move || {
// We clone the listener and listen on the cloned listener to
// make sure the cloned fd functions correctly.
let cloned_listener = listener.clone();
cloned_listener.wait_for_container_start().unwrap();
cloned_listener.close().unwrap();
listener.wait_for_container_start().unwrap();
}
});

Expand Down
1 change: 1 addition & 0 deletions crates/libcontainer/src/rootfs/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type Result<T> = std::result::Result<T, MountError>;
pub struct MountOptions<'a> {
pub root: &'a Path,
pub label: Option<&'a str>,
#[allow(dead_code)]
pub cgroup_ns: bool,
}

Expand Down
2 changes: 1 addition & 1 deletion crates/youki/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ scopeguard = "1.2.0"

[build-dependencies]
anyhow = "1.0.86"
vergen = { version = "8.3.2", features = ["git", "gitcl"] }
vergen-gitcl = { version = "1.0.0", features = ["build"] }
9 changes: 4 additions & 5 deletions crates/youki/build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use anyhow::Result;
use vergen::EmitBuilder;
use vergen_gitcl::{Emitter, GitclBuilder};

fn main() -> Result<()> {
if EmitBuilder::builder()
.fail_on_error()
.git_sha(true)
pub fn main() -> Result<()> {
if Emitter::default()
.add_instructions(&GitclBuilder::all_git()?)?
.emit()
.is_err()
{
Expand Down
1 change: 1 addition & 0 deletions crates/youki/src/observability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub struct ObservabilityConfig {
pub log_level: Option<String>,
pub log_file: Option<PathBuf>,
pub log_format: Option<String>,
#[allow(dead_code)]
pub systemd_log: bool,
}

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
profile="default"
channel="1.77.2"
channel="1.80.0"
2 changes: 1 addition & 1 deletion tests/contest/contest/src/tests/mounts_recursive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ fn check_recursive_rsymfollow() -> TestResult {
/// 1. Create mount_options based on the mount properties of the test
/// 2. Create OCI.Spec content, container one process is runtimetest,(runtimetest is cargo model, file path `tests/runtimetest/`)
/// 3. inside container to check if the actual mount matches the spec, (spec https://man7.org/linux/man-pages/man2/mount_setattr.2.html),
/// eg. tests/runtimetest/src/tests.rs
/// eg. tests/runtimetest/src/tests.rs
pub fn get_mounts_recursive_test() -> TestGroup {
let rro_test = Test::new("rro_test", Box::new(check_recursive_readonly));
let rnosuid_test = Test::new("rnosuid_test", Box::new(check_recursive_nosuid));
Expand Down
Loading