fix(k3s): 修正磁盘调度 unit 启动命令
systemd 会展开 unit 命令中的百分号 specifier,导致原 oneshot 启动失败。改用 echo 写入调度器,并强制校验 unit 为 active;bash -n、ShellCheck、manual-release-test.sh 通过。
This commit is contained in:
@@ -55,8 +55,8 @@ Before=k3s.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c 'printf "%s\\n" mq-deadline > /sys/block/$device/queue/scheduler'
|
||||
ExecStop=/bin/sh -c 'printf "%s\\n" none > /sys/block/$device/queue/scheduler'
|
||||
ExecStart=/bin/sh -c 'echo mq-deadline > /sys/block/$device/queue/scheduler'
|
||||
ExecStop=/bin/sh -c 'echo none > /sys/block/$device/queue/scheduler'
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
@@ -65,7 +65,9 @@ EOF
|
||||
chmod 0644 "$temporary"
|
||||
install -o root -g root -m 0644 "$temporary" "$unit_path"
|
||||
systemctl daemon-reload
|
||||
systemctl reset-failed "$unit_name" >/dev/null 2>&1 || true
|
||||
systemctl enable --now "$unit_name" >/dev/null
|
||||
[[ $(systemctl is-active "$unit_name") == active ]]
|
||||
[[ $(current_scheduler) == mq-deadline ]]
|
||||
printf 'control_plane_io=APPLIED node=hongkong device=%s scheduler=mq-deadline restart=false\n' "$device"
|
||||
;;
|
||||
|
||||
@@ -309,6 +309,7 @@ grep -Fq 'wal_sender_timeout: 30s' "$root/deploy/kubernetes/production/database.
|
||||
grep -Fq 'wal_receiver_timeout: 30s' "$root/deploy/kubernetes/production/database.yaml"
|
||||
bash -n "$root/scripts/cluster/configure-control-plane-io.sh"
|
||||
grep -Fq 'Before=k3s.service' "$root/scripts/cluster/configure-control-plane-io.sh"
|
||||
grep -Fq "ExecStart=/bin/sh -c 'echo mq-deadline" "$root/scripts/cluster/configure-control-plane-io.sh"
|
||||
grep -Fq 'restart=false' "$root/scripts/cluster/configure-control-plane-io.sh"
|
||||
grep -Fq 'configure-control-plane-io.sh apply' "$root/docs/operations/k3s-ha-runbook.md"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user