FEATURE テーブル
概要
SONiC の機能 docker(bgp、teamd、snmp、sflow、telemetry 等)の有効化、自動再起動、起動遅延、scope(global / per-asic / per-dpu)、Kubernetes 管理切り替えを保持する。hostcfgd の FeatureHandler がこのテーブルを購読し、systemd サービスファイル (sonic.target.wants/<feature>.service) の enable/disable とテンプレ展開を行う。
データフロー (自動生成)
flowchart LR
CDB[("CONFIG_DB<br/>FEATURE")]
DM["coppmgrd"]
CDB --> DM
凡例
CONFIG_DB から SAI までの典型経路を docs/reference/config-db-orch-map.md から機械生成したミニ図。詳細・例外は本ページ本文と対応表を参照。
key 構造
<name> は 1..32 文字の feature 名(bgp、teamd、telemetry 等)。
フィールド一覧
| フィールド |
型 |
必須 |
デフォルト |
説明 |
name (key) |
string (1..32) |
✅ |
- |
feature 名 |
state |
string |
- |
enabled |
管理状態 (enabled / disabled / always_enabled) |
auto_restart |
string |
- |
enabled |
失敗時の自動再起動 |
delayed |
string |
- |
false |
システム初期化完了まで起動遅延 |
has_global_scope |
string |
- |
false |
true で 1 装置 1 インスタンス |
has_per_asic_scope |
string |
- |
false |
true で ASIC ごとにインスタンス |
has_per_dpu_scope |
string |
- |
false |
true で DPU ごとにインスタンス |
high_mem_alert |
string |
- |
disabled |
メモリ高使用時のアラート |
set_owner |
string kube/local |
- |
local |
Kubernetes 管理かローカル管理か |
check_up_status |
boolean_type |
- |
false |
system-ready ツールで監視するか |
support_syslog_rate_limit |
boolean_type |
- |
false |
サービス単位の syslog rate limit 対応 |
state / auto_restart / delayed / has_*_scope / high_mem_alert は YANG 上 feature-state または feature-scope-status という非制約な string 型で、運用上 enabled/disabled 等の文字列を入れる。厳密な enum 制約は実装側のチェックに依る。
値依存挙動マトリクス
state (string: enabled/disabled/always_enabled/always_disabled)
| 値 |
挙動 |
enabled |
featured daemon が systemd unit を enable + start |
disabled |
systemd unit を disable + stop |
always_enabled |
featured が有効化を強制。ユーザーからの disabled への変更を無効化(featured:248-256) |
always_disabled |
featured が無効化を強制。ユーザーからの enabled への変更を無効化 |
None / 未設定 |
always_enabled と同等に扱う(featured:248) |
auto_restart (string: enabled/disabled)
| 値 |
挙動 |
enabled |
docker が crash した場合に systemd が自動再起動 |
disabled |
crash 時に手動復旧が必要 |
delayed (string: True/False)
| 値 |
挙動 |
False (デフォルト) |
システム起動直後に起動 |
True |
ポート初期化完了 / warm-fast boot 完了 / タイムアウトのいずれかを待ってから起動(featured:163-184) |
set_owner (string: kube/local)
| 値 |
挙動 |
local (デフォルト) |
ローカル docker image でコンテナを管理 |
kube |
KUBERNETES_MASTER テーブルの接続先 k8s cluster がコンテナイメージを管理 |
check_up_status (boolean_type)
| 値 |
挙動 |
false (デフォルト) |
system_health の監視対象外 |
true |
system_health が対象 feature の up 状態を監視 |
support_syslog_rate_limit (boolean_type)
| 値 |
挙動 |
false (デフォルト) |
サービス単位の syslog rate limit なし |
true |
SYSLOG_CONFIG_FEATURE テーブルでサービス単位の rate limit を設定可能 |
購読者
hostcfgd の FeatureHandler: systemd サービス制御、SUPERVISORD config 更新、Kubernetes container 切替え
system_health: check_up_status = true の機能を監視
関連 CONFIG_DB / YANG / CLI
- 関連 CONFIG_DB:
KUBERNETES_MASTER(set_owner = kube のとき)、SYSLOG_CONFIG_FEATURE(support_syslog_rate_limit = true のとき)
- 関連 CLI:
config feature state <name> <enabled|disabled>、config feature autorestart
- 関連 YANG:
sonic-feature
関連リファレンス
引用元
運用ヒント
典型値
- key 形式:
FEATURE|<feature-name> (例 bgp, lldp, snmp, telemetry)。
state: enabled / disabled / always_enabled。
auto_restart: enabled。
high_mem_alert: disabled。
よくある誤設定
state: disabled で必須コンテナ(swss 等)を止めると orchagent ごと止まる。
auto_restart: disabled で crash すると手動再起動が必要。
確認コマンド
sonic-db-cli CONFIG_DB keys 'FEATURE|*'
show feature status
例外条件・特殊挙動
| consumer |
条件 |
挙動 |
| FeatureRegistry |
新規登録時に CONFIG_DB に既存エントリが存在する |
デフォルト値より既存 DB 値を優先。非設定可能項目 (delayed 等) のみ新値で上書き。ユーザ設定の state/auto_restart は保持(feature.py:72-78) |
| FeatureRegistry |
state フィールドが欠落 |
デフォルト disabled を使用(feature.py:13,35) |
| FeatureRegistry |
auto_restart / high_mem_alert / set_owner が欠落 |
デフォルト値 (enabled, disabled, local) を使用(feature.py:14-16) |
| containercfgd |
syslog 設定値が変化しない |
"Syslog rate limit configuration does not change, ignore it" を出力してスキップ(rsyslogd 再起動なし)(containercfgd.py:146-148) |
| containercfgd |
syslog 更新中に例外発生 |
log_error(...) を出力して継続。デーモンは停止しない(containercfgd.py:124-125) |
| dhcprelayd |
FEATURE.dhcp_server.state フィールド欠落 |
dict.get("dhcp_server", {}).get("state", "disabled") でデフォルト disabled として扱う(dhcprelayd.py:206-207) |
Evidence: sonic-utilities sonic_package_manager/service_creator/feature.py:13-78; sonic-buildimage src/sonic-containercfgd/containercfgd/containercfgd.py:124-148; src/sonic-dhcp-utilities/dhcp_utilities/dhcprelayd/dhcprelayd.py:206-207