Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions conf/db/upgrade/V5.5.28__schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,104 @@ CALL ADD_COLUMN('ModelServiceTemplateVO', 'acceleratorType', 'VARCHAR(255)', 1,
CALL ADD_COLUMN('ModelServiceTemplateVO', 'imageNamePattern', 'VARCHAR(2048)', 1, NULL);
CALL CREATE_INDEX('ModelServiceTemplateVO', 'idxModelServiceTemplateModelServiceUuid', 'modelServiceUuid');
CALL DELETE_INDEX('ModelServiceTemplateVO', 'ukModelServiceCpuArch');

-- Host Model Cache control-plane state for VM/cloud-host model service deployments.
CREATE TABLE IF NOT EXISTS `zstack`.`AiHostModelCacheVO` (
`uuid` VARCHAR(32) NOT NULL,
`hostUuid` VARCHAR(32) NOT NULL,
`modelCenterUuid` VARCHAR(32) DEFAULT NULL,
`modelUuid` VARCHAR(32) DEFAULT NULL,
`sourceRoot` VARCHAR(2048) DEFAULT NULL,
`sourcePath` VARCHAR(2048) DEFAULT NULL,
`sizeBytes` BIGINT DEFAULT NULL,
`sourceMtime` BIGINT DEFAULT NULL,
`checksum` VARCHAR(255) DEFAULT NULL,
`contentVersion` VARCHAR(255) DEFAULT NULL,
`identityHash` VARCHAR(255) NOT NULL,
`status` VARCHAR(32) NOT NULL,
`desiredRefCount` BIGINT NOT NULL DEFAULT 0,
`runningRefCount` BIGINT NOT NULL DEFAULT 0,
`reservationUuid` VARCHAR(32) DEFAULT NULL,
`waiterCount` INT DEFAULT NULL,
`lastAccessDate` TIMESTAMP NULL DEFAULT NULL,
`lastSyncDate` TIMESTAMP NULL DEFAULT NULL,
`failurePhase` VARCHAR(64) DEFAULT NULL,
`failureCode` VARCHAR(64) DEFAULT NULL,
`failureMessage` MEDIUMTEXT DEFAULT NULL,
`createDate` TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00',
`lastOpDate` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`uuid`),
UNIQUE KEY `ukAiHostModelCacheVOHostIdentity` (`hostUuid`, `identityHash`),
KEY `idxAiHostModelCacheVOHostRoot` (`hostUuid`, `sourceRoot`(255)),
KEY `idxAiHostModelCacheVOModel` (`modelUuid`),
KEY `idxAiHostModelCacheVOStatus` (`status`),
CONSTRAINT `fkAiHostModelCacheVOHostEO`
FOREIGN KEY (`hostUuid`) REFERENCES `zstack`.`HostEO` (`uuid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `zstack`.`AiHostCacheStorageVO` (
`uuid` VARCHAR(32) NOT NULL,
`hostUuid` VARCHAR(32) NOT NULL,
`sourceRoot` VARCHAR(2048) NOT NULL,
`physicalTotalBytes` BIGINT DEFAULT NULL,
`physicalAvailableBytes` BIGINT DEFAULT NULL,
`policyUsedBytes` BIGINT DEFAULT NULL,
`unmanagedUsedBytesEstimate` BIGINT DEFAULT NULL,
`policyReservedBytes` BIGINT DEFAULT NULL,
`policyMaxSizeBytes` BIGINT DEFAULT NULL,
`effectiveAvailableBytes` BIGINT DEFAULT NULL,
`highWatermarkBytes` BIGINT DEFAULT NULL,
`lowWatermarkBytes` BIGINT DEFAULT NULL,
`status` VARCHAR(32) DEFAULT NULL,
`statusReason` VARCHAR(1024) DEFAULT NULL,
`lastSyncDate` TIMESTAMP NULL DEFAULT NULL,
`createDate` TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00',
`lastOpDate` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`uuid`),
UNIQUE KEY `ukAiHostCacheStorageVOHostRoot` (`hostUuid`, `sourceRoot`(255)),
KEY `idxAiHostCacheStorageVOStatus` (`status`),
CONSTRAINT `fkAiHostCacheStorageVOHostEO`
FOREIGN KEY (`hostUuid`) REFERENCES `zstack`.`HostEO` (`uuid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `zstack`.`AiHostModelCachePolicyVO` (
`uuid` VARCHAR(32) NOT NULL,
`hostUuid` VARCHAR(32) NOT NULL,
`sourceRoot` VARCHAR(2048) NOT NULL,
`enabled` TINYINT(1) DEFAULT NULL,
`maxSizeBytes` BIGINT DEFAULT NULL,
`highWatermarkPercent` INT DEFAULT NULL,
`lowWatermarkPercent` INT DEFAULT NULL,
`disabledReason` VARCHAR(1024) DEFAULT NULL,
`createDate` TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00',
`lastOpDate` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`uuid`),
UNIQUE KEY `ukAiHostModelCachePolicyVOHostRoot` (`hostUuid`, `sourceRoot`(255)),
CONSTRAINT `fkAiHostModelCachePolicyVOHostEO`
FOREIGN KEY (`hostUuid`) REFERENCES `zstack`.`HostEO` (`uuid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `zstack`.`AiHostModelCacheReservationVO` (
`uuid` VARCHAR(32) NOT NULL,
`hostUuid` VARCHAR(32) NOT NULL,
`sourceRoot` VARCHAR(2048) DEFAULT NULL,
`modelUuid` VARCHAR(32) DEFAULT NULL,
`modelCenterUuid` VARCHAR(32) DEFAULT NULL,
`ownerType` VARCHAR(32) NOT NULL,
`ownerResourceUuid` VARCHAR(32) NOT NULL,
`reservedBytes` BIGINT NOT NULL,
`status` VARCHAR(32) NOT NULL,
`expiredDate` TIMESTAMP NULL DEFAULT NULL,
`createDate` TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00',
`lastOpDate` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`uuid`),
KEY `idxAiHostModelCacheReservationVOHostRoot` (`hostUuid`, `sourceRoot`(255)),
KEY `idxAiHostModelCacheReservationVOOwner` (`ownerType`, `ownerResourceUuid`),
KEY `idxAiHostModelCacheReservationVOStatus` (`status`),
CONSTRAINT `fkAiHostModelCacheReservationVOHostEO`
FOREIGN KEY (`hostUuid`) REFERENCES `zstack`.`HostEO` (`uuid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CALL ADD_COLUMN('VmModelMountVO', 'cacheUuid', 'VARCHAR(32)', 1, NULL);
CALL CREATE_INDEX('VmModelMountVO', 'idxVmModelMountVOCacheUuid', 'cacheUuid');
CALL ADD_CONSTRAINT('VmModelMountVO', 'fkVmModelMountVOAiHostModelCacheVO', 'cacheUuid', 'AiHostModelCacheVO', 'uuid', 'SET NULL');
14 changes: 14 additions & 0 deletions sdk/src/main/java/SourceClassMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ public class SourceClassMap {
put("org.zstack.accessKey.AccessKeyState", "org.zstack.sdk.AccessKeyState");
put("org.zstack.accessKey.AccessKeyType", "org.zstack.sdk.AccessKeyType");
put("org.zstack.ai.NginxRedirectRule", "org.zstack.sdk.NginxRedirectRule");
put("org.zstack.ai.entity.AiHostCacheStorageInventory", "org.zstack.sdk.AiHostCacheStorageInventory");
put("org.zstack.ai.entity.AiHostCacheStorageStatus", "org.zstack.sdk.AiHostCacheStorageStatus");
put("org.zstack.ai.entity.AiHostModelCacheFailureCode", "org.zstack.sdk.AiHostModelCacheFailureCode");
put("org.zstack.ai.entity.AiHostModelCacheFailurePhase", "org.zstack.sdk.AiHostModelCacheFailurePhase");
put("org.zstack.ai.entity.AiHostModelCacheInventory", "org.zstack.sdk.AiHostModelCacheInventory");
put("org.zstack.ai.entity.AiHostModelCachePolicyInventory", "org.zstack.sdk.AiHostModelCachePolicyInventory");
put("org.zstack.ai.entity.AiHostModelCacheStatus", "org.zstack.sdk.AiHostModelCacheStatus");
put("org.zstack.ai.entity.ApplicationDevelopmentServiceInventory", "org.zstack.sdk.ApplicationDevelopmentServiceInventory");
put("org.zstack.ai.entity.CdnModelServiceTemplateInventory", "org.zstack.sdk.CdnModelServiceTemplateInventory");
put("org.zstack.ai.entity.DatasetInventory", "org.zstack.sdk.DatasetInventory");
Expand Down Expand Up @@ -933,6 +940,13 @@ public class SourceClassMap {
put("org.zstack.sdk.AffinityGroupInventory", "org.zstack.header.affinitygroup.AffinityGroupInventory");
put("org.zstack.sdk.AffinityGroupUsageInventory", "org.zstack.header.affinitygroup.AffinityGroupUsageInventory");
put("org.zstack.sdk.AgentVersionInventory", "org.zstack.core.upgrade.AgentVersionInventory");
put("org.zstack.sdk.AiHostCacheStorageInventory", "org.zstack.ai.entity.AiHostCacheStorageInventory");
put("org.zstack.sdk.AiHostCacheStorageStatus", "org.zstack.ai.entity.AiHostCacheStorageStatus");
put("org.zstack.sdk.AiHostModelCacheFailureCode", "org.zstack.ai.entity.AiHostModelCacheFailureCode");
put("org.zstack.sdk.AiHostModelCacheFailurePhase", "org.zstack.ai.entity.AiHostModelCacheFailurePhase");
put("org.zstack.sdk.AiHostModelCacheInventory", "org.zstack.ai.entity.AiHostModelCacheInventory");
put("org.zstack.sdk.AiHostModelCachePolicyInventory", "org.zstack.ai.entity.AiHostModelCachePolicyInventory");
put("org.zstack.sdk.AiHostModelCacheStatus", "org.zstack.ai.entity.AiHostModelCacheStatus");
put("org.zstack.sdk.AiSiNoSecretResourcePoolInventory", "org.zstack.crypto.securitymachine.thirdparty.aisino.AiSiNoSecretResourcePoolInventory");
put("org.zstack.sdk.AlertInventory", "org.zstack.monitoring.AlertInventory");
put("org.zstack.sdk.AliyunDiskInventory", "org.zstack.header.aliyun.storage.disk.AliyunDiskInventory");
Expand Down
127 changes: 127 additions & 0 deletions sdk/src/main/java/org/zstack/sdk/AiHostCacheStorageInventory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
package org.zstack.sdk;

import org.zstack.sdk.AiHostCacheStorageStatus;

public class AiHostCacheStorageInventory {

public java.lang.String uuid;
public void setUuid(java.lang.String uuid) {
this.uuid = uuid;
}
public java.lang.String getUuid() {
return this.uuid;
}

public java.lang.String hostUuid;
public void setHostUuid(java.lang.String hostUuid) {
this.hostUuid = hostUuid;
}
public java.lang.String getHostUuid() {
return this.hostUuid;
}

public java.lang.String sourceRoot;
public void setSourceRoot(java.lang.String sourceRoot) {
this.sourceRoot = sourceRoot;
}
public java.lang.String getSourceRoot() {
return this.sourceRoot;
}

public java.lang.Long physicalTotalBytes;
public void setPhysicalTotalBytes(java.lang.Long physicalTotalBytes) {
this.physicalTotalBytes = physicalTotalBytes;
}
public java.lang.Long getPhysicalTotalBytes() {
return this.physicalTotalBytes;
}

public java.lang.Long physicalAvailableBytes;
public void setPhysicalAvailableBytes(java.lang.Long physicalAvailableBytes) {
this.physicalAvailableBytes = physicalAvailableBytes;
}
public java.lang.Long getPhysicalAvailableBytes() {
return this.physicalAvailableBytes;
}

public java.lang.Long policyUsedBytes;
public void setPolicyUsedBytes(java.lang.Long policyUsedBytes) {
this.policyUsedBytes = policyUsedBytes;
}
public java.lang.Long getPolicyUsedBytes() {
return this.policyUsedBytes;
}

public java.lang.Long unmanagedUsedBytesEstimate;
public void setUnmanagedUsedBytesEstimate(java.lang.Long unmanagedUsedBytesEstimate) {
this.unmanagedUsedBytesEstimate = unmanagedUsedBytesEstimate;
}
public java.lang.Long getUnmanagedUsedBytesEstimate() {
return this.unmanagedUsedBytesEstimate;
}

public java.lang.Long policyReservedBytes;
public void setPolicyReservedBytes(java.lang.Long policyReservedBytes) {
this.policyReservedBytes = policyReservedBytes;
}
public java.lang.Long getPolicyReservedBytes() {
return this.policyReservedBytes;
}

public java.lang.Long policyMaxSizeBytes;
public void setPolicyMaxSizeBytes(java.lang.Long policyMaxSizeBytes) {
this.policyMaxSizeBytes = policyMaxSizeBytes;
}
public java.lang.Long getPolicyMaxSizeBytes() {
return this.policyMaxSizeBytes;
}

public java.lang.Long effectiveAvailableBytes;
public void setEffectiveAvailableBytes(java.lang.Long effectiveAvailableBytes) {
this.effectiveAvailableBytes = effectiveAvailableBytes;
}
public java.lang.Long getEffectiveAvailableBytes() {
return this.effectiveAvailableBytes;
}

public java.lang.Long highWatermarkBytes;
public void setHighWatermarkBytes(java.lang.Long highWatermarkBytes) {
this.highWatermarkBytes = highWatermarkBytes;
}
public java.lang.Long getHighWatermarkBytes() {
return this.highWatermarkBytes;
}

public java.lang.Long lowWatermarkBytes;
public void setLowWatermarkBytes(java.lang.Long lowWatermarkBytes) {
this.lowWatermarkBytes = lowWatermarkBytes;
}
public java.lang.Long getLowWatermarkBytes() {
return this.lowWatermarkBytes;
}

public AiHostCacheStorageStatus status;
public void setStatus(AiHostCacheStorageStatus status) {
this.status = status;
}
public AiHostCacheStorageStatus getStatus() {
return this.status;
}

public java.lang.String statusReason;
public void setStatusReason(java.lang.String statusReason) {
this.statusReason = statusReason;
}
public java.lang.String getStatusReason() {
return this.statusReason;
}

public java.sql.Timestamp lastSyncDate;
public void setLastSyncDate(java.sql.Timestamp lastSyncDate) {
this.lastSyncDate = lastSyncDate;
}
public java.sql.Timestamp getLastSyncDate() {
return this.lastSyncDate;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.zstack.sdk;

public enum AiHostCacheStorageStatus {
Healthy,
Unknown,
PhysicalInsufficient,
PolicyInsufficient,
Disabled,
}
11 changes: 11 additions & 0 deletions sdk/src/main/java/org/zstack/sdk/AiHostModelCacheFailureCode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.zstack.sdk;

public enum AiHostModelCacheFailureCode {
JuicefsMountFailed,
JuicefsWarmupFailed,
InsufficientHostCacheStorage,
SourcePathInvalid,
PermissionDenied,
AgentTimeout,
Unknown,
}
10 changes: 10 additions & 0 deletions sdk/src/main/java/org/zstack/sdk/AiHostModelCacheFailurePhase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.zstack.sdk;

public enum AiHostModelCacheFailurePhase {
ModelSourceMount,
ModelSourceWarmup,
PreparedSourceValidation,
CapacityCheck,
AgentExecution,
Unknown,
}
Loading