forked from zstackio/zstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Draft: <feature>[physicalServer]: SUG-1461 add assignment foundation #4690
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
wants to merge
1
commit into
5.5.38
Choose a base branch
from
sync/jin.ma/fix/SUG-1461
base: 5.5.38
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| CREATE TABLE IF NOT EXISTS `zstack`.`PhysicalServerVO` ( | ||
| `uuid` varchar(32) NOT NULL, | ||
| `zoneUuid` varchar(32) DEFAULT NULL, | ||
| `poolUuid` varchar(32) DEFAULT NULL, | ||
| `serialNumber` varchar(255) NOT NULL, | ||
| `createDate` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00', | ||
| `lastOpDate` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00' ON UPDATE CURRENT_TIMESTAMP, | ||
| PRIMARY KEY (`uuid`), | ||
| UNIQUE KEY `ukPhysicalServerSerialNumber` (`serialNumber`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
|
|
||
| CREATE TABLE IF NOT EXISTS `zstack`.`PhysicalServerResourceAssignmentVO` ( | ||
| `uuid` varchar(32) NOT NULL, | ||
| `serverUuid` varchar(32) NOT NULL, | ||
| `resourceType` varchar(32) NOT NULL, | ||
| `assignmentType` varchar(64) NOT NULL, | ||
| `spec` text NOT NULL, | ||
| `specGeneration` bigint NOT NULL DEFAULT 1, | ||
| `status` text DEFAULT NULL, | ||
| `observedGeneration` bigint DEFAULT NULL, | ||
| `observedAt` timestamp NULL DEFAULT NULL, | ||
| `createDate` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00', | ||
| `lastOpDate` timestamp NOT NULL DEFAULT '2000-01-01 00:00:00' ON UPDATE CURRENT_TIMESTAMP, | ||
| PRIMARY KEY (`uuid`), | ||
| UNIQUE KEY `ukPhysicalServerResourceAssignment` (`serverUuid`, `resourceType`, `assignmentType`), | ||
| CONSTRAINT `fkPhysicalServerResourceAssignmentServerUuid` | ||
| FOREIGN KEY (`serverUuid`) REFERENCES `zstack`.`PhysicalServerVO` (`uuid`) ON DELETE CASCADE | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
|
|
||
| CALL ADD_COLUMN('HostEO', 'serverUuid', 'VARCHAR(32)', 1, NULL); | ||
| CALL ADD_COLUMN('ManagementNodeVO', 'serverUuid', 'VARCHAR(32)', 1, NULL); | ||
|
|
||
| UPDATE `zstack`.`HostEO` | ||
| SET `serverUuid` = NULL | ||
| WHERE `deleted` IS NOT NULL AND `serverUuid` IS NOT NULL; | ||
|
|
||
| DROP PROCEDURE IF EXISTS addPhysicalServerIdentityUniqueKeys; | ||
| DELIMITER $$ | ||
| CREATE PROCEDURE addPhysicalServerIdentityUniqueKeys() | ||
| BEGIN | ||
| IF NOT EXISTS ( | ||
| SELECT 1 FROM information_schema.statistics | ||
| WHERE table_schema = 'zstack' | ||
| AND table_name = 'HostEO' | ||
| AND index_name = 'ukHostEOServerUuid' | ||
| ) THEN | ||
| ALTER TABLE `zstack`.`HostEO` | ||
| ADD UNIQUE KEY `ukHostEOServerUuid` (`serverUuid`); | ||
| END IF; | ||
|
|
||
| IF NOT EXISTS ( | ||
| SELECT 1 FROM information_schema.statistics | ||
| WHERE table_schema = 'zstack' | ||
| AND table_name = 'ManagementNodeVO' | ||
| AND index_name = 'ukManagementNodeVOServerUuid' | ||
| ) THEN | ||
| ALTER TABLE `zstack`.`ManagementNodeVO` | ||
| ADD UNIQUE KEY `ukManagementNodeVOServerUuid` (`serverUuid`); | ||
| END IF; | ||
| END $$ | ||
| DELIMITER ; | ||
| CALL addPhysicalServerIdentityUniqueKeys(); | ||
| DROP PROCEDURE IF EXISTS addPhysicalServerIdentityUniqueKeys; | ||
|
|
||
| CALL ADD_CONSTRAINT( | ||
| 'HostEO', | ||
| 'fkHostEOServerUuid', | ||
| 'serverUuid', | ||
| 'PhysicalServerVO', | ||
| 'uuid', | ||
| 'SET NULL' | ||
| ); | ||
|
|
||
| DROP VIEW IF EXISTS `zstack`.`HostVO`; | ||
| CREATE VIEW `zstack`.`HostVO` AS | ||
| SELECT uuid, zoneUuid, clusterUuid, name, description, managementIp, hypervisorType, | ||
| state, status, createDate, lastOpDate, architecture, serverUuid | ||
| FROM `zstack`.`HostEO` | ||
| WHERE deleted IS NULL; | ||
|
|
||
| CALL ADD_CONSTRAINT( | ||
| 'ManagementNodeVO', | ||
| 'fkManagementNodeVOServerUuid', | ||
| 'serverUuid', | ||
| 'PhysicalServerVO', | ||
| 'uuid', | ||
| 'SET NULL' | ||
| ); | ||
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,23 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <service xmlns="http://zstack.org/schema/zstack"> | ||
| <id>physicalServer</id> | ||
| <interceptor>PhysicalServerApiInterceptor</interceptor> | ||
|
|
||
| <message> | ||
| <name>org.zstack.physicalserver.APIQueryPhysicalServerMsg</name> | ||
| <serviceId>query</serviceId> | ||
| </message> | ||
|
|
||
| <message> | ||
| <name>org.zstack.physicalserver.APIQueryPhysicalServerResourceAssignmentMsg</name> | ||
| <serviceId>query</serviceId> | ||
| </message> | ||
|
|
||
| <message> | ||
| <name>org.zstack.physicalserver.APIUpdatePhysicalServerCpuAssignmentMsg</name> | ||
| </message> | ||
|
|
||
| <message> | ||
| <name>org.zstack.physicalserver.APIRefreshPhysicalServerCpuIsolationMsg</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 |
|---|---|---|
|
|
@@ -74,4 +74,4 @@ | |
| </zstack:plugin> | ||
| </bean> | ||
|
|
||
| </beans> | ||
| </beans> | ||
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,55 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <beans xmlns="http://www.springframework.org/schema/beans" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xmlns:zstack="http://zstack.org/schema/zstack" | ||
| xsi:schemaLocation="http://www.springframework.org/schema/beans | ||
| http://www.springframework.org/schema/beans/spring-beans-3.0.xsd | ||
| http://zstack.org/schema/zstack | ||
| http://zstack.org/schema/zstack/plugin.xsd" | ||
| default-init-method="init" default-destroy-method="destroy"> | ||
|
|
||
| <bean id="PhysicalServerAssignmentRepository" | ||
| class="org.zstack.physicalserver.PhysicalServerAssignmentRepository"/> | ||
|
|
||
| <bean id="PhysicalServerIdentityService" | ||
| class="org.zstack.physicalserver.PhysicalServerIdentityService"/> | ||
|
|
||
| <bean id="PhysicalServerCpuPlanner" | ||
| class="org.zstack.physicalserver.PhysicalServerCpuPlanner"/> | ||
|
|
||
| <bean id="PhysicalServerCpuAssignmentHandler" | ||
| class="org.zstack.physicalserver.PhysicalServerCpuAssignmentHandler"> | ||
| <zstack:plugin> | ||
| <zstack:extension interface="org.zstack.physicalserver.PhysicalServerResourceAssignmentHandler"/> | ||
| </zstack:plugin> | ||
| </bean> | ||
|
|
||
| <bean id="PhysicalServerCpuReconciler" | ||
| class="org.zstack.physicalserver.PhysicalServerCpuReconciler"/> | ||
|
|
||
| <bean id="PhysicalServerSharedCpuReconciler" | ||
| class="org.zstack.physicalserver.PhysicalServerSharedCpuReconciler"/> | ||
|
|
||
| <bean id="FakeZbsCpuIsolationProvider" | ||
| class="org.zstack.physicalserver.FakeZbsCpuIsolationProvider"> | ||
| <zstack:plugin> | ||
| <zstack:extension interface="org.zstack.physicalserver.ZbsCpuIsolationProvider"/> | ||
| </zstack:plugin> | ||
| </bean> | ||
|
|
||
| <bean id="PhysicalServerManager" class="org.zstack.physicalserver.PhysicalServerManagerImpl"> | ||
| <zstack:plugin> | ||
| <zstack:extension interface="org.zstack.header.Component"/> | ||
| <zstack:extension interface="org.zstack.header.Service"/> | ||
| <zstack:extension interface="org.zstack.header.managementnode.ManagementNodeReadyExtensionPoint"/> | ||
| <zstack:extension interface="org.zstack.header.physicalserver.PhysicalServerManager"/> | ||
| </zstack:plugin> | ||
| </bean> | ||
|
|
||
| <bean id="PhysicalServerApiInterceptor" | ||
| class="org.zstack.physicalserver.PhysicalServerApiInterceptor"> | ||
| <zstack:plugin> | ||
| <zstack:extension interface="org.zstack.header.apimediator.ApiMessageInterceptor"/> | ||
| </zstack:plugin> | ||
| </bean> | ||
| </beans> |
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
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.
🗄️ Data Integrity & Integration | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: MatheMatrix/zstack
Length of output: 1433
🏁 Script executed:
Repository: MatheMatrix/zstack
Length of output: 16161
🌐 Web query:
MySQL 5.7 reference manual BLOB TEXT columns cannot have default values💡 Result:
According to the official MySQL 5.7 Reference Manual, it is correct that BLOB and TEXT columns cannot be assigned default values [1][2][3]. The documentation explicitly states in the sections regarding data type default values and BLOB/TEXT types that these columns cannot have DEFAULT values [1][2][4][3]. This restriction also applies to the GEOMETRY and JSON data types [1][4].
Citations:
删除
status的DEFAULT NULL。MySQL 5.7 不允许
TEXT列声明默认值。该定义会导致建表失败。省略DEFAULT NULL即可,status仍允许为NULL。建议修复
📝 Committable suggestion
🤖 Prompt for AI Agents
Source: Learnings