Three new scripts for VM-level infrastructure management: - audit-vm-disks.sh: Audit disk cache config on all VMs across hosts - audit-guest-io.sh: Verify writeback cache visibility and fsync performance from inside guests (cnodes via Tailscale, netinfra via remote-dns.sh) - deploy-tuned-guests.sh: Deploy tuned profiles to VMs via qemu-guest-agent (template for when guest agents are deployed fleet-wide) These establish repeatable processes for VM disk/performance auditing instead of ad-hoc one-off probes. [#395] 💘 Generated with Crush Assisted-by: Crush:glm-5.2
43 lines
1.4 KiB
Bash
43 lines
1.4 KiB
Bash
#!/usr/bin/bash
|
|
# Audit VM disk cache from inside guests — confirm writeback visible + I/O perf
|
|
set -uo pipefail
|
|
source "$(cd "$(dirname "$0")/../../.." && pwd)/k8s/env.sh"
|
|
|
|
echo "=== CNODES (via Tailscale) ==="
|
|
for ip in "${ALL_CNODES[@]}"; do
|
|
echo "--- $ip ---"
|
|
# shellcheck disable=SC2016 # heredoc-style remote command uses $() on the remote side
|
|
cn "$ip" '
|
|
echo " write_cache: $(cat /sys/block/sda/queue/write_cache 2>/dev/null)"
|
|
echo " scheduler: $(cat /sys/block/sda/queue/scheduler 2>/dev/null)"
|
|
echo " fsync (5x 1KB):"
|
|
for i in 1 2 3 4 5; do
|
|
t0=$(date +%s%N)
|
|
dd if=/dev/zero of=/tmp/.ft bs=1k count=1 conv=fsync 2>/dev/null
|
|
t1=$(date +%s%N)
|
|
echo -n " $(( (t1-t0)/1000000 )) ms"
|
|
done
|
|
echo
|
|
rm -f /tmp/.ft
|
|
' 2>&1 || echo " UNREACHABLE"
|
|
done
|
|
|
|
echo ""
|
|
echo "=== DNS INFRA VMs ==="
|
|
for host in netinfra01 netinfra02; do
|
|
echo "--- $host ---"
|
|
# shellcheck disable=SC2016 # heredoc-style remote command uses $() on the remote side
|
|
netinfra/dns-cluster-setup/remote-dns.sh "$host-root" '
|
|
echo " write_cache: $(cat /sys/block/sda/queue/write_cache 2>/dev/null)"
|
|
echo " fsync (3x 1KB):"
|
|
for i in 1 2 3; do
|
|
t0=$(date +%s%N)
|
|
dd if=/dev/zero of=/tmp/.ft bs=1k count=1 conv=fsync 2>/dev/null
|
|
t1=$(date +%s%N)
|
|
echo -n " $(( (t1-t0)/1000000 )) ms"
|
|
done
|
|
echo
|
|
rm -f /tmp/.ft
|
|
' 2>&1 || echo " UNREACHABLE"
|
|
done
|