Skip to content

Commit

Permalink
cfgen: disable senpai on host with rotational root disk
Browse files Browse the repository at this point in the history
Summary:
1. adding a method to `Node` so that we can check if the root block device is ssd or not.
2. update oomd cfgen logic to disable senpai when root disk is hdd.

Differential Revision: D57678416

fbshipit-source-id: 1f69d94db7219201172f3b50e86b78ebadc4adf9
  • Loading branch information
Chengxiong Ruan authored and facebook-github-bot committed May 24, 2024
1 parent 79f9a3e commit a4aa0bc
Show file tree
Hide file tree
Showing 10 changed files with 939 additions and 14 deletions.
18 changes: 9 additions & 9 deletions src/oomd/cfgen/src/cfgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ fn oomd_json(node: &Node) -> json::JsonValue {
HostType::OnDemand => od_json_config(&attrs),
_ => default_json_config(&attrs),
}
// TODO(chengxiong) add other templates
}

fn oomd_dropin(node: &Node) -> Dropin {
Expand Down Expand Up @@ -44,7 +43,6 @@ fn default_json_config(attrs: &ConfigParams) -> json::JsonValue {
rulesets.push(rule_senpai_drop_in_ruleset(attrs));
rulesets.push(rule_tw_container_drop_in_ruleset(attrs));

// TODO(chengxiong): add more rule sections
json::object! {
"rulesets": rulesets,
"version": CONFIG_VERSION,
Expand Down Expand Up @@ -731,9 +729,8 @@ fn oomd2_oomd_restart_threshold() -> BTreeMap<String, OomdRestartThreshold> {
}
}

fn on_ssd(_node: &Node) -> bool {
true
// TODO(chengxiong): add this logic https://fburl.com/code/dqdu7ves
fn on_ssd(node: &Node) -> bool {
node.has_ssd_root()
}

fn io_latency_supported(_node: &Node) -> bool {
Expand Down Expand Up @@ -783,7 +780,7 @@ fn fbtax2_blacklisted_jobs(node: &Node) -> Vec<&'static str> {
}

fn senpai_targets(node: &Node) -> Option<String> {
if get_host_type(node) == HostType::TwShared {
if should_enable_senpai(node) {
return Some(String::from(
"system.slice,workload.slice/workload-wdb.slice,hostcritical.slice,workload.slice/workload-wdb.slice/*,hostcritical.slice/*",
));
Expand Down Expand Up @@ -816,13 +813,16 @@ fn disable_senpai_dropin(node: &Node) -> bool {
false
}

fn should_enable_senpai(node: &Node) -> bool {
get_host_type(node) == HostType::TwShared && on_ssd(node)
}

fn get_host_type(node: &Node) -> HostType {
// TODO(chengxiong): add logic to determine host types.
if node.hostname_prefix() == "twshared".into() {
if node.hostname_prefix() == TWSHARED {
return HostType::TwShared;
}

if node.hostname_prefix() == "od".into() {
if node.hostname_prefix() == OD {
return HostType::OnDemand;
}

Expand Down
5 changes: 3 additions & 2 deletions src/oomd/cfgen/test/cfgen_test_inputs/devvm.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@generated SignedSource<<a0b9ff8a6a1b096881c6f45b66fb9c8e>>
@generated SignedSource<<fc0baf1e6e709eabf64b1a0cb966db9e>>
@codegen-command arc cfgen update-inputs fb-oomd
{
"fqdn": "devvm3170.cln0.facebook.com",
Expand Down Expand Up @@ -45,7 +45,8 @@
"driver": "virtio_net",
"driver_version": "1.0.0",
"firmware_version": "",
"bus_info": "0000:00:02.0"
"bus_info": "0000:00:02.0",
"speed_mbps": 0
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
@generated SignedSource<<4e1840d2c3dc9925b88a8f546af46041>>
@codegen-command arc cfgen update-inputs fb-oomd
{
"fqdn": "twshared44829.07.ash9.facebook.com",
"region": "east",
"clusterType": "SERVICE_GENERIC_NON_MEMCACHE",
"modelId": 333245,
"kernelRelease": "5.12.0-0_fbk13_clang_7455_gb24de3bdb045",
"serverType": "TYPE_VI_FEED",
"experiments": [],
"cpuArchitecture": "skylake",
"metalosRootfs": false,
"provisioningConfig": {
"ethtoolByInterface": {
"eth0": {
"maxChannelsCombined": 128,
"maxChannelsRx": 64,
"maxChannelsTx": 64
}
},
"cpuCoreCount": 40,
"parentModelId": 336939,
"recoveryEnvironment": false,
"deviceType": "SERVER",
"datacenter": "ash9",
"cluster": "07",
"memTotal": 270023245824,
"osVersion": {
"distribution_name": "CentOS Stream release",
"version": 9,
"is_in_ramdisk": false,
"is_metalos": false
},
"pciByAddress": {
"0000:5e:00.0": {
"vendor_id": 5348,
"device_id": 5833,
"class_code": 131072,
"board_part_number": "BCM957302M3023CBK"
}
},
"static_smc_tiers": [],
"machine": "x86_64"
},
"bootConfig": {
"ethtoolByInterface": {
"eth0": {
"driver": "bnxt_en",
"driver_version": "5.12.0-0_fbk13_clang_7455_gb24d",
"firmware_version": "20.6.167.0/pkg 20.6.4.12",
"bus_info": "0000:5e:00.0"
}
}
},
"runtimeConfig": {
"hasHighPrivCert": true,
"regionRoutableCluster": "ash9.02",
"block_devices": {
"block_devices": {
"nvme0n1": {
"size_bytes": 1800360124416,
"is_rotational": false,
"model": "SAMSUNG MZ1LB1T9HALS-000FB",
"serial": "S4JTNA0M941126",
"physical_block_size": 4096,
"logical_block_size": 4096,
"is_root": false
},
"sda": {
"size_bytes": 2000398934016,
"is_rotational": true,
"model": "ST2000NM0008-2F3100",
"serial": "ZDS16SA4",
"physical_block_size": 512,
"logical_block_size": 512,
"is_root": true
}
}
},
"dynamic_smc_tiers": [],
"cluster_state": "CLUSTER_IN_USE",
"installed_platforms": [
"platform009",
"platform010",
"platform010-aarch64",
"platform010-compat"
],
"device_nics_enum": [
"ETH0",
"SVC0"
]
},
"reservationConfig": {
"active_machine_materialization_id": "6321b66383934",
"current_reservation_host_profile_id": "COMMON:NO_CPU_CONTROLLER|KERNEL:kernel_5.12.0-0_fbk13_clang_7455_gb24de3bdb045_base.v8|STORAGE:XFS_FULL|RUNTIME:DATASTORES_GENERIC_SYSCTLS|KERNEL_ARGS:kargs_default.v2|KERNEL_POLICY:KERNEL_POLICY_DATABASES|BOOT_CONFIG:bootloader814_initrd230_swap16G_native_arch"
}
}
Loading

0 comments on commit a4aa0bc

Please sign in to comment.