已开启
共平面 #32
BytesLiang创建于 6月22日
共平面 #32
已开启
BytesLiang创建于 6月22日
11 个文件变更+869-70
Mconf/ubse.conf+10-1文件内容审核中,请稍后刷新重试
Aconf/urma_topology/hccs-cross.json+45-0文件内容审核中,请稍后刷新重试
Aconf/urma_topology/non-cross.json+29-0文件内容审核中,请稍后刷新重试
@@ -0,0 +1,378 @@
1+# UBSE 配置说明
2+ 
3+## 配置原则说明
4+ 
5+1. UBS Engine的配置能力通过文件的方式暴露
6+2. UBS Engine配置文件采用ini文件格式:
7+ 
8+ - 由节(section)、键(key)和值(value)构成
9+ 
10+ - 配置文件包含多个 section,每个 section 包含多个键值对,section 独自为一行,其名称由中括号包围( **[****]**
11+ 
12+ - 每个键值对用等号(**=**)进行连接;左边为键,作为配置项的名称;右边为值,作为配置项内容
13+ 
14+3. 配置项设计,确保所有节点相同配置
15+4. 配置者需要在所有节点修改配置项,并重启各节点UBS Engine进程
16+ 
17+UBS Engine配置文件样例如下:
18+ 
19+```config
20+[ubse.log]
21+# Log level. The value can be DEBUG, INFO (default value), WARN, ERROR, or CRIT. Any invalid value will be reset to INFO.
22+log.level=INFO
23+# Size of the log file to be wrapped, in MB. The value range is [2, 20]. Any invalid value will be reset to 20.
24+log.max.fileSize=20
25+# Maximum number of log files that can be wrapped. The value range is [1, 200]. Any invalid value will be reset to 20.
26+log.fileNums=20
27+# Maximum number of logs that can be cached in the log buffer. If the number of cached logs exceeds the value, the earliest logs are overwritten. Value range: [64,4096]. Any invalid value will be reset to 4096.
28+log.queue.maxItem=4096
29+# Syslog switch.The value can be true or false(default value). Any invalid value will be reset to false.
30+log.sys.open=false
31+# Syslog type.The value can be kern, user(default value), mail, daemon, auth, syslog, lpr, news, uucp, cron, authpriv, ftp, or local0~7. Any invalid value will be reset to user.
32+log.sys.type=user
33+ 
34+[ubse.election]
35+# Interval at which the Master node sends heartbeat messages, in milliseconds. The value range is from 1000 to 60000. Any invalid value will be reset to 2000.
36+heartbeat.timeInterval=2000
37+# Threshold for the number of lost standby node heartbeats. The value ranges from 3 to 20. Any invalid value will default to 3.
38+heartbeat.lostThreshold=3
39+ 
40+```
41+ 
42+## log日志配置说明
43+ 
44+section取值:[ubse.log]
45+ 
46+配置项说明:
47+ 
48+| 序号 | 参数 | 说明 | 取值 |
49+| :--- | :---------------- | :--------------------------------------------------------- |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
50+| 1 | log.level | 日志级别。 | 默认值:INFO <br>取值范围如下:<br>- DEBUG<br>- INFO<br>- WARN<br>- ERROR<br>- CRIT<br>参数配置取值范围之外或错误值都会被重置为默认值。 |
51+| 2 | log.max.fileSize | 绕接日志文件的大小。 | 默认值:20<br>单位:MB<br>取值范围:[2, 20]<br>参数配置取值范围之外或错误值都会被重置为默认值。 |
52+| 3 | log.fileNums | 日志文件最大绕接数量。 | 默认值:20<br>取值范围:[1, 200]<br>参数配置取值范围之外或错误值都会被重置为默认值。 |
53+| 4 | log.queue.maxItem | 日志缓冲区最大缓存量条数。如果超过该值,则覆盖最初的日志。 | 默认值:4096<br>单位:条<br>取值范围:[64, 4096]<br>参数配置取值范围之外或错误值都会被重置为4096。 |
54+| 5 | log.sys.open | syslog记录日志开关。 | 默认值:false<br>取值范围:[true,false]<br>参数配置取值范围之外或错误值都会被重置为默认值。 |
55+| 6 | log.sys.type | syslog记录日志类型。 | 默认值:user<br>取值范围:<br>kern, user(default value), mail, daemon, auth, syslog, lpr, news, uucp, cron, authpriv, ftp, or local0~7.<br>参数配置取值范围之外或错误值都会被重置为默认值。<br>该配置记录日志规则与syslog的rsyslog.conf一致,部分类型需要用户自配。 |
56+ 
57+## ha选举配置说明
58+ 
59+section取值:[ubse.election]
60+ 
61+配置项说明:
62+ 
63+| 序号 | 参数 | 说明 | 取值 |
64+|----| ----------------------- |-----------------|------------------------------------------------------------------|
65+| 1 | heartbeat.timeInterval | 发送心跳间隔时间,单位毫秒。 | 默认值:2000<br>单位:毫秒<br>取值范围:[1000, 60000]<br>参数配置取值范围之外的值会被重置为默认值。 |
66+| 2 | heartbeat.lostThreshold | 备节点心跳丢失次数阈值。 | 默认值:3<br>取值范围:[3, 20]<br>参数配置取值范围之外的值会被重置为默认值。 |
67+| 3 | election.candidate | 节点是否参与选主。 | 默认值:true<br>取值范围:[true,false]<br>如果取值超过范围,则取默认值true。 |
68+| 4 | election.wait | 节点是否等待最小节点发起选主。 | 默认值:true<br>取值范围:[true,false]<br>如果取值超过范围,则取默认值true。 |
69+ 
70+## rpc通信配置说明
71+ 
72+section取值:[ubse.rpc]
73+ 
74+配置项说明:
75+ 
76+| 序号 | 参数 | 说明 | 取值 |
77+| ---- | --------------- |------------------------|---------------------------------------------------------------------------------------------|
78+| 1 | request.timeout | rpc通信接口的超时时间。 | 默认值:60<br>单位:秒<br>取值范围:[0,65535]<br>如果取值超过范围,则取默认值60。 |
79+| 2 | cluster.ipList | rpc使用tcp协议时的集群各节点ip地址。 | 默认值:用#注释<br>打开此配置时(取消注释),使用tcp通信,此配置注释时使用urma通信。<br>tcp通信参考值:192.168.100.100-192.168.100.103<br>上述参考值等同于配置192.168.100.100,192.168.100.101,192.168.100.102,192.168.100.103。|
80+| 3 | cert.use | rpc安全证书能力开关。 | 默认值:true(开启证书能力)<br>取值范围:[true,false]<br>如果取值超过范围,则取默认值true。 |
81+ 
82+## UBFM对接配置说明
83+ 
84+section取值:[ubse.ubfm]
85+ 
86+配置项说明:
87+ 
88+| 序号 | 参数 | 说明 | 取值 | 备注 |
89+| ---- | ---------------- |------------------------------------|-----------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
90+| 1 | ubse.server.port | UBSE暴露给UBM的通信端口,在该端口开启HTTPS服务。 | 默认值:用#注释<br>取值范围:[1024, 65535]<br>如果取值超过范围,则取值为8082。 | UBM和UBSE共部署在host主机时,ubm.server.cid用#注释,UBSE与UBM使用UDS通信,此配置项不生效;高安部署模式下,ubm.server.cid配置开启,UBSE与UBM使用HTTPS通信,此配置项生效。 |
91+| 2 | ubm.server.port | UBM暴露的通信端口,UBSE通过该端口与UBM进行HTTPS交互。 | 默认值:用#注释<br>取值范围:[1024, 65535]<br>如果取值超过范围,则取值为8799。 | UBM和UBSE共部署在host主机时,ubm.server.cid用#注释,UBSE与UBM使用UDS通信,此配置项不生效;高安部署模式下,ubm.server.cid配置开启,UBSE与UBM使用HTTPS通信,此配置项生效。 |
92+| 3 | ubm.server.cid | 高安场景UBM所在机密虚机的地址。 | 默认值:用#注释<br>打开此配置时(取消注释),与UBM使用HTTPS通信,此配置注释时与UBM使用UDS通信。<br>取值范围:[0, 2^32-1] <br>如果取值超过范围,则不使能高安模式。 | - UBM和UBSE共部署在host主机时,该配置项关闭,两者之间使用UDS通信;在高安部署模式下,该配置开启,两者之间使用HTTPS通信。<br>- UBSE与UBM所在机密虚机使用vsock通信,参数配置取值应该与虚拟机启动使用的cid一致,配置错误的cid,会导致与虚拟机通信失败。 |
93+| 4 | ubm.server.hostname | ubm主机标识,要和ubm侧的服务端证书中主题备用名称(SAN)或通用名称(CN)字段包含的主机标识其中之一一致。如果不一致Ubse启动发生异常,功能不可用。| 默认值:用#注释<br>取值范围:有效的DNS主机名,配置非法值会被重置为默认值localhost|仅高安场景生效。<br>校验失败,Ubse启动发生异常,功能不可用,UBSE与UBM使用HTTPS通信,此配置项生效,需要确保生效的主机名能被DNS解析到ip地址127.0.0.1上
94+ 
95+## 内存池化配置说明
96+ 
97+section取值:[ubse.memory]
98+ 
99+配置项说明:
100+ 
101+| 序号 | 参数 | 说明 | 取值 | 备注 |
102+|----|--------------------|---------------------|----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
103+| 1 | obmm.memory.block.size | 芯片表项内存拆分粒度大小。 | 默认值:用#注释<br>单位:MB<br>取值范围:[4, 4096]<br>参数取值必须是2的整数倍。 | - 管理员可按需修改配置文件,增加该配置,当该配置被定义时以配置文件为准。<br>- 校验规则:<br>1.配置值超范围,取默认值。<br>2.各节点不一致,借用失败。<br>- 当ubse.conf文件不显式配置时,取值规则如下:<br>1.mempool_allocator=buddy_highmem时,obmm.memory.block.size取值为128。<br>2.mempool_allocator=hugetlb_pmd时,obmm.memory.block.size取值为128。<br>3.mempool_allocator=hugetlb_pud时,obmm.memory.block.size取值为1024。 <br>- 当用户借用内存大小不与blocksize对齐时,导出内存会向上取整。<br>- 预上线场景(ubse.preonline.enable配置项为true)建议配置为UB Memory decoder表中entry粒度的整数倍,entry粒度默认为2G。 |
104+| 2 | isLender | 当前节点是否可以作为内存借出节点。 | 默认值:true<br>取值范围:[true,false]<br>如果取值超过范围,则取默认值true。 | — |
105+| 3 | ubse.preonline.enable | 是否开启预上线能力。 | 默认值:false<br>取值范围:[true,false]<br>如果取值超过范围,则取默认值false。 | - 依赖环境启用预上线能力,需在`/boot/efi/EFI/openEuler/grub.cfg`文件的numa_remote配置项中配置preonline。<br>- 所有节点的配置需保持一致。 |
106+| 4 | ubse.preonline.size | 预上线的内存大小。 | 默认值:4096<br>单位:MB<br>取值范围:[128, 262144]<br>参数取值必须是128的整数倍,取值超过范围则取默认值4096。 | - 依赖环境启用预上线能力,需在`/boot/efi/EFI/openEuler/grub.cfg`文件的numa_remote配置项中配置preonline。<br>- 建议配置为UB Memory decoder表中entry粒度的整数倍,entry粒度默认为2G。<br>- 所有节点的配置需保持一致。 |
107+| 5 | api.timeout | API接口调用的超时时间。 | 默认值:1800<br>单位:秒<br>取值范围:[1,3600]<br>如果取值超过范围,则取默认值1800。 | - 下层执行超过这个时间会给上层API接口调用返回超时,超时后续借用的数据由上层接口管理是否清理。<br>- 所有节点的配置需保持一致。 |
108+| 6 | lender.balance | 算法是否使用借出 NUMA 均衡模式。 | 默认值:false<br>取值范围:[true,false]<br>如果取值超过范围,则取默认值false。 | - **true**:资源充足时,不同的借用请求节点尽量优先分散到不同节点的借出numa或者相同节点的不同借出numa上,相同借用请求节点优先复用其历史使用的借出numa。<br>- **false**:默认决策方式,资源充足时,不同的借用请求节点也可能由相同的借出节点的借出numa借出(借出numa优先选择最大剩余内存的numa)。 |
109+| 7 | group | 同一个组里的节点可以相互借用。 | 默认值:用#注释(所有节点在同一个组里) | - 同一个组里可以相互借用,以分号为组与组之间的标识。<br>- 不配置时/配置为空时,默认所有节点在同一个组里。<br>- 必须保证集群中所有节点hostname唯一。<br>- 配置的节点数量需要和集群静态规划节点数量一致。<br>- 一个节点不允许在多个group。<br>- 所有节点的配置需保持一致。 |
110+| 8 | provider | 指定节点专用于借出。 | 默认值:用#注释(所有节点均可借出) | - 不配置时/配置为空时,默认所有节点均可借出。<br>- 必须保证集群中所有节点hostname唯一。<br>- 配置的节点数量必须小于集群静态规划节点数量。<br>- 所有节点的配置需保持一致。 |
111+| 9 | radius.lender | 借出节点的内存借用半径。 | 默认值:用#注释(不限制)<br>取值范围:[0, 65535]<br>如果取值超过范围,则取默认值65535(不限制)。 | - 控制借出节点允许借用内存的半径范围。<br>- 所有节点的配置需保持一致。<br>- 仅适用于fd和numa借用场景。 |
112+| 10 | radius.borrow | 借入节点的内存借用半径。 | 默认值:用#注释(不限制)<br>取值范围:[0, 65535]<br>如果取值超过范围,则取默认值65535(不限制)。 | - 控制借入节点请求内存的半径范围。<br>- 所有节点的配置需保持一致。<br>- 仅适用于fd和numa借用场景。 |
113+| 11 | obmm.memory.offline.timeout | obmm_unimport操作超时时间。 | 默认值:用#注释<br>单位:秒<br>取值范围:[10, 1800] | - 当显式配置该配置项且值在范围内时,obmm_unimport超时时间固定为该值。<br>- 当不配置、配置值非法或超出范围时,超时时间由内部决策。 |
114+ 
115+## URMA配置说明
116+ 
117+section取值:[ubse.urma]
118+ 
119+配置项说明:
120+ 
121+| 序号 | 参数 | 说明 | 取值 | 备注 |
122+|------|-----------|--------------------------------------------------------|--------------------------------------------------------------|------|
123+| 1 | topo_mode | UBSE在CLOS组网下向URMA UVS下发拓扑时使用的建链模式。1D-FULLMESH组网下该配置不生效。 | 默认值:用#注释<br>取值范围:<br>- non-cross<br>- hccs-cross<br>参数配置取值范围之外或错误值都会被重置为 non-cross。| 仅CLOS组网使用。 |
124+ 
125+## 权限点配置
126+ 
127+### 权限点说明
128+ 
129+基于安全考虑,在UBSE中引入“轻量化角色访问控制(RBAC)能力”,达成对单一外部用户进行权限最小化控制。
130+ 
131+```mermaid
132+graph LR
133+A(用户/User)-->B(角色/Role)
134+B(角色/Role)-->C(目标对象/Object)
135+```
136+ 
137+**用户/User**:表示调用UBSE的接口的客户端,因为UBSE暴露的UDS接口,由UBSE通过OS接口自动获取username或者uid(客户端是容器应用的情况下可能没有username);单用户/User能且只能绑定一个角色/Role
138+ 
139+**角色/Role**:表示用户/User所绑定的角色,每个角色/Role可以绑定多个目标对象/Object
140+ 
141+**目标对象/Object**:表示能够被操作的资源对象,表示可以对相应对象完成所有操作(简化系统复杂度,不定义基于对象的动作行为);资源对象的取值范围,由UBSE开发过程确定,在包ubs-engine-client-devel-\<version>-\<release>.aarch64.rpm中可以获取
142+ 
143+### 配置说明
144+ 
145+客户端自定义配置UBSE接口的权限点,当与默认权限点配置重复时,采用用户自定义权限点配置覆盖默认权限点配置。
146+ 
147+**命名规则**
148+ 
149+- 文件命名:建议采用 auth\_\{module\}.conf 的命名。
150+- 内容section:必须使用\[auth.user\]和\[auth.role\]命名,否则不会生效。
151+- user、role的定义:禁止与其他自定义文件内容重复,重复会相互覆盖,禁止尝试修改内置权限点的内容(配置不会生效)。
152+ 
153+**表 1** 内置权限点说明 <a id="table9"></a>
154+ 
155+|用户角色|说明|
156+|--|--|
157+|UBSE内置管理员用户|ubse(UBSE进程运行用户)、root用户。|
158+|UBSE内置管理员角色admin|用于支持管理员用户授权。|
159+|UBSE内置all对象|表示所有对象。|
160+|管理员角色admin|具备all对象的操控权限。|
161+ 
162+>[!NOTE]说明
163+>内置ubse/root用户、管理员角色admin,均不能被覆盖。
164+ 
165+**参数说明**
166+ 
167+参考[表2](#table9)配置自定义权限点。
168+ 
169+**表 2** auth\_test.conf配置说明 <a id="table9"></a>
170+ 
171+|序号|所属配置节|参数|说明|取值|配置节点|
172+|--|--|--|--|--|--|
173+|1|[auth.user]|user|客户端需要自定义配置的用户名禁止与其他自定义文件内容重复,重复会相互覆盖;禁止修改内置用户root,ubse;客户端用户不允许配置为admin角色|客户端需要给该用户配置的角色。|所有节点|
174+|2|[auth.role]|default_ubsm|客户端需要自定义配置的角色禁止与其他自定义文件内容重复,重复会相互覆盖;禁止修改内置角色admin;自定义角色不允许引用all对象|客户端需要给该角色配置的权限点。|所有节点|
175+ 
176+**配置示例**
177+ 
178+示例如下:
179+ 
180+```shell
181+[auth.user]
182+userA = roleA
183+userB = roleA
184+[auth.role]
185+roleA = objectA,objectB
186+```
187+ 
188+### 默认配置
189+ 
190+`ubse\_auth\_default.conf`文件用于配置UBSE接口的默认权限点定义,可以被客户端自定义权限点文件的配置覆盖。
191+ 
192+**配置说明**
193+ 
194+参考[表1](#table8)修改/etc/ubse/ubse\_auth\_default.conf。
195+ 
196+**表 1** ubse\_auth\_default.conf配置说明 <a id="table8"></a>
197+ 
198+|序号|所属配置节|参数|说明|取值|配置节点|应用场景|
199+|--|--|--|--|--|--|--|
200+|1|[auth.user.default]|ubsmd|ubsmd用户|默认值:default_ubsm|所有节点|通算大数据场景|
201+|2|ubs-scheduler|openstack插件用户|默认值:default_op|所有节点|通算虚拟化场景|
202+|3|matrixplugin|k8s插件用户|默认值:default_k8s|所有节点|通算虚拟化场景|
203+|4|[auth.role.default]|default_ubsm|ubsm场景角色|默认值:mem.fd,mem.numa,mem.shm,mem.stat,topo|所有节点|通算大数据场景|
204+|5|default_op|openstack场景角色|默认值:topo|所有节点|通算虚拟化场景|
205+|6|default_k8s|k8s场景角色|默认值:mem.numa,topo|所有节点|通算虚拟化场景|
206+ 
207+**默认配置**
208+ 
209+```shell
210+[auth.user.default]
211+# Section for default user-to-role mappings.
212+ubsmd = default_ubsm
213+ubs-scheduler = default_op
214+matrixplugin = default_k8s
215+[auth.role.default]
216+# Section for default role-to-permission mappings.
217+default_ubsm = mem.fd,mem.numa,mem.shm,mem.stat,topo
218+default_op = topo
219+default_k8s = mem.numa,topo
220+```
221+ 
222+## 场景化插件配置
223+ 
224+### plugin\_virt\_agent.conf
225+ 
226+**参数说明**
227+ 
228+参考[表1](#table6)修改/etc/ubse/plugins/plugin\_virt\_agent.conf。
229+ 
230+> [!NOTE]说明
231+>
232+>- 虚拟化场景,vm插件依赖OpenStackPlugin组件,需完成OpenStack部署。
233+>- 除ubse.plugin.name、ubse.plugin.pkg以及openstack相关参数外,其他参数配置取值范围之外或错误值都会被重置为默认值。
234+ 
235+**表 1** plugin\_virt\_agent.conf配置说明 <a id="table6"></a>
236+ 
237+|序号|参数|说明|取值|配置节点|应用场景|
238+|--|--|--|--|--|--|
239+|1|ubse.plugin.name|VM模块插件名。|固定值为virt\_agent|所有节点|通算虚拟化场景|
240+|2|ubse.plugin.pkg|VM模块依赖的so文件名称。|固定值为libvirtagent.so|所有节点|通算虚拟化场景|
241+|3|ubse.plugin.vm.export.interval|VM模块数据采集周期。|默认值: 2单位: s取值范围:[1, 60]仿真UB环境,取值建议不少于10参数配置取值范围之外或错误值都会被重置为默认值。|所有节点|通算虚拟化场景|
242+|4|borrow.watermark|决策模块第二逃生水线占比配置,高于会触发内存借用。|默认值:92单位:%取值范围:[70,95]且high.watermark <= borrow.watermark - 5参数配置取值范围之外或错误值都会被重置为默认值。|所有节点|通算虚拟化场景|
243+|5|high.watermark|高水线百分比,高触发借用或迁移,低触发归还,且用于决策模块。|默认值:85单位:%取值范围:[65~90]且low.watermark +5 <= high.watermark <= borrow.watermark - 5参数配置取值范围之外或错误值都会被重置为默认值。|所有节点|通算虚拟化场景。|
244+|6|low.watermark|低水线百分比,高触发借用或迁移,低触发归还,且用于决策模块。|默认值:80单位:%取值范围:[60~80]low.watermark +5 <= high.watermark参数配置取值范围之外或错误值都会被重置为默认值。|所有节点|通算虚拟化场景。|
245+|7|borrow.maxMemPerBorrowSize|单块借用内存的借用量上限。|默认值: 4096单位:MB取值范围:{1024,2048,3072,4096}且borrow.minMemPerBorrowSize <= borrow.maxMemPerBorrowSize参数配置取值范围之外或错误值都会被重置为默认值。|所有节点|通算虚拟化场景|
246+|8|borrow.minMemPerBorrowSize|单块借用内存的借用量下限。|默认值: 1024单位:MB取值范围:{1024,2048,3072,4096}参数配置取值范围之外或错误值都会被重置为默认值。|所有节点|通算虚拟化场景|
247+|9|borrow.maxPerTotalMemBorrowSize|单次决策最多内存借用上限。|默认值: 16384单位:MB取值范围:[4096, 20480]参数配置取值范围之外或错误值都会被重置为默认值。|所有节点|通算虚拟化场景|
248+|10|borrow.oomBorrowMemSize|oom事件期望借用内存大小。|默认值:1024单位:MB取值范围:[1024,4096]参数配置取值范围之外或错误值都会被重置为默认值。|所有节点|通算虚拟化场景|
249+|11|escape.algorithm.dir|自定义逃生算法so文件的绝对路径,配置中应包含so文件名称。由配置方保证加载so文件的安全可靠性。|默认值:/usr/lib64/libstrategy.so|所有节点|通算虚拟化场景|
250+|12|mig.ham.maxTimeout|单个VM确定性热迁移的任务的超时时间。|默认值:60单位:s取值范围:[10, 10800]UB仿真环境建议配成10800。参数配置取值范围之外或错误值都会被重置为默认值。|所有节点|通算虚拟化场景|
251+|13|mig.migrateOneCopyMemoryBound|UB代际下虚拟机热迁移决策OneCopy迁移策略的虚拟机内存阈值。|默认值: 4096单位:MB取值范围:[256,4096]UB仿真环境建议配成256。当目的节点为当前节点的邻居节点,虚拟机使用2M大页,节点间内存借用没有成环,且虚拟机内存规格大于mig.migrateOneCopyMemoryBound配置项的值时,为确定性热迁移。参数配置取值范围之外或错误值都会被重置为默认值。|所有节点|通算虚拟化场景|
252+|14|virt.pageType|虚拟化场景页面类型配置|默认值:1取值范围:01用于设置冷内存迁出时的页面单位,标准设置为0,2M设置为1。|所有节点|通算虚拟化场景|
253+|15|mig.isEnableHamMigrate|是否支持确定性热迁移开关|默认值: false取值范围:falsetrue开启确定性热迁移,使用true。|所有节点|通算虚拟化场景|
254+|16|virt.sceneType|虚拟化场景类型应用配置|默认值:1取值范围:01容器场景设置为0,虚拟机场景设置为1。|所有节点|通算虚拟化场景|
255+ 
256+**配置示例**
257+ 
258+示例如下:
259+ 
260+```shell
261+ubse.plugin.name=virt_agent
262+ubse.plugin.pkg=libvirtagent.so
263+borrow.watermark=92
264+high.watermark=85
265+low.watermark=80
266+borrow.maxMemPerBorrowSize=4096
267+borrow.minMemPerBorrowSize=1024
268+borrow.maxPerTotalMemBorrowSize=16384
269+mig.ham.maxTimeout=60
270+ 
271+mig.isEnableHamMigrate=false
272+ 
273+virt.pageType=1
274+virt.sceneType=1
275+```
276+ 
277+### plugin\_mempooling.conf
278+ 
279+**参数说明**
280+ 
281+参考[表1](#table7)修改/etc/ubse/plugins/plugin\_mempooling.conf。
282+ 
283+**表 1** plugin\_mempooling.conf配置说明 <a id="table7"></a>
284+ 
285+|序号|参数|说明|取值|配置节点|应用场景|
286+|--|--|--|--|--|--|
287+|1|ubse.plugin.name|mempooling模块插件名。|固定值为mempooling|所有节点|通算虚拟化场景|
288+|2|ubse.plugin.pkg|mempooling模块依赖的so文件名称。|固定值为libmempooling.so|所有节点|通算虚拟化场景|
289+|3|ucache.enable|容器超分场景,是否启用pagecache功能|默认值:false单位: bool|所有节点|容器超分场景|
290+|4|rmrs.ipc.timeout|与osturbo进行进程通信的超时时间|默认值:60单位:s|所有节点|通算虚拟化场景|
291+|5|rmrs.fragment.mustSamePlane|内存碎片场景,内存借用、迁出策略、迁出执行、故障处理,是否必须同平面(true:必须同平面,false:优先同平面)|默认值:true单位:bool配置范围:false/true|所有节点|通算虚拟化场景|
292+|6|rmrs.fragment.enableBorrowSplit|内存碎片场景,借用是否切分为 4G 粒度(true: 切分,false: 不切分)|默认值:true单位:bool配置范围:false/true|所有节点|通算虚拟化场景|
293+|7|overcommit.enableMultiNuma|容器超分场景,是否为虚机多numa场景(true: 虚机多numa场景, false: 单numa场景)|默认值:false单位: bool配置范围:false/true|所有节点|容器超分场景|
294+ 
295+**配置示例**
296+ 
297+示例如下:
298+ 
299+```shell
300+ubse.plugin.name=mempooling
301+ubse.plugin.pkg=libmempooling.so
302+ucache.enable=false
303+rmrs.ipc.timeout=60
304+rmrs.fragment.mustSamePlane=true
305+rmrs.fragment.enableBorrowSplit=true
306+overcommit.enableMultiNuma=false
307+```
308+ 
309+### plugin\_ucache.conf
310+ 
311+**参数说明**
312+ 
313+参考[表1 plugin\_ucache.conf配置说明](#table7)修改/etc/ubse/plugins/plugin\_ucache.conf。
314+ 
315+**表 1** plugin\_ucache.conf配置说明 <a id="table7"></a>
316+ 
317+|序号|参数|说明| 取值 |配置节点|应用场景|
318+|--|--|--|----------------------------------------------------|--|--|
319+|1|ubse.plugin.name|UCache模块插件名。| 固定值为ucache |所有节点|通算大数据场景|
320+|2|ubse.plugin.pkg|UCache模块依赖的so文件名称。| 固定值为libucache_plugin.so |所有节点|通算大数据场景|
321+|3|ucache.export.interval|UCache模块数据采集周期。| 默认值: 10单位: s取值范围:[1, 60]仿真UB环境,取值建议不少于10。 |所有节点|通算大数据场景|
322+|4|strategy.borrow_size|以16进制表示,单次借用或归还动作操作的最小内存大小。参数不在配置范围内,插件初始化失败。| 默认值:1073741824单位:字节配置范围:[134217728,4294967296] |所有节点|通算大数据场景|
323+|5|strategy.maxActionSize|借用策略动作集动作的最大数量,整数型。参数不在配置范围内,插件初始化失败。| 默认值:10配置范围:>=0 |所有节点|通算大数据场景|
324+|6|strategy.balanceThreshold|借用策略中平衡阈值,节点的平衡状态如果大于平衡阈值将会发生借用调度来平衡系统,浮点型。参数不在配置范围内,插件初始化失败。| 默认值:1.5配置范围:>=1 |所有节点|通算大数据场景|
325+|7|strategy.scarcityThreshold|发起借用动作时的最小内存稀缺度,浮点型。参数不在配置范围内,插件初始化失败。| 默认值:0.01配置范围:>=0 |所有节点|通算大数据场景|
326+|8|bottleneck.threshold|应用瓶颈识别的阈值,来判断PageCache in和IO读写带宽,整数型。参数不在配置范围内,则采用默认值。| 默认值:10240单位:KB/s配置范围:[1,10*1024*1024] |所有节点|通算大数据场景|
327+|9|bottleneck.short.size|应用瓶颈识别的短窗口长度,整数型。参数不在配置范围内,则采用默认值。| 默认值:180单位:秒配置范围:[30,1200] |所有节点|通算大数据场景|
328+|10|bottleneck.short.threshold|应用瓶颈识别的短窗口阈值,整数型。参数不在配置范围内,则采用默认值。| 默认值:70单位:百分比配置范围:[0,100] |所有节点|通算大数据场景|
329+|11|bottleneck.long.size|应用瓶颈识别的长窗口长度,整数型。参数不在配置范围内,则采用默认值。| 默认值:600单位:秒配置范围:[90,3600] |所有节点|通算大数据场景|
330+|12|bottleneck.long.threshold|应用瓶颈识别的长窗口阈值,整数型。参数不在配置范围内,则采用默认值。| 默认值:30单位:百分比配置范围:[0,100] |所有节点|通算大数据场景|
331+|13|strategy.maxReliableTimes|借用策略数据最大可靠周期数,每个周期的时间由master.masterInterval 决定,整数型。参数不在配置范围内,则采用默认值。| 默认值:3配置范围:[1,10] |所有节点|通算大数据场景|
332+|14|master.masterInterval|master主流程间隔时间,整数型。参数不在配置范围内,插件初始化失败。| 默认值:3单位:秒配置范围:[1,15] |所有节点|通算大数据场景|
333+|15|master.maxBorrowSize|最大借用内存量,整数型。参数不在配置范围内,插件初始化失败。| 默认值:1073741824单位:字节配置范围:strategy.borrow_size的正整数倍。 |所有节点|通算大数据场景|
334+ 
335+**配置示例**
336+ 
337+示例如下:
338+ 
339+```shell
340+ubse.plugin.name=ucache
341+ubse.plugin.pkg=libucache_plugin.so
342+# export interval
343+ucache.export.interval=10
344+# Borrowing strategy unit
345+strategy.borrow_size=1073741824
346+# The maximum number of output actions of the borrowing strategy
347+strategy.maxActionSize=10
348+# Borrowing strategy balance threshold
349+strategy.balanceThreshold=1.5
350+# Borrowing strategy minimum borrowing scarcity
351+strategy.scarcityThreshold=0.01
352+# Bottleneck - threshold (type: uint32, unit: kb/s, default: 10240 kb/s)
353+# min: 1
354+# max: 10*1024*1024 (nvme disk read limit)
355+bottleneck.threshold=10240
356+# Bottleneck - short window size (type: uint32, unit: second, default: 180)
357+# min: 30. The window has at least 3 points, calculated based on a 10-second period, and at least 30 seconds.
358+# max: 1200. according to the puncture experience, the PageCache volume reaches its peak in about 20 minutes.
359+bottleneck.short.size=180
360+# Bottleneck - short window threshold (type: uint32, unit: percent, default: 70%)
361+# min: 0
362+# max: 100
363+bottleneck.short.threshold=70
364+# Bottleneck - long window size (type: uint32, unit: second, default: 600)
365+# min: 90
366+# max: 3600
367+bottleneck.long.size=600
368+# Bottleneck - long window threshold (type: uint32, unit: percent, default: 30%)
369+# min: 0
370+# max: 100
371+bottleneck.long.threshold=30
372+# Maximum reliable period of borrowing strategy data
373+strategy.maxReliableTimes=3
374+# Master main process interval time (s)
375+master.masterInterval=10
376+# Maximum borrowed memory, Byte
377+master.maxBorrowSize=1073741824
378+```
Mscripts/build-deb.sh+9-1文件内容审核中,请稍后刷新重试
Msrc/adapter_plugins/urma_uvs/CMakeLists.txt+2-2文件内容审核中,请稍后刷新重试
@@ -0,0 +1,220 @@
1+/*
2+ * Copyright (c) Huawei Technologies Co., Ltd. 2026-2026. All rights reserved.
3+ * ubs-engine is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#include "ubse_urma_topo_config.h"
14+ 
15+#include <cstddef>
16+#include <fstream>
17+#include <iterator>
18+#include <utility>
19+ 
20+#include "ubse_conf_module.h"
21+#include "ubse_context.h"
22+#include "ubse_error.h"
23+#include "ubse_logger_module.h"
24+#include "ubse_str_util.h"
25+#include "rapidjson/document.h"
26+ 
27+namespace ubse::urma {
28+using namespace ubse::common::def;
29+using namespace ubse::config;
30+using namespace ubse::context;
31+using namespace ubse::log;
32+using namespace ubse::utils;
33+ 
34+UBSE_DEFINE_THIS_MODULE("ubse");
35+ 
36+constexpr const char* URMA_CONFIG_SECTION = "ubse.urma";
37+constexpr const char* URMA_TOPO_MODE_KEY = "topo_mode";
38+constexpr const char* URMA_TOPO_MODE_NON_CROSS = "non-cross";
39+constexpr const char* URMA_TOPO_MODE_HCCS_CROSS = "hccs-cross";
40+constexpr const char* URMA_TOPO_CONFIG_DIR = "/etc/ubse/topo";
41+constexpr const char* URMA_TOPO_CONFIG_NON_CROSS_FILE = "non-cross.json";
42+constexpr const char* URMA_TOPO_CONFIG_HCCS_CROSS_FILE = "hccs-cross.json";
43+constexpr std::size_t URMA_TOPO_PORT_FIELD_NUM = 3;
44+constexpr std::size_t URMA_TOPO_PORT_CHIP_ID_INDEX = 0;
45+constexpr std::size_t URMA_TOPO_PORT_DIE_ID_INDEX = 1;
46+constexpr std::size_t URMA_TOPO_PORT_PORT_ID_INDEX = 2;
47+ 
48+UbseUrmaTopoMode GetUrmaTopoMode()
49+{
50+ auto module = UbseContext::GetInstance().GetModule<UbseConfModule>();
51+ if (module == nullptr) {
52+ UBSE_LOG_WARN << "Failed to get config module, use default URMA topo_mode=non-cross";
53+ return UbseUrmaTopoMode::NON_CROSS;
54+ }
55+ 
56+ std::string topoMode = URMA_TOPO_MODE_NON_CROSS;
57+ auto ret = module->GetConf<std::string>(URMA_CONFIG_SECTION, URMA_TOPO_MODE_KEY, topoMode);
58+ if (ret != UBSE_OK) {
59+ UBSE_LOG_WARN << "Failed to get URMA topo_mode config, use default non-cross, ret=" << FormatRetCode(ret);
60+ return UbseUrmaTopoMode::NON_CROSS;
61+ }
62+ 
63+ if (topoMode == URMA_TOPO_MODE_NON_CROSS) {
64+ return UbseUrmaTopoMode::NON_CROSS;
65+ }
66+ if (topoMode == URMA_TOPO_MODE_HCCS_CROSS) {
67+ return UbseUrmaTopoMode::HCCS_CROSS;
68+ }
69+ 
70+ UBSE_LOG_WARN << "Invalid URMA topo_mode=" << topoMode << ", use default non-cross";
71+ return UbseUrmaTopoMode::NON_CROSS;
72+}
73+ 
74+std::string GetUrmaTopoConfigFileName(UbseUrmaTopoMode topoMode)
75+{
76+ return topoMode == UbseUrmaTopoMode::HCCS_CROSS ? URMA_TOPO_CONFIG_HCCS_CROSS_FILE :
77+ URMA_TOPO_CONFIG_NON_CROSS_FILE;
78+}
79+ 
80+UbseResult ReadTextFile(const std::string& filePath, std::string& content)
81+{
82+ std::ifstream file(filePath);
83+ if (!file.is_open()) {
84+ UBSE_LOG_ERROR << "Failed to open URMA topo config file=" << filePath;
85+ return UBSE_ERROR_FILE_NOT_EXIST;
86+ }
87+ 
88+ content.assign(std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>());
89+ if (content.empty()) {
90+ UBSE_LOG_ERROR << "URMA topo config file is empty, file=" << filePath;
91+ return UBSE_ERROR_INVAL;
92+ }
93+ return UBSE_OK;
94+}
95+ 
96+UbseResult ParseTopoPort(const std::string& portStr, UbseUrmaTopoPort& port)
97+{
98+ std::vector<std::string> fields;
99+ Split(portStr, "/", fields);
100+ if (fields.size() != URMA_TOPO_PORT_FIELD_NUM) {
101+ UBSE_LOG_ERROR << "Invalid URMA topo port=" << portStr;
102+ return UBSE_ERROR_INVAL;
103+ }
104+ 
105+ if (ConvertStrToUint32(fields[URMA_TOPO_PORT_CHIP_ID_INDEX], port.chipId) != UBSE_OK ||
106+ ConvertStrToUint32(fields[URMA_TOPO_PORT_DIE_ID_INDEX], port.dieId) != UBSE_OK ||
107+ ConvertStrToUint32(fields[URMA_TOPO_PORT_PORT_ID_INDEX], port.portId) != UBSE_OK) {
108+ UBSE_LOG_ERROR << "Failed to parse URMA topo port=" << portStr;
109+ return UBSE_ERROR_INVAL;
110+ }
111+ return UBSE_OK;
112+}
113+ 
114+UbseResult GetJsonString(const rapidjson::Value& json, const char* key, std::string& value)
115+{
116+ if (!json.IsObject() || !json.HasMember(key) || !json[key].IsString()) {
117+ UBSE_LOG_ERROR << "Invalid URMA topo config string field=" << key;
118+ return UBSE_ERROR_INVAL;
119+ }
120+ value = json[key].GetString();
121+ return UBSE_OK;
122+}
123+ 
124+UbseResult ParseTopoNodePorts(const rapidjson::Value& json, std::vector<UbseUrmaTopoPort>& nodePorts)
125+{
126+ constexpr const char* nodePortsKey = "node_ports";
127+ if (!json.IsObject() || !json.HasMember(nodePortsKey) || !json[nodePortsKey].IsArray()) {
128+ UBSE_LOG_ERROR << "Invalid URMA topo config node_ports";
129+ return UBSE_ERROR_INVAL;
130+ }
131+ 
132+ nodePorts.clear();
133+ for (const auto& portValue : json[nodePortsKey].GetArray()) {
134+ if (!portValue.IsString()) {
135+ UBSE_LOG_ERROR << "Invalid URMA topo config node port item";
136+ return UBSE_ERROR_INVAL;
137+ }
138+ UbseUrmaTopoPort port{};
139+ if (auto ret = ParseTopoPort(portValue.GetString(), port); ret != UBSE_OK) {
140+ return ret;
141+ }
142+ nodePorts.push_back(port);
143+ }
144+ return UBSE_OK;
145+}
146+ 
147+UbseResult ParseTopoLinks(const rapidjson::Value& json, std::vector<UbseUrmaTopoLink>& links)
148+{
149+ constexpr const char* linksKey = "links";
150+ constexpr const char* localPortKey = "local_port";
151+ constexpr const char* remotePortKey = "remote_port";
152+ if (!json.IsObject() || !json.HasMember(linksKey) || !json[linksKey].IsArray()) {
153+ UBSE_LOG_ERROR << "Invalid URMA topo config links";
154+ return UBSE_ERROR_INVAL;
155+ }
156+ 
157+ links.clear();
158+ for (const auto& linkValue : json[linksKey].GetArray()) {
159+ std::string localPortStr;
160+ std::string remotePortStr;
161+ if (GetJsonString(linkValue, localPortKey, localPortStr) != UBSE_OK ||
162+ GetJsonString(linkValue, remotePortKey, remotePortStr) != UBSE_OK) {
163+ return UBSE_ERROR_INVAL;
164+ }
165+ 
166+ UbseUrmaTopoLink link{};
167+ if (ParseTopoPort(localPortStr, link.localPort) != UBSE_OK ||
168+ ParseTopoPort(remotePortStr, link.remotePort) != UBSE_OK) {
169+ return UBSE_ERROR_INVAL;
170+ }
171+ links.push_back(link);
172+ }
173+ return UBSE_OK;
174+}
175+ 
176+UbseResult ParseUrmaTopoConfig(const std::string& topoFile, UbseUrmaTopoConfig& topoConfig)
177+{
178+ std::string content;
179+ if (auto ret = ReadTextFile(topoFile, content); ret != UBSE_OK) {
180+ return ret;
181+ }
182+ 
183+ rapidjson::Document doc;
184+ if (doc.Parse(content.c_str()).HasParseError() || !doc.IsObject()) {
185+ UBSE_LOG_ERROR << "Failed to parse URMA topo config json, file=" << topoFile;
186+ return UBSE_ERROR_INVAL;
187+ }
188+ 
189+ UbseUrmaTopoConfig parsedConfig{};
190+ if (GetJsonString(doc, "version", parsedConfig.version) != UBSE_OK ||
191+ GetJsonString(doc, "node_type", parsedConfig.nodeType) != UBSE_OK ||
192+ GetJsonString(doc, "link_type", parsedConfig.linkType) != UBSE_OK ||
193+ ParseTopoNodePorts(doc, parsedConfig.nodePorts) != UBSE_OK ||
194+ ParseTopoLinks(doc, parsedConfig.links) != UBSE_OK) {
195+ return UBSE_ERROR_INVAL;
196+ }
197+ 
198+ topoConfig = std::move(parsedConfig);
199+ return UBSE_OK;
200+}
201+ 
202+UbseResult LoadUrmaTopoConfig(UbseUrmaTopoMode topoMode, UbseUrmaTopoConfig& topoConfig)
203+{
204+ const std::string fileName = GetUrmaTopoConfigFileName(topoMode);
205+ const std::string filePath = std::string(URMA_TOPO_CONFIG_DIR) + "/" + fileName;
206+ auto ret = ParseUrmaTopoConfig(filePath, topoConfig);
207+ if (ret != UBSE_OK) {
208+ return ret;
209+ }
210+ 
211+ const std::string expectedLinkType = topoMode == UbseUrmaTopoMode::HCCS_CROSS ? URMA_TOPO_MODE_HCCS_CROSS :
212+ URMA_TOPO_MODE_NON_CROSS;
213+ if (topoConfig.linkType != expectedLinkType) {
214+ UBSE_LOG_ERROR << "URMA topo config link_type mismatch. expected=" << expectedLinkType
215+ << ", actual=" << topoConfig.linkType;
216+ return UBSE_ERROR_INVAL;
217+ }
218+ return UBSE_OK;
219+}
220+} // namespace ubse::urma
@@ -0,0 +1,57 @@
1+/*
2+ * Copyright (c) Huawei Technologies Co., Ltd. 2026-2026. All rights reserved.
3+ * ubs-engine is licensed under Mulan PSL v2.
4+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
5+ * You may obtain a copy of Mulan PSL v2 at:
6+ * http://license.coscl.org.cn/MulanPSL2
7+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10+ * See the Mulan PSL v2 for more details.
11+ */
12+ 
13+#ifndef UBSE_URMA_TOPO_CONFIG_H
14+#define UBSE_URMA_TOPO_CONFIG_H
15+ 
16+#include <cstdint>
17+#include <string>
18+#include <vector>
19+ 
20+#include "ubse_common_def.h"
21+ 
22+namespace ubse::urma {
23+using namespace ubse::common::def;
24+ 
25+struct UbseUrmaTopoPort {
26+ uint32_t chipId{0};
27+ uint32_t dieId{0};
28+ uint32_t portId{0};
29+};
30+ 
31+struct UbseUrmaTopoLink {
32+ UbseUrmaTopoPort localPort;
33+ UbseUrmaTopoPort remotePort;
34+};
35+ 
36+struct UbseUrmaTopoConfig {
37+ std::string version;
38+ std::string nodeType;
39+ std::string linkType;
40+ std::vector<UbseUrmaTopoPort> nodePorts;
41+ std::vector<UbseUrmaTopoLink> links;
42+};
43+ 
44+enum class UbseUrmaTopoMode
45+{
46+ NON_CROSS,
47+ HCCS_CROSS,
48+};
49+ 
50+UbseUrmaTopoMode GetUrmaTopoMode();
51+ 
52+UbseResult ParseUrmaTopoConfig(const std::string& topoFile, UbseUrmaTopoConfig& topoConfig);
53+ 
54+UbseResult LoadUrmaTopoConfig(UbseUrmaTopoMode topoMode, UbseUrmaTopoConfig& topoConfig);
55+} // namespace ubse::urma
56+ 
57+#endif // UBSE_URMA_TOPO_CONFIG_H
Msrc/adapter_plugins/urma_uvs/ubse_urma_uvs.cpp+104-51文件内容审核中,请稍后刷新重试
Msrc/include/adapter_plugins/urma/ubse_urma_uvs_module.h+10-15文件内容审核中,请稍后刷新重试
Mubs-engine.spec+5-0文件内容审核中,请稍后刷新重试