forked from zstackio/zstack
-
Notifications
You must be signed in to change notification settings - Fork 0
<feature>[vm_local_volume_cache]: vm local volume cache imp #3406
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
Open
zstack-robot-2
wants to merge
1
commit into
feature-5.5.6-local-cache
Choose a base branch
from
sync/haidong.pang/feature/ZSTAC-81715
base: feature-5.5.6-local-cache
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| CREATE TABLE IF NOT EXISTS `VmLocalVolumeCachePoolVO` ( | ||
| `uuid` VARCHAR(32) NOT NULL, | ||
| `hostUuid` VARCHAR(32) NOT NULL, | ||
| `name` VARCHAR(255) DEFAULT NULL, | ||
| `description` VARCHAR(2048) DEFAULT NULL, | ||
| `metadata` VARCHAR(2048) DEFAULT NULL, | ||
| `totalCapacity` BIGINT NOT NULL DEFAULT 0, | ||
| `availableCapacity` BIGINT NOT NULL DEFAULT 0, | ||
| `state` VARCHAR(32) NOT NULL, | ||
| `status` VARCHAR(32) NOT NULL, | ||
| `createDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| `lastOpDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
| PRIMARY KEY (`uuid`), | ||
| CONSTRAINT `fkVmLocalVolumeCachePoolVOHostEO` | ||
| FOREIGN KEY (`hostUuid`) REFERENCES `HostEO` (`uuid`) | ||
| ON DELETE CASCADE | ||
| ) ENGINE = InnoDB DEFAULT CHARSET = utf8; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS `VmLocalVolumeCacheVO` ( | ||
| `uuid` VARCHAR(32) NOT NULL, | ||
| `volumeUuid` VARCHAR(32) NOT NULL, | ||
| `poolUuid` VARCHAR(32) DEFAULT NULL, | ||
| `cacheMode` VARCHAR(32) NOT NULL, | ||
| `state` VARCHAR(32) NOT NULL, | ||
| `createDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| `lastOpDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
| PRIMARY KEY (`uuid`), | ||
| UNIQUE KEY `uniVmLocalVolumeCacheVOVolumeUuid` (`volumeUuid`), | ||
| CONSTRAINT `fkVmLocalVolumeCacheVOVolumeEO` | ||
| FOREIGN KEY (`volumeUuid`) REFERENCES `VolumeEO` (`uuid`) | ||
| ON DELETE CASCADE, | ||
| CONSTRAINT `fkVmLocalVolumeCacheVOPoolUuid` | ||
| FOREIGN KEY (`poolUuid`) REFERENCES `VmLocalVolumeCachePoolVO` (`uuid`) | ||
| ON DELETE SET NULL | ||
| ) ENGINE = InnoDB DEFAULT CHARSET = utf8; | ||
|
Comment on lines
+19
to
+35
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. 缺少 当前 🛠 建议修复 CREATE TABLE IF NOT EXISTS `VmLocalVolumeCacheVO` (
`uuid` VARCHAR(32) NOT NULL,
`volumeUuid` VARCHAR(32) NOT NULL,
`poolUuid` VARCHAR(32) DEFAULT NULL,
+ `installPath` VARCHAR(2048) DEFAULT NULL,
`cacheMode` VARCHAR(32) NOT NULL,
`state` VARCHAR(32) NOT NULL,
`createDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`lastOpDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,🤖 Prompt for AI Agents |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <service xmlns="http://zstack.org/schema/zstack"> | ||
| <id>vmLocalVolumeCache</id> | ||
|
|
||
| <message> | ||
| <name>org.zstack.header.localVolumeCache.APIEnableVolumeCacheMsg</name> | ||
| </message> | ||
|
|
||
| <message> | ||
| <name>org.zstack.header.localVolumeCache.APIDisableVolumeCacheMsg</name> | ||
| </message> | ||
| </service> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <service xmlns="http://zstack.org/schema/zstack"> | ||
| <id>vmLocalVolumeCachePool</id> | ||
|
|
||
| <message> | ||
| <name>org.zstack.header.localVolumeCache.APICreateVmLocalVolumeCachePoolMsg</name> | ||
| </message> | ||
|
|
||
| <message> | ||
| <name>org.zstack.header.localVolumeCache.APIDeleteVmLocalVolumeCachePoolMsg</name> | ||
| </message> | ||
|
|
||
| <message> | ||
| <name>org.zstack.header.localVolumeCache.APIUpdateVmLocalVolumeCachePoolMsg</name> | ||
| </message> | ||
|
|
||
| <message> | ||
| <name>org.zstack.header.localVolumeCache.APIChangeVmLocalVolumeCachePoolStateMsg</name> | ||
| </message> | ||
|
|
||
| <message> | ||
| <name>org.zstack.header.localVolumeCache.APIReconnectVmLocalVolumeCachePoolMsg</name> | ||
| </message> | ||
|
|
||
| <message> | ||
| <name>org.zstack.header.localVolumeCache.APIExtendVmLocalVolumeCachePoolMsg</name> | ||
| </message> | ||
|
|
||
| <message> | ||
| <name>org.zstack.header.localVolumeCache.APISyncVmLocalVolumeCachePoolCapacityMsg</name> | ||
| </message> | ||
|
|
||
| <message> | ||
| <name>org.zstack.header.localVolumeCache.APIQueryVmLocalVolumeCachePoolMsg</name> | ||
| <serviceId>query</serviceId> | ||
| </message> | ||
| </service> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
根卷缓存大小计算缺少 ISO 分支,可能导致主机分配误判。
当前只要
image存在就优先用image.getSize()。但 ISO 场景根卷大小应来自 root disk offering(与本文件prepareMsg的根盘计算逻辑不一致),否则会把 ISO 体积当作缓存需求,放大requiredSize约束。🔧 建议修改
if (enableRoot) { - // Root volume size: from image size or root disk offering - ImageInventory image = spec.getImageSpec().getInventory(); - if (image != null && image.getSize() != 0) { - totalCacheSize += image.getSize(); - } else if (spec.getRootDiskOffering() != null) { - totalCacheSize += spec.getRootDiskOffering().getDiskSize(); - } + // Root volume size: ISO场景取root disk offering,其它镜像优先取image size + ImageInventory image = spec.getImageSpec() == null ? null : spec.getImageSpec().getInventory(); + boolean nonIsoImage = image != null && !ImageMediaType.ISO.toString().equals(image.getMediaType()); + if (nonIsoImage && image.getSize() > 0) { + totalCacheSize += image.getSize(); + } else if (spec.getRootDiskOffering() != null) { + totalCacheSize += spec.getRootDiskOffering().getDiskSize(); + } }🤖 Prompt for AI Agents