diff --git a/compute/src/main/java/org/zstack/compute/vm/AbstractVmInstance.java b/compute/src/main/java/org/zstack/compute/vm/AbstractVmInstance.java index ae8202993c0..1e76597ede6 100755 --- a/compute/src/main/java/org/zstack/compute/vm/AbstractVmInstance.java +++ b/compute/src/main/java/org/zstack/compute/vm/AbstractVmInstance.java @@ -41,6 +41,7 @@ public abstract class AbstractVmInstance implements VmInstance { allowedOperations.addState(VmInstanceState.Running, APIStopVmInstanceMsg.class.getName(), StopVmInstanceMsg.class.getName(), + GetVmStartingCandidateClustersHostsMsg.class.getName(), APIStartVmInstanceMsg.class.getName(), StartVmInstanceMsg.class.getName(), APIRebootVmInstanceMsg.class.getName(), diff --git a/compute/src/main/java/org/zstack/compute/vm/VmInstanceBase.java b/compute/src/main/java/org/zstack/compute/vm/VmInstanceBase.java index e5065e0f06a..36f5d714bc4 100755 --- a/compute/src/main/java/org/zstack/compute/vm/VmInstanceBase.java +++ b/compute/src/main/java/org/zstack/compute/vm/VmInstanceBase.java @@ -852,6 +852,14 @@ public void fail(ErrorCode errorCode) { private void handle(final APIGetVmStartingCandidateClustersHostsMsg msg) { APIGetVmStartingCandidateClustersHostsReply reply = new APIGetVmStartingCandidateClustersHostsReply(); + refreshVO(); + ErrorCode err = validateOperationByState(msg, self.getState(), SysErrors.OPERATION_ERROR); + if (err != null) { + reply.setError(err); + bus.reply(msg, reply); + return; + } + final GetVmStartingCandidateClustersHostsMsg gmsg = new GetVmStartingCandidateClustersHostsMsg(); gmsg.setUuid(msg.getUuid()); bus.makeLocalServiceId(gmsg, VmInstanceConstant.SERVICE_ID); diff --git a/conf/i18n/globalErrorCodeMapping/global-error-en_US.json b/conf/i18n/globalErrorCodeMapping/global-error-en_US.json index 8fda69f4152..bbc91078d2f 100644 --- a/conf/i18n/globalErrorCodeMapping/global-error-en_US.json +++ b/conf/i18n/globalErrorCodeMapping/global-error-en_US.json @@ -3266,6 +3266,19 @@ "ORG_ZSTACK_STORAGE_PRIMARY_LOCAL_10054": "The host [UUID:%s] is not associated with the local primary storage [UUID:%s].", "ORG_ZSTACK_KVM_10040": "failed to increase VM CPU count, error details: %s", "ORG_ZSTACK_HA_10018": "the VM[uuid:%s] volume stored location primary storage is undergoing maintenance", + "ORG_ZSTACK_HA_10041": "HA network-group conditional stop refused for VM[uuid:%s] because the feature is unavailable", + "ORG_ZSTACK_HA_10042": "HA network-group conditional stop refused because the VM inventory is missing", + "ORG_ZSTACK_HA_10043": "HA network-group conditional stop refused for VM[uuid:%s] because its HA level is not NeverStop", + "ORG_ZSTACK_HA_10044": "HA network-group conditional stop refused for VM[uuid:%s] because INHIBIT_HA is set", + "ORG_ZSTACK_HA_10045": "HA network-group conditional stop refused for VM[uuid:%s] because it is not associated with an enabled HA network group", + "ORG_ZSTACK_HA_10046": "Cannot enable HA network group[uuid:%s] because no cluster can satisfy minAvailableCount[%s]", + "ORG_ZSTACK_HA_10047": "HA network-group conditional stop refused for VM[uuid:%s] because hypervisor[%s] is not KVM", + "ORG_ZSTACK_HA_10048": "HA start refused for VM[uuid:%s] because INHIBIT_HA was created while HA was in progress", + "ORG_ZSTACK_HA_10050": "HA network-group conditional stop refused for VM[uuid:%s] because its state is [%s] instead of Running", + "ORG_ZSTACK_HA_10051": "HA network-group conditional stop refused for VM[uuid:%s] because source host[uuid:%s] does not match current host[uuid:%s]", + "ORG_ZSTACK_HA_10053": "HA network-group conditional stop refused for VM[uuid:%s] because no starting candidate host is available", + "ORG_ZSTACK_HA_10054": "HA network-group conditional stop cannot precheck candidate hosts for VM[uuid:%s]: %s", + "ORG_ZSTACK_HA_10056": "HA network-group conditional stop refused for VM[uuid:%s] because no enabled network group remains Down on source host[uuid:%s]", "ORG_ZSTACK_KVM_10043": "unable to connect to KVM[ip:%s, username:%s, SSH port:%d] to perform DNS validation; please verify the credentials.", "ORG_ZSTACK_STORAGE_PRIMARY_LOCAL_10050": "Unable to live migrate VM [uuid:%s] with data volumes on local storage. Data volumes must be detached first.", "ORG_ZSTACK_ZWATCH_THIRDPARTY_ZAKU_10001": "The query object is null. Please ensure that your query parameters are properly initialized before executing the cloud computing task.", diff --git a/conf/i18n/globalErrorCodeMapping/global-error-zh_CN.json b/conf/i18n/globalErrorCodeMapping/global-error-zh_CN.json index 0c36ae4980b..9469135dfe0 100644 --- a/conf/i18n/globalErrorCodeMapping/global-error-zh_CN.json +++ b/conf/i18n/globalErrorCodeMapping/global-error-zh_CN.json @@ -3266,6 +3266,19 @@ "ORG_ZSTACK_STORAGE_PRIMARY_LOCAL_10054": "主机[UUID:%s]不属于本地主要存储[UUID:%s]", "ORG_ZSTACK_KVM_10040": "失败增加虚拟机CPU,错误详情: %s", "ORG_ZSTACK_HA_10018": "该虚拟机[uuid:%s]的卷存储位置处于维护状态,请联系管理员解决", + "ORG_ZSTACK_HA_10041": "拒绝对虚拟机[uuid:%s]执行业务网络高可用组条件停止,该功能当前不可用", + "ORG_ZSTACK_HA_10042": "拒绝执行业务网络高可用组条件停止,虚拟机清单不存在", + "ORG_ZSTACK_HA_10043": "拒绝对虚拟机[uuid:%s]执行业务网络高可用组条件停止,其高可用级别不是 NeverStop", + "ORG_ZSTACK_HA_10044": "拒绝对虚拟机[uuid:%s]执行业务网络高可用组条件停止,已设置 INHIBIT_HA", + "ORG_ZSTACK_HA_10045": "拒绝对虚拟机[uuid:%s]执行业务网络高可用组条件停止,其未关联已启用的业务网络高可用组", + "ORG_ZSTACK_HA_10046": "无法启用业务网络高可用组[uuid:%s],没有集群能够满足最小可用数量[%s]", + "ORG_ZSTACK_HA_10047": "拒绝对虚拟机[uuid:%s]执行业务网络高可用组条件停止,其虚拟化类型[%s]不是 KVM", + "ORG_ZSTACK_HA_10048": "拒绝对虚拟机[uuid:%s]执行高可用启动,因为高可用处理期间已创建 INHIBIT_HA", + "ORG_ZSTACK_HA_10050": "拒绝对虚拟机[uuid:%s]执行业务网络高可用组条件停止,其状态为[%s]而非运行中", + "ORG_ZSTACK_HA_10051": "拒绝对虚拟机[uuid:%s]执行业务网络高可用组条件停止,源主机[uuid:%s]与当前主机[uuid:%s]不一致", + "ORG_ZSTACK_HA_10053": "拒绝对虚拟机[uuid:%s]执行业务网络高可用组条件停止,没有可用的启动候选主机", + "ORG_ZSTACK_HA_10054": "无法预检查虚拟机[uuid:%s]的业务网络高可用组条件停止候选主机:%s", + "ORG_ZSTACK_HA_10056": "拒绝对虚拟机[uuid:%s]执行业务网络高可用组条件停止,源主机[uuid:%s]上已无处于故障状态的已启用业务网络高可用组", "ORG_ZSTACK_KVM_10043": "无法连接到 KVM[ip:%s, 用户名:%s, SSH端口:%d] 执行 DNS 检查,请检查用户名/密码是否正确;%s", "ORG_ZSTACK_STORAGE_PRIMARY_LOCAL_10050": "无法将带有本地存储数据卷的虚拟机[uuid:%s]进行在线迁移。首先需要先分离所有数据卷。", "ORG_ZSTACK_ZWATCH_THIRDPARTY_ZAKU_10001": "查询对象为空", diff --git a/header/src/main/java/org/zstack/header/allocator/HostAllocationPurpose.java b/header/src/main/java/org/zstack/header/allocator/HostAllocationPurpose.java index b9893311b21..73ef02c0b4c 100644 --- a/header/src/main/java/org/zstack/header/allocator/HostAllocationPurpose.java +++ b/header/src/main/java/org/zstack/header/allocator/HostAllocationPurpose.java @@ -13,5 +13,7 @@ */ public enum HostAllocationPurpose { ALLOCATE, - LIST_CANDIDATES + LIST_CANDIDATES, + HA_PRECHECK, + HA_START } diff --git a/utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java b/utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java index 9fc175de2c1..2e0ccbe7839 100644 --- a/utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java +++ b/utils/src/main/java/org/zstack/utils/clouderrorcode/CloudOperationsErrorCode.java @@ -1942,6 +1942,32 @@ public class CloudOperationsErrorCode { public static final String ORG_ZSTACK_HA_10036 = "ORG_ZSTACK_HA_10036"; + public static final String ORG_ZSTACK_HA_10041 = "ORG_ZSTACK_HA_10041"; + + public static final String ORG_ZSTACK_HA_10042 = "ORG_ZSTACK_HA_10042"; + + public static final String ORG_ZSTACK_HA_10043 = "ORG_ZSTACK_HA_10043"; + + public static final String ORG_ZSTACK_HA_10044 = "ORG_ZSTACK_HA_10044"; + + public static final String ORG_ZSTACK_HA_10045 = "ORG_ZSTACK_HA_10045"; + + public static final String ORG_ZSTACK_HA_10046 = "ORG_ZSTACK_HA_10046"; + + public static final String ORG_ZSTACK_HA_10047 = "ORG_ZSTACK_HA_10047"; + + public static final String ORG_ZSTACK_HA_10048 = "ORG_ZSTACK_HA_10048"; + + public static final String ORG_ZSTACK_HA_10050 = "ORG_ZSTACK_HA_10050"; + + public static final String ORG_ZSTACK_HA_10051 = "ORG_ZSTACK_HA_10051"; + + public static final String ORG_ZSTACK_HA_10053 = "ORG_ZSTACK_HA_10053"; + + public static final String ORG_ZSTACK_HA_10054 = "ORG_ZSTACK_HA_10054"; + + public static final String ORG_ZSTACK_HA_10056 = "ORG_ZSTACK_HA_10056"; + public static final String ORG_ZSTACK_NETWORK_SERVICE_SLB_10000 = "ORG_ZSTACK_NETWORK_SERVICE_SLB_10000"; public static final String ORG_ZSTACK_NETWORK_SERVICE_SLB_10001 = "ORG_ZSTACK_NETWORK_SERVICE_SLB_10001";