fix7: продакшен-реализация полного reconcile swap и интеграций
- Полностью переписан swap-модуль в режиме exclusive ownership\n- Добавлены verify/checks, статус фактического swap-state и drift\n- Интегрирован ensure-swap в daemon и systemd ExecStartPre\n- Усилен lock API (таймауты) и применение в traffic/firewall/swap\n- Усилен parser firewall (JSON-first + устойчивый text fallback)\n- Обновлены config validation, runtime tools и default priority\n- Синхронизированы docs и build/package hygiene\n- Удалены member Cargo.lock в пользу корневого lockfile
This commit is contained in:
+48
-12
@@ -1,4 +1,4 @@
|
||||
use crate::{config::Config, docker, firewall, netns::build_transport, traffic, wg};
|
||||
use crate::{config::Config, docker, firewall, netns::build_transport, swap, traffic, wg};
|
||||
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
@@ -183,12 +183,7 @@ pub fn print_status(cfg: &Config) -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
println!("Swap:");
|
||||
println!(" enabled: {}", cfg.swap.enabled);
|
||||
println!(" path: {}", cfg.swap.path);
|
||||
println!(" size_mb: {}", cfg.swap.size_mb);
|
||||
println!(" priority: {}", cfg.swap.priority);
|
||||
println!(" swappiness: {}", cfg.swap.swappiness);
|
||||
print_swap_status(cfg);
|
||||
|
||||
let ct_count = Command::new("sysctl")
|
||||
.args(["-n", "net.netfilter.nf_conntrack_count"])
|
||||
@@ -265,11 +260,7 @@ fn print_degraded_sections(cfg: &Config) -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
println!("Swap:");
|
||||
println!(" enabled: {}", cfg.swap.enabled);
|
||||
println!(" path: {}", cfg.swap.path);
|
||||
println!(" size_mb: {}", cfg.swap.size_mb);
|
||||
println!(" priority: {}", cfg.swap.priority);
|
||||
print_swap_status(cfg);
|
||||
|
||||
println!("Conntrack:");
|
||||
let ct_count = Command::new("sysctl")
|
||||
@@ -336,6 +327,51 @@ fn print_reboot_section(cfg: &Config) {
|
||||
}
|
||||
}
|
||||
|
||||
fn print_swap_status(cfg: &Config) {
|
||||
println!("Swap:");
|
||||
match swap::inspect_swap(cfg) {
|
||||
Ok(s) => {
|
||||
println!(" enabled: {}", s.enabled);
|
||||
println!(" desired_path: {}", s.desired_path.display());
|
||||
println!(" desired_size_mb: {}", cfg.swap.size_mb);
|
||||
println!(" desired_priority: {}", cfg.swap.priority);
|
||||
println!(" active_entries: {}", s.active_entries.len());
|
||||
println!(
|
||||
" desired_active: {}",
|
||||
if s.desired_active { "yes" } else { "no" }
|
||||
);
|
||||
println!(" exclusive: {}", if s.exclusive { "yes" } else { "no" });
|
||||
println!(
|
||||
" fstab_exclusive: {}",
|
||||
if s.fstab_exclusive { "yes" } else { "no" }
|
||||
);
|
||||
println!(
|
||||
" swappiness_current: {}",
|
||||
s.current_swappiness
|
||||
.map(|v| v.to_string())
|
||||
.unwrap_or_else(|| "n/a".to_string())
|
||||
);
|
||||
println!(
|
||||
" swappiness_persisted: {}",
|
||||
s.persisted_swappiness
|
||||
.map(|v| v.to_string())
|
||||
.unwrap_or_else(|| "n/a".to_string())
|
||||
);
|
||||
if let Some(reason) = s.drift_reason {
|
||||
println!(" drift: yes");
|
||||
println!(" drift_reason: {}", reason);
|
||||
} else {
|
||||
println!(" drift: no");
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
println!(" enabled: {}", cfg.swap.enabled);
|
||||
println!(" desired_path: {}", cfg.swap.path);
|
||||
println!(" drift: unknown ({e})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn handshake_is_online(epoch: Option<u64>, threshold_secs: u64) -> &'static str {
|
||||
if let Some(ts) = epoch {
|
||||
let now = SystemTime::now()
|
||||
|
||||
Reference in New Issue
Block a user