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

Update Rust 1.66 #1444

Merged
merged 1 commit into from
Dec 25, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/containerd_integration_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: '1.65.0'
toolchain: '1.66.0'
override: true
- name: Cache youki
uses: Swatinem/rust-cache@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration_tests_validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
rust: [1.64.0, 1.65.0]
rust: [1.65.0, 1.66.0]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
rust: [1.64.0, 1.65.0]
rust: [1.65.0, 1.66.0]
dirs: ${{ fromJSON(needs.changes.outputs.dirs) }}
steps:
- uses: actions/checkout@v3
Expand All @@ -55,7 +55,7 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
rust: [1.64.0, 1.65.0]
rust: [1.65.0, 1.66.0]
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -107,7 +107,7 @@ jobs:
timeout-minutes: 15
strategy:
matrix:
rust: [1.64.0, 1.65.0]
rust: [1.65.0, 1.66.0]
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion crates/libcgroups/src/systemd/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ impl Manager {
}

let mut controllers = Vec::new();
for controller in fs::read_to_string(&controllers_path)?.split_whitespace() {
for controller in fs::read_to_string(controllers_path)?.split_whitespace() {
match controller {
"cpu" => controllers.push(ControllerType::Cpu),
"memory" => controllers.push(ControllerType::Memory),
Expand Down
10 changes: 5 additions & 5 deletions crates/libcgroups/src/v1/blkio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ impl Blkio {
if cgroup_file.exists() {
common::write_cgroup_file(&cgroup_file, blkio_weight)?;
} else {
common::write_cgroup_file(&root_path.join(BLKIO_BFQ_WEIGHT), blkio_weight)?;
common::write_cgroup_file(root_path.join(BLKIO_BFQ_WEIGHT), blkio_weight)?;
}
}
}

if let Some(throttle_read_bps_device) = blkio.throttle_read_bps_device().as_ref() {
for trbd in throttle_read_bps_device {
common::write_cgroup_file_str(
&root_path.join(BLKIO_THROTTLE_READ_BPS),
root_path.join(BLKIO_THROTTLE_READ_BPS),
&format!("{}:{} {}", trbd.major(), trbd.minor(), trbd.rate()),
)?;
}
Expand All @@ -132,7 +132,7 @@ impl Blkio {
if let Some(throttle_write_bps_device) = blkio.throttle_write_bps_device().as_ref() {
for twbd in throttle_write_bps_device {
common::write_cgroup_file_str(
&root_path.join(BLKIO_THROTTLE_WRITE_BPS),
root_path.join(BLKIO_THROTTLE_WRITE_BPS),
&format!("{}:{} {}", twbd.major(), twbd.minor(), twbd.rate()),
)?;
}
Expand All @@ -141,7 +141,7 @@ impl Blkio {
if let Some(throttle_read_iops_device) = blkio.throttle_read_iops_device().as_ref() {
for trid in throttle_read_iops_device {
common::write_cgroup_file_str(
&root_path.join(BLKIO_THROTTLE_READ_IOPS),
root_path.join(BLKIO_THROTTLE_READ_IOPS),
&format!("{}:{} {}", trid.major(), trid.minor(), trid.rate()),
)?;
}
Expand All @@ -150,7 +150,7 @@ impl Blkio {
if let Some(throttle_write_iops_device) = blkio.throttle_write_iops_device().as_ref() {
for twid in throttle_write_iops_device {
common::write_cgroup_file_str(
&root_path.join(BLKIO_THROTTLE_WRITE_IOPS),
root_path.join(BLKIO_THROTTLE_WRITE_IOPS),
&format!("{}:{} {}", twid.major(), twid.minor(), twid.rate()),
)?;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/libcgroups/src/v1/cpuacct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ mod tests {

CpuAcct::add_task(pid, &tmp).expect("apply cpuacct");

let content = fs::read_to_string(&procs)
let content = fs::read_to_string(procs)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_PROCS));
assert_eq!(content, "1000");
}
Expand Down
4 changes: 2 additions & 2 deletions crates/libcgroups/src/v1/cpuset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ mod tests {
CpuSet::apply(&tmp, &cpuset).expect("apply cpuset");

// assert
let content = fs::read_to_string(&cpus)
let content = fs::read_to_string(cpus)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPUSET_CPUS));
assert_eq!(content, "1-3");
}
Expand All @@ -127,7 +127,7 @@ mod tests {
CpuSet::apply(&tmp, &cpuset).expect("apply cpuset");

// assert
let content = fs::read_to_string(&mems)
let content = fs::read_to_string(mems)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPUSET_MEMS));
assert_eq!(content, "1-3");
}
Expand Down
2 changes: 1 addition & 1 deletion crates/libcgroups/src/v1/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ impl CgroupManager for Manager {
if cgroup_path.1.exists() {
log::debug!("remove cgroup {:?}", cgroup_path.1);
let procs_path = cgroup_path.1.join(CGROUP_PROCS);
let procs = fs::read_to_string(&procs_path)?;
let procs = fs::read_to_string(procs_path)?;

for line in procs.lines() {
let pid: i32 = line.parse()?;
Expand Down
2 changes: 1 addition & 1 deletion crates/libcgroups/src/v1/perf_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mod tests {

PerfEvent::add_task(pid, &tmp).expect("apply perf_event");

let content = fs::read_to_string(&procs)
let content = fs::read_to_string(procs)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_PROCS));
assert_eq!(content, "1000");
}
Expand Down
2 changes: 1 addition & 1 deletion crates/libcgroups/src/v1/pids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Pids {
"max".to_string()
};

common::write_cgroup_file_str(&root_path.join(CGROUP_PIDS_MAX), &limit)?;
common::write_cgroup_file_str(root_path.join(CGROUP_PIDS_MAX), &limit)?;
Ok(())
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/libcgroups/src/v2/cpuset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ mod tests {
CpuSet::apply(&tmp, &cpuset).expect("apply cpuset");

// assert
let content = fs::read_to_string(&cpus)
let content = fs::read_to_string(cpus)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPUSET_CPUS));
assert_eq!(content, "1-3");
}
Expand All @@ -75,7 +75,7 @@ mod tests {
CpuSet::apply(&tmp, &cpuset).expect("apply cpuset");

// assert
let content = fs::read_to_string(&mems)
let content = fs::read_to_string(mems)
.unwrap_or_else(|_| panic!("read {} file content", CGROUP_CPUSET_MEMS));
assert_eq!(content, "1-3");
}
Expand Down
4 changes: 2 additions & 2 deletions crates/libcgroups/src/v2/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl Io {
for wd in weight_device {
common::write_cgroup_file(
root_path.join(CGROUP_BFQ_IO_WEIGHT),
&format!("{}:{} {}", wd.major(), wd.minor(), wd.weight().unwrap()),
format!("{}:{} {}", wd.major(), wd.minor(), wd.weight().unwrap()),
)?;
}
}
Expand Down Expand Up @@ -131,7 +131,7 @@ impl Io {
for trbd in throttle_read_bps_device {
common::write_cgroup_file(
Self::io_max_path(root_path),
&format!("{}:{} rbps={}", trbd.major(), trbd.minor(), trbd.rate()),
format!("{}:{} rbps={}", trbd.major(), trbd.minor(), trbd.rate()),
)?;
}
}
Expand Down
4 changes: 2 additions & 2 deletions crates/libcgroups/src/v2/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Manager {
}
}

common::write_cgroup_file(&self.full_path.join(CGROUP_PROCS), pid)?;
common::write_cgroup_file(self.full_path.join(CGROUP_PROCS), pid)?;
Ok(())
}

Expand Down Expand Up @@ -135,7 +135,7 @@ impl CgroupManager for Manager {
fs::write(kill_file, "1").context("failed to kill cgroup")?;
} else {
let procs_path = self.full_path.join(CGROUP_PROCS);
let procs = fs::read_to_string(&procs_path)?;
let procs = fs::read_to_string(procs_path)?;

for line in procs.lines() {
let pid: i32 = line.parse()?;
Expand Down
2 changes: 1 addition & 1 deletion crates/libcgroups/src/v2/pids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Pids {
} else {
"max".to_string()
};
common::write_cgroup_file(&root_path.join("pids.max"), &limit)
common::write_cgroup_file(root_path.join("pids.max"), limit)
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/container/container_checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Container {
// mounts can change and CRIU will just mount whatever we tell it to mount based on
// information found in 'config.json'.
let source_spec_path = self.bundle().join("config.json");
let spec = Spec::load(&source_spec_path)?;
let spec = Spec::load(source_spec_path)?;
let mounts = spec.mounts().clone();
for m in mounts.unwrap() {
match m.typ().as_deref() {
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/container/container_start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Container {

unistd::chdir(self.root.as_os_str())?;

let mut notify_socket = NotifySocket::new(&self.root.join(NOTIFY_FILE));
let mut notify_socket = NotifySocket::new(self.root.join(NOTIFY_FILE));
notify_socket.notify_container_start()?;
self.set_status(ContainerStatus::Running)
.save()
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/container/init_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl<'a> InitContainerBuilder<'a> {

fn load_spec(&self) -> Result<Spec> {
let source_spec_path = self.bundle.join("config.json");
let mut spec = Spec::load(&source_spec_path)?;
let mut spec = Spec::load(source_spec_path)?;
Self::validate_spec(&spec).context("failed to validate runtime spec")?;

spec.canonicalize_rootfs(&self.bundle)
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/container/tenant_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl<'a> TenantContainerBuilder<'a> {

fn setup_notify_listener(container_dir: &Path) -> Result<PathBuf> {
let notify_name = Self::generate_name(container_dir, TENANT_NOTIFY);
let socket_path = container_dir.join(&notify_name);
let socket_path = container_dir.join(notify_name);

Ok(socket_path)
}
Expand Down
4 changes: 2 additions & 2 deletions crates/libcontainer/src/process/container_main_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ mod tests {

let tempdir = TempDir::new(get_gid_path(&child).parent().unwrap())?;
let gid_map_path = tempdir.join("gid_map");
let _ = fs::File::create(&gid_map_path)?;
let _ = fs::File::create(gid_map_path)?;

setup_mapping(&rootless, child)?;
let line = fs::read_to_string(uid_map_path)?;
Expand Down Expand Up @@ -290,7 +290,7 @@ mod tests {

let tempdir = TempDir::new(get_uid_path(&child).parent().unwrap())?;
let uid_map_path = tempdir.join("uid_map");
let _ = fs::File::create(&uid_map_path)?;
let _ = fs::File::create(uid_map_path)?;

let tempdir = TempDir::new(get_gid_path(&child).parent().unwrap())?;
let gid_map_path = tempdir.join("gid_map");
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/rootfs/symlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ mod tests {
let cpu = tmp.join("cpu");
let cpuacct = tmp.join("cpuacct");
let cpu_cpuacct = tmp.join("cpu,cpuacct");
fs::create_dir_all(&cpu_cpuacct)?;
fs::create_dir_all(cpu_cpuacct)?;
let symlink = Symlink::with_syscall(Box::new(LinuxSyscall));

// act
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/syscall/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub trait Syscall {

pub fn create_syscall() -> Box<dyn Syscall> {
if cfg!(test) {
Box::new(TestHelperSyscall::default())
Box::<TestHelperSyscall>::default()
} else {
Box::new(LinuxSyscall)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/tty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn setup_console_socket(
socket_name: &str,
) -> Result<RawFd> {
let linked = container_dir.join(socket_name);
symlink(console_socket_path, &linked)?;
symlink(console_socket_path, linked)?;

let mut csocketfd = socket::socket(
socket::AddressFamily::Unix,
Expand Down
2 changes: 1 addition & 1 deletion crates/libcontainer/src/workload/wasmedge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl Executor for WasmEdgeExecutor {
None,
);

let mut vm = vm.register_module_from_file("main", &cmd)?;
let mut vm = vm.register_module_from_file("main", cmd)?;

let ins = vm.named_module("main")?;
ins.func("_start")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fn check_readonly_paths() -> TestResult {

let ro_paths = vec![
root.join(&ro_dir_top).to_string_lossy().to_string(),
root.join(&ro_file_top).to_string_lossy().to_string(),
root.join(ro_file_top).to_string_lossy().to_string(),
root.join(&ro_dir_sub).to_string_lossy().to_string(),
root.join(&ro_file_sub).to_string_lossy().to_string(),
root.join(&ro_file_sub_sub).to_string_lossy().to_string(),
Expand All @@ -75,23 +75,23 @@ fn check_readonly_paths() -> TestResult {
}

let test_sub_sub_file = bundle_path.join(&ro_file_sub_sub);
match fs::File::create(&test_sub_sub_file) {
match fs::File::create(test_sub_sub_file) {
io::Result::Ok(_) => { /*This is expected*/ }
io::Result::Err(e) => {
bail!(e)
}
}

let test_sub_file = bundle_path.join(&ro_file_sub);
match fs::File::create(&test_sub_file) {
match fs::File::create(test_sub_file) {
io::Result::Ok(_) => { /*This is expected*/ }
io::Result::Err(e) => {
bail!(e)
}
}

let test_file = bundle_path.join(ro_file);
match fs::File::create(&test_file) {
match fs::File::create(test_file) {
io::Result::Ok(_) => { /*This is expected*/ }
io::Result::Err(e) => {
bail!(e)
Expand Down Expand Up @@ -155,7 +155,7 @@ fn check_readonly_symlinks() -> TestResult {
}
};

match fs::metadata(&r_path) {
match fs::metadata(r_path) {
io::Result::Ok(md) => {
bail!(
"reading symlink for {:?} should have given error, found {:?} instead",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ fn get_tlb_sizes() -> Vec<String> {
fn validate_tlb(id: &str, size: &str, limit: i64) -> TestResult {
let root = "/sys/fs/cgroup/hugetlb";
let path = format!("{}/{}/hugetlb.{}.limit_in_bytes", root, id, size);
let val_str = std::fs::read_to_string(&path).unwrap();
let val_str = std::fs::read_to_string(path).unwrap();
let val: i64 = val_str.trim().parse().unwrap();
if val == limit {
TestResult::Passed
Expand Down