Copilot commented on code in PR #13907:
URL: https://github.com/apache/cloudstack/pull/13907#discussion_r3871750553
##########
engine/schema/src/main/resources/META-INF/db/schema-42210to42300.sql:
##########
@@ -651,3 +651,91 @@ WHERE `name`='user.vm.readonly.details' AND `value` IS NOT
NULL;
-- usage records introduced in 4.22.1 (cumulative and per-VM) can coexist. See
#13399.
CALL `cloud_usage`.`IDEMPOTENT_DROP_INDEX`('id', 'cloud_usage.usage_volume');
CALL `cloud_usage`.`IDEMPOTENT_ADD_UNIQUE_INDEX`('cloud_usage.usage_volume',
'id', '(volume_id ASC, created ASC, vm_id ASC)');
+
+-- InstanceBootGroup: ordered boot sequencing for VMs and InstanceGroups
+CREATE TABLE IF NOT EXISTS `cloud`.`instance_boot_group` (
+ `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT,
+ `uuid` varchar(40) NOT NULL,
+ `name` varchar(255) NOT NULL,
+ `description` varchar(4096) DEFAULT NULL,
+ `account_id` bigint unsigned NOT NULL COMMENT 'owner; foreign key to
account table',
+ `domain_id` bigint unsigned NOT NULL,
+ `created` datetime NOT NULL,
+ `removed` datetime DEFAULT NULL COMMENT 'date the group was
soft-deleted',
+ PRIMARY KEY (`id`),
+ CONSTRAINT `uc_instance_boot_group__uuid` UNIQUE (`uuid`),
+ CONSTRAINT `fk_instance_boot_group__account_id` FOREIGN KEY (`account_id`)
REFERENCES `account` (`id`),
+ CONSTRAINT `fk_instance_boot_group__domain_id` FOREIGN KEY (`domain_id`)
REFERENCES `domain` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+CREATE TABLE IF NOT EXISTS `cloud`.`instance_boot_group_member` (
+ `id` bigint unsigned NOT NULL AUTO_INCREMENT,
+ `uuid` varchar(40) NOT NULL,
+ `boot_group_id` bigint unsigned NOT NULL,
+ `member_type` varchar(32) NOT NULL COMMENT 'VirtualMachine or
InstanceGroup',
+ `member_id` bigint unsigned NOT NULL,
+ `order` int NOT NULL DEFAULT 0,
+ `created` datetime NOT NULL,
+ PRIMARY KEY (`id`),
+ CONSTRAINT `uc_instance_boot_group_member__uuid` UNIQUE (`uuid`),
+ CONSTRAINT `uq_instance_boot_group_member__member` UNIQUE (`member_type`,
`member_id`),
+ CONSTRAINT `fk_instance_boot_group_member__group_id` FOREIGN KEY
(`boot_group_id`) REFERENCES `instance_boot_group` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- InstanceBootGroupReadinessRule: a readiness rule always belongs to exactly
one boot group and
+-- references either a VirtualMachine or InstanceGroup item within it
+CREATE TABLE IF NOT EXISTS `cloud`.`instance_boot_group_readiness_rule` (
+ `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT,
+ `uuid` varchar(40) NOT NULL,
+ `name` varchar(255) NOT NULL,
+ `boot_group_id` bigint unsigned NOT NULL,
+ `item_type` varchar(32) NOT NULL COMMENT 'VirtualMachine or
InstanceGroup',
+ `item_id` bigint unsigned NOT NULL,
+ `rule_type` varchar(64) NOT NULL,
+ `enabled` tinyint(1) NOT NULL DEFAULT 1,
+ `created` datetime NOT NULL,
+ `removed` datetime DEFAULT NULL COMMENT 'date the rule was
soft-deleted',
+ PRIMARY KEY (`id`),
+ CONSTRAINT `uc_instance_boot_group_readiness_rule__uuid` UNIQUE
(`uuid`),
+ CONSTRAINT `fk_instance_boot_group_readiness_rule__group_id` FOREIGN KEY
(`boot_group_id`) REFERENCES `instance_boot_group` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- Generic key/value config for a readiness rule (port/protocol, script
content, threshold, ...);
+-- the 'script' key is encrypted at rest by the DAO for CUSTOM_SCRIPT rules
+CREATE TABLE IF NOT EXISTS
`cloud`.`instance_boot_group_readiness_rule_details` (
+ `id` bigint unsigned NOT NULL AUTO_INCREMENT,
+ `rule_id` bigint unsigned NOT NULL,
+ `name` varchar(255) NOT NULL,
+ `value` text DEFAULT NULL,
+ `display` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Whether detail be
displayed to the end user',
+ PRIMARY KEY (`id`),
+ CONSTRAINT `fk_instance_boot_group_readiness_rule_details__rule_id`
FOREIGN KEY (`rule_id`) REFERENCES `instance_boot_group_readiness_rule` (`id`)
ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+
+-- Last cached evaluation result for a readiness rule, upserted in place (no
history, by design).
+-- vm_id=0 is the rule's "own" row (a VM-scoped rule's single target, or a
group-scoped rule's
+-- all-members aggregate); a group-scoped rule inherited by its members
additionally gets one row
+-- per (rule_id, vm_id) for that member's own individual result.
+CREATE TABLE IF NOT EXISTS
`cloud`.`instance_boot_group_readiness_check_result` (
+ `id` bigint unsigned NOT NULL AUTO_INCREMENT,
+ `rule_id` bigint unsigned NOT NULL,
+ `vm_id` bigint unsigned NOT NULL DEFAULT 0,
+ `status` varchar(32) NOT NULL DEFAULT 'UNKNOWN',
+ `message` varchar(4096) DEFAULT NULL,
Review Comment:
`instance_boot_group_readiness_check_result.status` defaults to 'UNKNOWN',
but the Java enum persisted with `@Enumerated(EnumType.STRING)` is
`InstanceBootGroupReadinessRule.Status.Unknown` (CamelCase). If the DB default
is ever used (or legacy rows contain 'UNKNOWN'), JPA enum mapping will fail to
deserialize the row.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]