Skip to content

Commit

Permalink
add condition for xfs
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek Cherath committed Jan 5, 2024
1 parent 0282aad commit 4f2996d
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions plane/src/drone/docker/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,23 @@ mod tests {
)?;

executor_config.resource_limits = resource_limits;
match docker.info().await?.driver {
Some(t) if matches!(t.as_str(), "btrfs" | "zfs" | "overlay2") => {}
let info = docker.info().await?;
match info.driver {
Some(t) if matches!(t.as_str(), "btrfs" | "zfs") => {}
Some(t)
if t == "overlay2" && {
let fs_ok;
if let Some(status) = info.driver_status {
fs_ok = !status.iter().flatten().any(|s| s.contains("xfs"));
} else {
fs_ok = false
};
!fs_ok
} =>
{
//disk limits not supported with xfs backend for overlay 2
executor_config.resource_limits.disk_limit_bytes = None;
}
_ => {
//disk limits not supported otherwise
executor_config.resource_limits.disk_limit_bytes = None;
Expand Down Expand Up @@ -308,14 +323,10 @@ mod tests {

//unfortunately, the docker disk limit is dependent on the storage backend
//hence just validating here that config is as expected.
let size = config
.host_config
.unwrap()
.storage_opt
.unwrap()
.get("size")
.cloned();
assert_eq!(size, Some("10000000000".to_string()));
config.host_config.unwrap().storage_opt.map(|hm| {
let size = hm.get("size").cloned();
assert_eq!(size, Some("10000000000".to_string()));
});

Ok(())
}
Expand Down

0 comments on commit 4f2996d

Please sign in to comment.