Skip to content
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

[Tencent] Remove storage ProductFamily and add SPOTPAID missing #1100

Merged
merged 5 commits into from
Feb 28, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ func WaitForDelete(client *cvm.Client, imageIID irs.IID) (bool, error) {
}

if len(imageList) == 0 {
cblogger.Info("Image의 삭제가 완료되어 대기를 중단합니다.")
cblogger.Info("Image deletion is complete and stops waiting.")
break
}

curRetryCnt++
cblogger.Info("Image의 삭제가 완료되지 않아 1초 대기후 조회합니다.")
cblogger.Info("Image deletion has not been completed, so we will look up the climate for 1 second.")
time.Sleep(time.Second * 1)
if curRetryCnt > maxRetryCnt {
cblogger.Errorf("장시간(%d 초) 대기해도 Image의 삭제가 완료되지 않아서 강제로 중단합니다.", maxRetryCnt)
cblogger.Errorf("If you wait for a long time (%d seconds), the deletion of the image does not complete, so forcefully stop.", maxRetryCnt)
return false, errors.New("Failed to delete image")
}
}
Expand Down Expand Up @@ -95,16 +95,16 @@ func WaitForDone(client *cbs.Client, diskIID irs.IID, status string) (string, er
cblogger.Info("===>Disk Status : ", curStatus)

if curStatus == waitStatus {
cblogger.Infof("===>Disk 상태가 [%s]라서 대기를 중단합니다.", curStatus)
cblogger.Infof("===>Suspends standby because disk state is [%s].", curStatus)
break
}

curRetryCnt++
cblogger.Infof("Disk 상태가 [%s]이 아니라서 1초 대기후 조회합니다.", waitStatus)
cblogger.Infof("Disk status is not [%s] and climate lookup is performed in 1 second.", waitStatus)
time.Sleep(time.Second * 1)
if curRetryCnt > maxRetryCnt {
cblogger.Errorf("장시간(%d 초) 대기해도 Disk Status 값이 [%s]으로 변경되지 않아서 강제로 중단합니다.", maxRetryCnt, waitStatus)
return "Failed", errors.New("장시간 기다렸으나 생성된 Disk의 상태가 [" + waitStatus + "]으로 바뀌지 않아서 중단 합니다.")
cblogger.Errorf("Waiting for a long time (%d seconds) does not change the disk status value to [%s] and forces it to stop.", maxRetryCnt, waitStatus)
return "Failed", errors.New("After waiting a long time, the status of the created disk does not change to [" + waitStatus + "] and it is interrupted.")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func ConvertJsonStringNoEscape(v interface{}) (string, error) {
encoder.SetEscapeHTML(false)
errJson := encoder.Encode(v)
if errJson != nil {
cblogger.Error("JSON 변환 실패")
cblogger.Error("JSON conversion failed")
cblogger.Error(errJson)
return "", errJson
}
Expand All @@ -136,7 +136,7 @@ func ConvertJsonString(v interface{}) (string, error) {
jsonBytes, errJson := json.Marshal(v)

if errJson != nil {
cblogger.Error("JSON 변환 실패")
cblogger.Error("JSON conversion failed")
cblogger.Error(errJson)
return "", errJson
}
Expand Down Expand Up @@ -180,7 +180,7 @@ func ConvertKeyValueList(v interface{}) ([]irs.KeyValue, error) {

jsonBytes, errJson := json.Marshal(v)
if errJson != nil {
cblogger.Error("KeyValue 변환 실패")
cblogger.Error("KeyValue conversion failed")
cblogger.Error(errJson)
return nil, errJson
}
Expand All @@ -201,7 +201,7 @@ func ConvertKeyValueList(v interface{}) ([]irs.KeyValue, error) {
value, errString := ConvertToString(v)
if errString != nil {
//cblogger.Errorf("Key[%s]의 값은 변환 불가 - [%s]", k, errString)
cblogger.Debugf("Key[%s]의 값은 변환 불가 - [%s]", k, errString) //요구에 의해서 Error에서 Warn으로 낮춤
cblogger.Debugf("Key[%s] values are not convertible - [%s]", k, errString) //요구에 의해서 Error에서 Warn으로 낮춤
continue
}
keyValueList = append(keyValueList, irs.KeyValue{k, value})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,6 @@ func (DiskHandler *TencentDiskHandler) diskExist(chkName string) (bool, error) {
return false, nil
}

cblogger.Infof("Disk 정보 찾음 - DiskId:[%s] / DiskName:[%s]", *response.Response.DiskSet[0].DiskId, *response.Response.DiskSet[0].DiskName)
cblogger.Infof("Found disk information - DiskId:[%s] / DiskName:[%s]", *response.Response.DiskSet[0].DiskId, *response.Response.DiskSet[0].DiskName)
return true, nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func ExtractImageDescribeInfo(image *cvm.Image) irs.ImageInfo {
//KeyValue 목록 처리
keyValueList, errKeyValue := ConvertKeyValueList(image)
if errKeyValue != nil {
cblogger.Errorf("[%]의 KeyValue 추출 실패", *image.ImageId)
cblogger.Errorf("KeyValue extraction failed for [%]", *image.ImageId)
cblogger.Error(errKeyValue)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func (myImageHandler *TencentMyImageHandler) myImageExist(chkName string) (bool,
return false, nil
}

cblogger.Infof("MyImage 정보 찾음 - MyImageId:[%s] / MyImageName:[%s]", *response.Response.ImageSet[0].ImageId, *response.Response.ImageSet[0].ImageName)
cblogger.Infof("Found MyImage information - MyImageId:[%s] / MyImageName:[%s]", *response.Response.ImageSet[0].ImageId, *response.Response.ImageSet[0].ImageName)
return true, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ const (
)

/*
NLB 생성
vpc required
NLB 생성
vpc required
*/
func (NLBHandler *TencentNLBHandler) CreateNLB(nlbReqInfo irs.NLBInfo) (irs.NLBInfo, error) {
////// validation check area //////
Expand Down Expand Up @@ -244,7 +244,7 @@ func (NLBHandler *TencentNLBHandler) CreateNLB(nlbReqInfo irs.NLBInfo) (irs.NLBI
}

/*
NLB 모든 목록 조회 : TCP/UDP
NLB 모든 목록 조회 : TCP/UDP
*/
func (NLBHandler *TencentNLBHandler) ListNLB() ([]*irs.NLBInfo, error) {
cblogger.Info("Start")
Expand Down Expand Up @@ -298,7 +298,7 @@ func (NLBHandler *TencentNLBHandler) ListNLB() ([]*irs.NLBInfo, error) {
}

/*
NLB 조회
NLB 조회
*/
func (NLBHandler *TencentNLBHandler) GetNLB(nlbIID irs.IID) (irs.NLBInfo, error) {
cblogger.Info("NLB IID : ", nlbIID.SystemId)
Expand Down Expand Up @@ -762,7 +762,7 @@ func (NLBHandler *TencentNLBHandler) ChangeHealthCheckerInfo(nlbIID irs.IID, hea

}

//CLB instance status (creating, running)
// CLB instance status (creating, running)
func (NLBHandler *TencentNLBHandler) WaitForRun(nlbIID irs.IID) (string, error) {

waitStatus := "Running"
Expand All @@ -783,23 +783,23 @@ func (NLBHandler *TencentNLBHandler) WaitForRun(nlbIID irs.IID) (string, error)
cblogger.Info("===>NLB Status : ", curStatus)

if curStatus == LoadBalancerSet_Status_Running {
cblogger.Infof("===>NLB 상태가 [%d]라서 대기를 중단합니다.", curStatus)
cblogger.Infof("===>The NLB state is [%d] so it stops waiting.", curStatus)
break
}

curRetryCnt++
cblogger.Infof("NLB 상태가 [%s]이 아니라서 1초 대기후 조회합니다.", waitStatus)
cblogger.Infof("NLB status is not [%s] so I'm checking the climate for a second.", waitStatus)
time.Sleep(time.Second * 1)
if curRetryCnt > maxRetryCnt {
cblogger.Errorf("장시간(%d 초) 대기해도 NLB Status 값이 [%s]으로 변경되지 않아서 강제로 중단합니다.", maxRetryCnt, waitStatus)
return "Failed", errors.New("장시간 기다렸으나 생성된 NLB의 상태가 [" + waitStatus + "]으로 바뀌지 않아서 중단 합니다.")
cblogger.Errorf("The NLB Status value does not change to [%s] even after waiting for a long time (%d seconds), so it is forced to stop.", maxRetryCnt, waitStatus)
return "Failed", errors.New("I waited for a long time, but the generated NLB status did not change to [" + waitStatus + "] so I will stop.")
}
}

return waitStatus, nil
}

//Current status of a task (succeeded==Done, failed, in progress)
// Current status of a task (succeeded==Done, failed, in progress)
func (NLBHandler *TencentNLBHandler) WaitForDone(requestId string) (string, error) {

waitStatus := "Done"
Expand All @@ -821,25 +821,25 @@ func (NLBHandler *TencentNLBHandler) WaitForDone(requestId string) (string, erro
cblogger.Info("===>request status : ", requestStatus)

if requestStatus == Request_Status_Succeeded {
cblogger.Infof("===>request 상태가 [%s]라서 대기를 중단합니다.", waitStatus)
cblogger.Infof("===>The request state is [%s] and will stop waiting.", waitStatus)
break
}

curRetryCnt++
cblogger.Infof("request 상태가 [%s]이 아니라서 1초 대기후 조회합니다.", waitStatus)
cblogger.Infof("The request status is not [%s], so I'm checking the climate for a second.", waitStatus)
time.Sleep(time.Second * 1)
if curRetryCnt > maxRetryCnt {
cblogger.Errorf("장시간(%d 초) 대기해도 request Status 값이 [%s]으로 변경되지 않아서 강제로 중단합니다.", maxRetryCnt, waitStatus)
return "Failed", errors.New("장시간 기다렸으나 생성된 request 상태가 [" + waitStatus + "]으로 바뀌지 않아서 중단 합니다.")
cblogger.Errorf("Waiting for a long time (%d seconds) does not change the request status value to [%s] and forces it to stop.", maxRetryCnt, waitStatus)
return "Failed", errors.New("I waited for a long time, but the generated request status did not change to [" + waitStatus + "] so I will stop.")
}
}

return waitStatus, nil
}

/*
nlb가 존재하는지 check
동일이름이 없으면 false, 있으면 true
nlb가 존재하는지 check
동일이름이 없으면 false, 있으면 true
*/
func (NLBHandler *TencentNLBHandler) nlbExist(chkName string) (bool, error) {
cblogger.Debugf("chkName : %s", chkName)
Expand All @@ -862,7 +862,7 @@ func (NLBHandler *TencentNLBHandler) nlbExist(chkName string) (bool, error) {
}

/*
조회한 결과에서 Spider의 NLBInfo 값으로 변환
조회한 결과에서 Spider의 NLBInfo 값으로 변환
*/
func (NLBHandler *TencentNLBHandler) ExtractNLBDescribeInfo(nlbInfo *clb.LoadBalancer) (irs.NLBInfo, error) {

Expand Down Expand Up @@ -908,10 +908,9 @@ func (NLBHandler *TencentNLBHandler) ExtractNLBDescribeInfo(nlbInfo *clb.LoadBal
return resNLBInfo, nil
}


/*
NLB Name으로 Listener를 조회하여 NLBInfo.Listener 값으로 변환
NLB 를 조회하여 Listener에 사용할 IP인 VIP 추출
NLB Name으로 Listener를 조회하여 NLBInfo.Listener 값으로 변환
NLB 를 조회하여 Listener에 사용할 IP인 VIP 추출
*/
func (NLBHandler *TencentNLBHandler) ExtractListenerInfo(nlbIID irs.IID) (irs.ListenerInfo, error) {
cblogger.Info("NLB IID : ", nlbIID.SystemId)
Expand Down Expand Up @@ -945,7 +944,7 @@ func (NLBHandler *TencentNLBHandler) ExtractListenerInfo(nlbIID irs.IID) (irs.Li
}

/*
VM Group 정보 조회
VM Group 정보 조회
*/
func (NLBHandler *TencentNLBHandler) ExtractVMGroupInfo(nlbIID irs.IID) (irs.VMGroupInfo, error) {
cblogger.Info("NLB IID : ", nlbIID.SystemId)
Expand Down Expand Up @@ -986,7 +985,7 @@ func (NLBHandler *TencentNLBHandler) ExtractVMGroupInfo(nlbIID irs.IID) (irs.VMG
}

/*
Health Checker 정보 조회
Health Checker 정보 조회
*/
func (NLBHandler *TencentNLBHandler) ExtractHealthCheckerInfo(nlbIID irs.IID) (irs.HealthCheckerInfo, error) {
cblogger.Info("NLB IID : ", nlbIID.SystemId)
Expand Down
Loading
Loading