mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix/modelarts status
This commit is contained in:
@@ -15,19 +15,20 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/cloudmux/pkg/apis/compute"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
MODELARTS_POOL_STATUS_RUNNING = compute.MODELARTS_POOL_STATUS_RUNNING
|
||||
MODELARTS_POOL_STATUS_ABNORMAL = "abnormal"
|
||||
MODELARTS_POOL_STATUS_CREATING = compute.MODELARTS_POOL_STATUS_CREATING
|
||||
MODELARTS_POOL_STATUS_DELETING = "deleting"
|
||||
MODELARTS_POOL_STATUS_CHANGE_CONFIG = "change_config"
|
||||
MODELARTS_POOL_STATUS_ERROR = "error"
|
||||
MODELARTS_POOL_STATUS_UNKNOWN = "unknown"
|
||||
MODELARTS_POOL_STATUS_RUNNING = "running"
|
||||
MODELARTS_POOL_STATUS_ABNORMAL = "abnormal"
|
||||
MODELARTS_POOL_STATUS_CREATING = "creating"
|
||||
MODELARTS_POOL_STATUS_CREATE_FAILED = "create_failed"
|
||||
MODELARTS_POOL_STATUS_DELETING = "deleting"
|
||||
MODELARTS_POOL_STATUS_DELETE_FAILED = "delete_failed"
|
||||
MODELARTS_POOL_STATUS_CHANGE_CONFIG = "change_config"
|
||||
MODELARTS_POOL_STATUS_CHANGE_CONFIG_FAILED = "change_config_failed"
|
||||
MODELARTS_POOL_STATUS_ERROR = "error"
|
||||
MODELARTS_POOL_STATUS_UNKNOWN = "unknown"
|
||||
)
|
||||
|
||||
type ModelartsPoolCreateInput struct {
|
||||
|
||||
@@ -39,7 +39,7 @@ func init() {
|
||||
}
|
||||
|
||||
func (self *ModelartsPoolChangeConfigTask) taskFailed(ctx context.Context, mp *models.SModelartsPool, err error) {
|
||||
mp.SetStatus(self.UserCred, api.MODELARTS_POOL_STATUS_UNKNOWN, err.Error())
|
||||
mp.SetStatus(self.UserCred, api.MODELARTS_POOL_STATUS_CHANGE_CONFIG_FAILED, err.Error())
|
||||
db.OpsLog.LogEvent(mp, db.ACT_CHANGE_CONFIG, err, self.UserCred)
|
||||
logclient.AddActionLogWithStartable(self, mp, logclient.ACT_CHANGE_CONFIG, err, self.UserCred, false)
|
||||
self.SetStageFailed(ctx, jsonutils.NewString(err.Error()))
|
||||
|
||||
@@ -39,7 +39,7 @@ func init() {
|
||||
}
|
||||
|
||||
func (self *ModelartsPoolCreateTask) taskFailed(ctx context.Context, pool *models.SModelartsPool, err error) {
|
||||
pool.SetStatus(self.UserCred, api.MODELARTS_POOL_STATUS_UNKNOWN, err.Error())
|
||||
pool.SetStatus(self.UserCred, api.MODELARTS_POOL_STATUS_CREATE_FAILED, err.Error())
|
||||
logclient.AddActionLogWithStartable(self, pool, logclient.ACT_ALLOCATE, err, self.UserCred, false)
|
||||
self.SetStageFailed(ctx, jsonutils.NewString(err.Error()))
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
apis "yunion.io/x/onecloud/pkg/apis"
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/db/taskman"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/notifyclient"
|
||||
@@ -39,7 +39,7 @@ func init() {
|
||||
}
|
||||
|
||||
func (self *ModelartsPoolDeleteTask) taskFailed(ctx context.Context, mp *models.SModelartsPool, err error) {
|
||||
mp.SetStatus(self.UserCred, apis.STATUS_DELETE_FAILED, err.Error())
|
||||
mp.SetStatus(self.UserCred, api.MODELARTS_POOL_STATUS_DELETE_FAILED, err.Error())
|
||||
db.OpsLog.LogEvent(mp, db.ACT_DELETE_FAIL, err, self.UserCred)
|
||||
logclient.AddActionLogWithStartable(self, mp, logclient.ACT_DELOCATE, err, self.UserCred, false)
|
||||
self.SetStageFailed(ctx, jsonutils.NewString(err.Error()))
|
||||
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
const (
|
||||
MODELARTS_POOL_STATUS_RUNNING = "running"
|
||||
MODELARTS_POOL_STATUS_CREATING = "creating"
|
||||
)
|
||||
+7
-3
@@ -22,9 +22,9 @@ import (
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
billing_api "yunion.io/x/cloudmux/pkg/apis/billing"
|
||||
"yunion.io/x/cloudmux/pkg/apis/compute"
|
||||
"yunion.io/x/cloudmux/pkg/cloudprovider"
|
||||
"yunion.io/x/cloudmux/pkg/multicloud"
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/util/billing"
|
||||
)
|
||||
|
||||
@@ -288,8 +288,12 @@ func (self *SModelartsPool) GetName() string {
|
||||
func (self *SModelartsPool) GetStatus() string {
|
||||
res := strings.ToLower(self.Status.Phase)
|
||||
switch {
|
||||
case res == compute.MODELARTS_POOL_STATUS_RUNNING && len(self.Status.Resource.Creating) != 0:
|
||||
res = compute.MODELARTS_POOL_STATUS_CREATING
|
||||
case res == api.MODELARTS_POOL_STATUS_RUNNING && len(self.Status.Resource.Creating) != 0:
|
||||
res = api.MODELARTS_POOL_STATUS_CREATING
|
||||
case self.Status.Phase == "CreationFailed":
|
||||
res = api.MODELARTS_POOL_STATUS_CREATE_FAILED
|
||||
case self.Status.Phase == "SeclingFailed":
|
||||
res = api.MODELARTS_POOL_STATUS_CHANGE_CONFIG_FAILED
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
+7
-3
@@ -22,9 +22,9 @@ import (
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
billing_api "yunion.io/x/cloudmux/pkg/apis/billing"
|
||||
"yunion.io/x/cloudmux/pkg/apis/compute"
|
||||
"yunion.io/x/cloudmux/pkg/cloudprovider"
|
||||
"yunion.io/x/cloudmux/pkg/multicloud"
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/util/billing"
|
||||
)
|
||||
|
||||
@@ -287,8 +287,12 @@ func (self *SModelartsPool) GetName() string {
|
||||
func (self *SModelartsPool) GetStatus() string {
|
||||
res := strings.ToLower(self.Status.Phase)
|
||||
switch {
|
||||
case res == compute.MODELARTS_POOL_STATUS_RUNNING && len(self.Status.Resource.Creating) != 0:
|
||||
res = compute.MODELARTS_POOL_STATUS_CREATING
|
||||
case res == api.MODELARTS_POOL_STATUS_RUNNING && len(self.Status.Resource.Creating) != 0:
|
||||
res = api.MODELARTS_POOL_STATUS_CREATING
|
||||
case self.Status.Phase == "CreationFailed":
|
||||
res = api.MODELARTS_POOL_STATUS_CREATE_FAILED
|
||||
case self.Status.Phase == "SeclingFailed":
|
||||
res = api.MODELARTS_POOL_STATUS_CHANGE_CONFIG_FAILED
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user