myxce/src/xceadmin/tests/fixtures/full/configs/resources.yaml
lei.chen 857f987f3c resources: XCE_RESF_BUILTIN 从未被置位 — resources.yaml 加 builtin: true 声明式键
XCE_RESF_BUILTIN (0x01) 在生产链路上从未被任何一层置位:全树只有 types.h
定义、scheduler repl_info.c 显示表、一个测试 fixture 三处引用。worker
init_builtin_load_indices()(mem/io/r1m…)、controller add_hostattrs_resvals()/
set_host_slots() 硬编码生产这些资源的值,但定义的 flags 从 YAML→capnp→wire
全程没人打这个位——CLI 的 BUILTIN 列对 mem/io/slots 等恒显 false,与 extlic
等用户资源无法区分。

- resources.schema.json(+xceadmin 打包副本,构建时从 src/configs/schema
  同步):加 builtin: boolean 键
- mapping.py:RESOURCE_FLAG_BUILTIN=0x01,_build_resource 映射 builtin:true
  (与 consumable/release 同模式:缺省/false 不置位)
- build.py dump:补渲染 builtin=True;顺手补同样一直缺失的 external=True
  (此前 EXTERNAL 池 dump 只显示 shared=true)
- src/configs/resources.yaml:20 个硬编码生产者资源(slots + 11 load index
  + 8 host attributes)声明 builtin: true
- golden fixture full/expected.bin 相应再生(6696→6856B,diff 恰为 20 行
  builtin=True,非 builtin 行 0 差异)

验证:xceadmin 389 测试全绿(dev venv + meson build.dbg 各一遍);t1 实证:
树内 venv 重建 cluster.bin(与 live 逐行比对确认 delta 仅 builtin 20 行)→
config push gen=17 → apiserver 重启拾取(定义 store 只吃 join 时 config
push,激活只 re-push scheduler)→ xcecli definition list -l mem/io/slots
BUILTIN=true,extlic false、distribution/extlic 值/liccheck 作业 RUN→DONE
全链正常,5 daemon 健康。

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-28 01:46:21 +00:00

213 lines
4.5 KiB
YAML

---
resources:
# built-in: job slot count (consumed by running jobs, decreases as slots fill)
- name: slots
type: numeric
order: decrease
consumable: true
description: "job slot count (built-in)"
# built-in: dynamic memory load index reported by workers
- name: mem
type: numeric
interval: 60
consumable: false
builtin: true
order: decrease
description: "available memory in MB (built-in dynamic load index)"
# built-in host attributes, registered per-worker by
# controller/worker.c add_hostattrs_resvals()
- name: type
type: string
description: "host OS/arch type (built-in host attribute)"
- name: model
type: string
description: "host hardware model (built-in host attribute)"
- name: cpuf
type: numeric
description: "CPU speed factor (built-in host attribute)"
- name: maxcpus
type: numeric
description: "max CPU count (built-in host attribute)"
- name: maxmem
type: numeric
description: "max memory in MB (built-in host attribute)"
- name: maxswap
type: numeric
description: "max swap in MB (built-in host attribute)"
- name: maxtmp
type: numeric
description: "max tmp disk space in MB (built-in host attribute)"
- name: ndisks
type: numeric
description: "disk count (built-in host attribute)"
# dynamic hostbased resource, external load index
- name: dynres1
type: numeric
interval: 60
order: decrease
consumable: true
release: true
description: "user defined dynamic resource"
resourcemap:
- location:
- default
# dynamic share resource, 2 instances
- name: dynres2
type: numeric
interval: 60
consumable: false
order: decrease
description: "user defined dynamic resource"
resourcemap:
- location:
- host1
- host2
- location:
- host5
- host6
# static share resource, all host share 100 res.
- name: staticres4
type: numeric
interval: 0
consumable: true
order: decrease
resourcemap:
- location:
- all
value: 100
# static share resource, host1 and host2 share the 100 res.
- name: staticres1
type: numeric
interval: 0
consumable: true
order: decrease
resourcemap:
- value: 100
location:
- host1
- host2
# static share resource, each of host1 and host2 shares the 100 res.
- name: staticres2
type: numeric
interval: 0
consumable: false
order: decrease
resourcemap:
- value: 100
location:
- host1
- value: 100
location:
- host2
# static hostbased resource.
- name: staticres3
type: numeric
interval: 0
consumable: true
order: decrease
resourcemap:
- value: 100
location:
- default
- name: res1
type: numeric
interval: 0
consumable: true
order: decrease
resourcemap:
- location:
- all
value: 100
- name: sres1
type: numeric
interval: 0
consumable: true
order: decrease
# boolean resource
- name: bigmem
type: boolean
order: na
resourcemap:
- value: true
location:
- host1
- value: true
location:
- host2
- value: true
location:
- host3
# dynamic string resource
- name: strres1
type: string
interval: 60
consumable: false
order: na
description: "string resources"
resourcemap:
- location:
- default
# static string resource
- name: strres2
type: string
description: "string resources"
resourcemap:
- value: v1
location:
- host1
- value: v2
location:
- host2
- value: v3
location:
- host3
- name: host_quota
description: quota on each host
type: numeric
order: decrease
consumable: true
interval: 0
resourcemap:
- value: 10
location:
- default
- name: gstring
description: string resource
type: string
# external-license-resources: cluster-wide license pool reported by
# the extres daemon (xceesd) -- config declares only the name/shape,
# the free counts come from the daemon's pushes
- name: extlic
description: externally reported license pool
type: numeric
interval: 0
consumable: true
order: decrease
resourcemap:
- location:
- external