-
Notifications
You must be signed in to change notification settings - Fork 0
<fix>[sharedblock]: convert memory snapshot install path from absolute path to protocol path #2889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 5.4.2
Are you sure you want to change the base?
Changes from all commits
bc338a4
b0f8057
b0795d2
8e68faf
cbf8971
d65ecbd
f6a093c
92abd58
b2f4bff
a9d5e4f
7f38521
fb51207
ed4dca5
a36167c
e8785c0
c2be944
c682625
a9e47e9
f3cf729
8199952
0fd7092
48ecbf2
48ec0ec
6627fc1
fbd14ba
ae91aba
5d16c0c
c25cfa1
cce827d
7f5c5cf
d6f928c
fa23178
18692ef
73bccac
e4cd827
1372396
9741abc
8e2f5a1
2048e5b
7b64894
1d32a1e
21cea27
c816315
e0cb873
2de68d8
1d5b821
2658553
55a16d3
7ad8dac
0e89e5a
1722dc7
4a2c551
6c8be0f
845671d
50df70c
6b6c758
8de02f3
4baa981
e4da6d5
c56778a
1afe6f2
988e33e
cb9e3f3
05817d1
cf723d4
6124ca4
938e84b
9445647
a56d7a6
8f59d57
4a61ea1
a543629
cfb74be
5be68d9
4f7be58
efb1d9a
1ae8682
9314491
e00716d
30f8a35
440f0fb
d30cc1c
2241420
0c852e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| MAJOR=5 | ||
| MINOR=4 | ||
| UPDATE=2 | ||
| UPDATE=6 |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,17 @@ | ||||||||||||||||||||||||||||
| package org.zstack.compute.allocator; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| public interface SysComponentMemUsageExtensionPoint { | ||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||
| * Retrieves the amount of huge page memory used by the system component (in byte). | ||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||
| * @return the number of byte of huge page memory in use | ||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||
| long getHugePageMemoryUsage(String hostUuid); | ||||||||||||||||||||||||||||
|
Comment on lines
+4
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 完善 Javadoc 文档并修正语法错误。 该方法的 Javadoc 存在以下问题:
根据编码规范,接口方法必须配有完整有效的 Javadoc 注释,包括所有参数的说明。 🔎 建议的修复 /**
- * Retrieves the amount of huge page memory used by the system component (in byte).
+ * Retrieves the amount of huge page memory used by the system component (in bytes).
*
- * @return the number of byte of huge page memory in use
+ * @param hostUuid the UUID of the host
+ * @return the number of bytes of huge page memory in use
*/
long getHugePageMemoryUsage(String hostUuid);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||
| * Retrieves the amount of normal memory used by the system component (in byte). | ||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||
| * @return the number of byte of normal memory in use | ||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||
| long getNormalMemoryUsage(String hostUuid); | ||||||||||||||||||||||||||||
|
Comment on lines
+11
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 完善 Javadoc 文档并修正语法错误。 该方法的 Javadoc 存在与
🔎 建议的修复 /**
- * Retrieves the amount of normal memory used by the system component (in byte).
+ * Retrieves the amount of normal memory used by the system component (in bytes).
*
- * @return the number of byte of normal memory in use
+ * @param hostUuid the UUID of the host
+ * @return the number of bytes of normal memory in use
*/
long getNormalMemoryUsage(String hostUuid);🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,8 @@ | |
| import org.zstack.compute.VmNicUtils; | ||
| import org.zstack.core.cloudbus.CloudBus; | ||
| import org.zstack.core.componentloader.PluginRegistry; | ||
| import org.zstack.core.config.GlobalConfigVO; | ||
| import org.zstack.core.config.GlobalConfigVO_; | ||
| import org.zstack.core.db.*; | ||
| import org.zstack.core.db.SimpleQuery.Op; | ||
| import org.zstack.header.apimediator.ApiMessageInterceptionException; | ||
|
|
@@ -137,6 +139,8 @@ else if (msg instanceof APIAttachVmNicToVmMsg) { | |
| validate((APIUpdateVmInstanceMsg) msg); | ||
| } else if (msg instanceof APISetVmConsolePasswordMsg) { | ||
| validate((APISetVmConsolePasswordMsg) msg); | ||
| } else if (msg instanceof APIUpdateConsolePasswordMsg) { | ||
| validate((APIUpdateConsolePasswordMsg) msg); | ||
| } else if (msg instanceof APIChangeInstanceOfferingMsg) { | ||
| validate((APIChangeInstanceOfferingMsg) msg); | ||
| } else if (msg instanceof APIMigrateVmMsg) { | ||
|
|
@@ -1533,6 +1537,23 @@ private void validate(APISetVmConsolePasswordMsg msg) { | |
| } | ||
| } | ||
|
|
||
| private void validate(APIUpdateConsolePasswordMsg msg) { | ||
| VmInstanceVO vm = dbf.findByUuid(msg.getUuid(), VmInstanceVO.class); | ||
| if (vm.getState() != VmInstanceState.Running) { | ||
| throw new ApiMessageInterceptionException(operr( | ||
| "Cannot update console password for VM[uuid:%s] because it is not in 'Running' state. Current state is '%s'.", | ||
| vm.getUuid(), vm.getState() | ||
| )); | ||
| } | ||
| boolean hasPassword = VmSystemTags.CONSOLE_PASSWORD.hasTag(vm.getUuid()); | ||
| if (!hasPassword) { | ||
| throw new ApiMessageInterceptionException(operr( | ||
| "Cannot update the console password for VM[uuid:%s] because no console password is currently set. ", | ||
| vm.getUuid() | ||
| )); | ||
| } | ||
| } | ||
|
Comment on lines
+1540
to
+1555
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 缺少密码格式验证。 当前验证方法检查了虚拟机状态和控制台密码是否存在,但缺少对新密码内容的格式验证。 参考同文件中 if (pwd.startsWith("password")){
throw new ApiMessageInterceptionException(argerr("The console password cannot start with 'password' which may trigger a VNC security issue"));
}建议在 🔎 建议的修复 private void validate(APIUpdateConsolePasswordMsg msg) {
VmInstanceVO vm = dbf.findByUuid(msg.getUuid(), VmInstanceVO.class);
if (vm.getState() != VmInstanceState.Running) {
throw new ApiMessageInterceptionException(operr(
"Cannot update console password for VM[uuid:%s] because it is not in 'Running' state. Current state is '%s'.",
vm.getUuid(), vm.getState()
));
}
boolean hasPassword = VmSystemTags.CONSOLE_PASSWORD.hasTag(vm.getUuid());
if (!hasPassword) {
throw new ApiMessageInterceptionException(operr(
"Cannot update the console password for VM[uuid:%s] because no console password is currently set. ",
vm.getUuid()
));
}
+ String pwd = msg.getPassword();
+ if (pwd.startsWith("password")){
+ throw new ApiMessageInterceptionException(argerr("The console password cannot start with 'password' which may trigger a VNC security issue"));
+ }
}🤖 Prompt for AI Agents |
||
|
|
||
| private void validate(APIAttachL3NetworkToVmNicMsg msg) { | ||
| throw new ApiMessageInterceptionException(argerr("can not call this api because it's Deprecated")); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
条件判断中的错误抑制可能掩盖问题
在第 35 行,数值比较
[ "$db_version" -ge 8 ] 2>/dev/null使用了错误重定向。虽然之前有回退机制,但如果db_version变量包含非数字值,这个条件会静默失败并跳过该分支。建议在条件判断前显式验证
db_version是否为有效数字,使脚本行为更可预测。🔎 建议的改进方案
📝 Committable suggestion