From ab9597fbd230c267d4a01fe25d28ec9f9b17d409 Mon Sep 17 00:00:00 2001 From: dogfootman Date: Wed, 3 Jul 2024 17:09:47 +0900 Subject: [PATCH] remove checke log level --- .../alibaba/resources/CommonAlibabaFunc.go | 4 +- .../drivers/alibaba/resources/ImageHandler.go | 7 +- .../alibaba/resources/KeyPairHandler.go | 5 +- .../alibaba/resources/SecurityHandler.go | 10 +-- .../drivers/alibaba/resources/VMHandler.go | 5 +- .../drivers/aws/resources/ClusterHandler.go | 18 ++--- .../drivers/aws/resources/CommonHandler.go | 26 ++----- .../drivers/aws/resources/DiskHandler.go | 17 ++--- .../drivers/aws/resources/MyImageHandler.go | 20 ++--- .../drivers/aws/resources/NLBHandler.go | 73 ++----------------- .../drivers/gcp/resources/NLBHandler.go | 11 ++- .../drivers/gcp/resources/SecurityHandler.go | 9 +-- .../drivers/gcp/resources/VMHandler.go | 51 +++++-------- .../drivers/tencent/resources/VMHandler.go | 5 +- 14 files changed, 63 insertions(+), 198 deletions(-) diff --git a/cloud-control-manager/cloud-driver/drivers/alibaba/resources/CommonAlibabaFunc.go b/cloud-control-manager/cloud-driver/drivers/alibaba/resources/CommonAlibabaFunc.go index 714f6f791..eb67d08ea 100644 --- a/cloud-control-manager/cloud-driver/drivers/alibaba/resources/CommonAlibabaFunc.go +++ b/cloud-control-manager/cloud-driver/drivers/alibaba/resources/CommonAlibabaFunc.go @@ -202,9 +202,7 @@ func ConvertToString(value interface{}) (string, error) { // Cloud Object를 CB-KeyValue 형식으로 변환이 필요할 경우 이용 func ConvertKeyValueList(v interface{}) ([]irs.KeyValue, error) { - if cblogger.Level.String() == "debug" { - cblogger.Debug(v) - } + cblogger.Debug(v) var keyValueList []irs.KeyValue var i map[string]interface{} diff --git a/cloud-control-manager/cloud-driver/drivers/alibaba/resources/ImageHandler.go b/cloud-control-manager/cloud-driver/drivers/alibaba/resources/ImageHandler.go index 2bd16e126..e80f32bf9 100644 --- a/cloud-control-manager/cloud-driver/drivers/alibaba/resources/ImageHandler.go +++ b/cloud-control-manager/cloud-driver/drivers/alibaba/resources/ImageHandler.go @@ -196,11 +196,8 @@ func ExtractImageDescribeInfo(image *ecs.Image) irs.ImageInfo { //@TODO : 2020-04-20 ecs.ImageInDescribeImages를 인식 못해서 다시 ecs.Image로 변경해 놓음. //func ExtractImageDescribeInfo(image *ecs.Image) irs.ImageInfo { //*ecs.DescribeImagesResponse - if cblogger.Level.String() == "debug" { - cblogger.Debug("=====> ") - cblogger.Debug(image) - //cblogger.Debug(image) - } + cblogger.Debug(image) + imageInfo := irs.ImageInfo{ IId: irs.IID{NameId: image.ImageId, SystemId: image.ImageId}, //Name: image.ImageName, diff --git a/cloud-control-manager/cloud-driver/drivers/alibaba/resources/KeyPairHandler.go b/cloud-control-manager/cloud-driver/drivers/alibaba/resources/KeyPairHandler.go index 87d245cc5..c297b93dd 100644 --- a/cloud-control-manager/cloud-driver/drivers/alibaba/resources/KeyPairHandler.go +++ b/cloud-control-manager/cloud-driver/drivers/alibaba/resources/KeyPairHandler.go @@ -142,10 +142,7 @@ func (keyPairHandler *AlibabaKeyPairHandler) CreateKey(keyPairReqInfo irs.KeyPai callogger.Info(call.String(callLogInfo)) cblogger.Infof("Created key pair %q %s\n%s\n", result.KeyPairName, result.KeyPairFingerPrint, result.PrivateKeyBody) - if cblogger.Level.String() == "debug" { - //cblogger.Debug(result) - cblogger.Debug(result) - } + cblogger.Debug(result) /* 2021-10-27 이슈#480에 의해 Local Key 로직 제거 cblogger.Info("공개키 생성") diff --git a/cloud-control-manager/cloud-driver/drivers/alibaba/resources/SecurityHandler.go b/cloud-control-manager/cloud-driver/drivers/alibaba/resources/SecurityHandler.go index c70cfa879..13a25c266 100644 --- a/cloud-control-manager/cloud-driver/drivers/alibaba/resources/SecurityHandler.go +++ b/cloud-control-manager/cloud-driver/drivers/alibaba/resources/SecurityHandler.go @@ -132,10 +132,7 @@ func (securityHandler *AlibabaSecurityHandler) AddRules(securityIID irs.IID, req securityGroupId := securityIID.SystemId cblogger.Infof("securityGroupId : [%s] / securityRuleInfos : [%v]", securityGroupId, reqSecurityRules) //cblogger.Info("AuthorizeSecurityRules ", securityRuleInfos) - if cblogger.Level.String() == "debug" { - cblogger.Debug(reqSecurityRules) - //cblogger.Debug(reqSecurityRules) - } + cblogger.Debug(reqSecurityRules) if len(*reqSecurityRules) < 1 { return irs.SecurityInfo{}, errors.New("invalid value - The SecurityRules to add is empty") @@ -188,10 +185,7 @@ func (securityHandler *AlibabaSecurityHandler) AddRules(securityIID irs.IID, req request.DestCidrIp = curRule.CIDR cblogger.Infof("[%s] [%s] outbound rule Request", request.IpProtocol, request.PortRange) - if cblogger.Level.String() == "debug" { - //cblogger.Debug(request) - cblogger.Debug(request) - } + cblogger.Debug(request) response, err := securityHandler.Client.AuthorizeSecurityGroupEgress(request) if err != nil { diff --git a/cloud-control-manager/cloud-driver/drivers/alibaba/resources/VMHandler.go b/cloud-control-manager/cloud-driver/drivers/alibaba/resources/VMHandler.go index 2414d9066..29de20fb8 100644 --- a/cloud-control-manager/cloud-driver/drivers/alibaba/resources/VMHandler.go +++ b/cloud-control-manager/cloud-driver/drivers/alibaba/resources/VMHandler.go @@ -988,10 +988,7 @@ func (vmHandler *AlibabaVMHandler) ListVM() ([]*irs.VMInfo, error) { return nil, errVmInfo } //cblogger.Info("=======>VM 조회 결과") - if cblogger.Level.String() == "debug" { - //cblogger.Debug(vmInfo) - cblogger.Debug(vmInfo) - } + cblogger.Debug(vmInfo) vmInfoList = append(vmInfoList, &vmInfo) } diff --git a/cloud-control-manager/cloud-driver/drivers/aws/resources/ClusterHandler.go b/cloud-control-manager/cloud-driver/drivers/aws/resources/ClusterHandler.go index 06e1010bc..21913745e 100644 --- a/cloud-control-manager/cloud-driver/drivers/aws/resources/ClusterHandler.go +++ b/cloud-control-manager/cloud-driver/drivers/aws/resources/ClusterHandler.go @@ -94,9 +94,7 @@ func (ClusterHandler *AwsClusterHandler) CreateCluster(clusterReqInfo irs.Cluste } } - if cblogger.Level.String() == "debug" { - cblogger.Debug(input) - } + cblogger.Debug(input) // logger for HisCall callogger := call.GetLogger("HISCALL") @@ -164,10 +162,8 @@ func (ClusterHandler *AwsClusterHandler) CreateCluster(clusterReqInfo irs.Cluste if nodeGroupErr != nil { cblogger.Error(err.Error()) } - if cblogger.Level.String() == "debug" { - cblogger.Debug(resultNodeGroupInfo) - } - } + cblogger.Debug(resultNodeGroupInfo) + //----- wait until Status=COMPLETE -----// : Nodegroup이 모두 생성되면 조회 */ @@ -292,9 +288,7 @@ func (ClusterHandler *AwsClusterHandler) GetCluster(clusterIID irs.IID) (irs.Clu Name: aws.String(clusterIID.SystemId), } - if cblogger.Level.String() == "debug" { - cblogger.Debug(input) - } + cblogger.Debug(input) // logger for HisCall callogger := call.GetLogger("HISCALL") @@ -455,9 +449,7 @@ func (ClusterHandler *AwsClusterHandler) DeleteCluster(clusterIID irs.IID) (bool Name: aws.String(clusterIID.SystemId), } - if cblogger.Level.String() == "debug" { - cblogger.Debug(input) - } + cblogger.Debug(input) // logger for HisCall callogger := call.GetLogger("HISCALL") diff --git a/cloud-control-manager/cloud-driver/drivers/aws/resources/CommonHandler.go b/cloud-control-manager/cloud-driver/drivers/aws/resources/CommonHandler.go index 6c32d8235..a39a85ab7 100644 --- a/cloud-control-manager/cloud-driver/drivers/aws/resources/CommonHandler.go +++ b/cloud-control-manager/cloud-driver/drivers/aws/resources/CommonHandler.go @@ -238,9 +238,8 @@ func DescribeVolumnes(svc *ec2.EC2, volumeIdList []*string) (*ec2.DescribeVolume } return nil, err } - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } + + cblogger.Debug(result) return result, nil } @@ -268,9 +267,7 @@ func DescribeVolumneById(svc *ec2.EC2, volumeId string) (*ec2.Volume, error) { } return nil, err } - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } + cblogger.Debug(result) for _, volume := range result.Volumes { if strings.EqualFold(volumeId, *volume.VolumeId) { @@ -312,9 +309,8 @@ func DescribeVolumnesBySnapshot(svc *ec2.EC2, snapShotIIDs []string) (*ec2.Descr result, err := svc.DescribeVolumes(input) callogger.Info("DescribeVolumnesBySnapshot IN PU T") - if cblogger.Level.String() == "debug" { - cblogger.Debug(input) - } + cblogger.Debug(input) + callLogInfo.ElapsedTime = call.Elapsed(callLogStart) callogger.Info(call.String(callLogInfo)) @@ -329,9 +325,7 @@ func DescribeVolumnesBySnapshot(svc *ec2.EC2, snapShotIIDs []string) (*ec2.Descr } return nil, err } - if cblogger.Level.String() == "debug" { - cblogger.Debug(result.Volumes) - } + cblogger.Debug(result.Volumes) return result, nil } @@ -370,9 +364,7 @@ func AttachVolume(svc *ec2.EC2, deviceName string, instanceId string, volumeId s return err } - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } + cblogger.Debug(result) err = WaitUntilVolumeInUse(svc, volumeId) if err != nil { @@ -404,9 +396,7 @@ func DeleteDisk(svc *ec2.EC2, disks []irs.IID) (bool, error) { return false, err } - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } + cblogger.Debug(result) err = WaitUntilVolumeDeleted(svc, diskIID.SystemId) if err != nil { diff --git a/cloud-control-manager/cloud-driver/drivers/aws/resources/DiskHandler.go b/cloud-control-manager/cloud-driver/drivers/aws/resources/DiskHandler.go index 6b9e3a870..65a5cbde2 100644 --- a/cloud-control-manager/cloud-driver/drivers/aws/resources/DiskHandler.go +++ b/cloud-control-manager/cloud-driver/drivers/aws/resources/DiskHandler.go @@ -281,9 +281,7 @@ func (DiskHandler *AwsDiskHandler) DeleteDisk(diskIID irs.IID) (bool, error) { } calllogger.Info(call.String(hiscallInfo)) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } + cblogger.Debug(result) err = WaitUntilVolumeDeleted(DiskHandler.Client, diskIID.SystemId) if err != nil { @@ -404,9 +402,7 @@ func (DiskHandler *AwsDiskHandler) AttachDisk(diskIID irs.IID, ownerVM irs.IID) } calllogger.Info(call.String(hiscallInfo)) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } + cblogger.Debug(result) err = WaitUntilVolumeInUse(DiskHandler.Client, diskIID.SystemId) if err != nil { @@ -458,9 +454,7 @@ func (DiskHandler *AwsDiskHandler) DetachDisk(diskIID irs.IID, ownerVM irs.IID) } calllogger.Info(call.String(hiscallInfo)) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } + cblogger.Debug(result) err = WaitUntilVolumeInUse(DiskHandler.Client, diskIID.SystemId) if err != nil { @@ -904,8 +898,7 @@ func (DiskHandler *AwsDiskHandler) convertVolumeInfoToDiskInfo(volumeInfo *ec2.V //inKeyValueList = append(inKeyValueList, icbs.KeyValue{Key: "OutpostArn", Value: *volumeInfo.OutpostArn}) diskInfo.KeyValueList = inKeyValueList cblogger.Debug("keyvalue2") - if cblogger.Level.String() == "debug" { - cblogger.Debug(diskInfo) - } + cblogger.Debug(diskInfo) + return diskInfo, nil } diff --git a/cloud-control-manager/cloud-driver/drivers/aws/resources/MyImageHandler.go b/cloud-control-manager/cloud-driver/drivers/aws/resources/MyImageHandler.go index a3a994c74..52d15e2d0 100644 --- a/cloud-control-manager/cloud-driver/drivers/aws/resources/MyImageHandler.go +++ b/cloud-control-manager/cloud-driver/drivers/aws/resources/MyImageHandler.go @@ -303,9 +303,7 @@ func (ImageHandler *AwsMyImageHandler) SnapshotVM(snapshotReqInfo irs.MyImageInf TagSpecifications: tagSpecs, } - if cblogger.Level.String() == "debug" { - cblogger.Debug(input) - } + cblogger.Debug(input) result, err := ImageHandler.Client.CreateImage(input) hiscallInfo.ElapsedTime = call.Elapsed(start) @@ -357,9 +355,7 @@ func (ImageHandler *AwsMyImageHandler) ListMyImage() ([]*irs.MyImageInfo, error) } calllogger.Info(call.String(hiscallInfo)) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } + cblogger.Debug(result) for _, awsImage := range result.Images { myImage, err := convertAWSImageToMyImageInfo(awsImage) if err != nil { @@ -416,9 +412,7 @@ func (ImageHandler *AwsMyImageHandler) DeleteMyImage(myImageIID irs.IID) (bool, cblogger.Error(err) return false, err } - if cblogger.Level.String() == "debug" { - cblogger.Debug(diskIIDs) - } + cblogger.Debug(diskIIDs) input := &ec2.DeregisterImageInput{} input.ImageId = aws.String(myImageIID.SystemId) @@ -432,9 +426,7 @@ func (ImageHandler *AwsMyImageHandler) DeleteMyImage(myImageIID irs.IID) (bool, } calllogger.Info(call.String(hiscallInfo)) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } + cblogger.Debug(result) for _, snapshotId := range snapshotIds { snapShotDeleteResult, err := ImageHandler.DeleteSnapshotById(snapshotId) @@ -566,9 +558,7 @@ func (MyImageHandler *AwsMyImageHandler) DeleteSnapshotById(snapshotId string) ( return false, err } - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } + cblogger.Debug(result) return true, nil } diff --git a/cloud-control-manager/cloud-driver/drivers/aws/resources/NLBHandler.go b/cloud-control-manager/cloud-driver/drivers/aws/resources/NLBHandler.go index 788969bab..f934915f9 100644 --- a/cloud-control-manager/cloud-driver/drivers/aws/resources/NLBHandler.go +++ b/cloud-control-manager/cloud-driver/drivers/aws/resources/NLBHandler.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" + //"github.com/aws/aws-sdk-go/service/elb" "github.com/aws/aws-sdk-go/service/ec2" @@ -122,9 +123,7 @@ func (NLBHandler *AwsNLBHandler) CreateListener(nlbReqInfo irs.NLBInfo) (*elbv2. } cblogger.Debug("Listener creation result") - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } + cblogger.Debug(result) return result, nil } @@ -207,9 +206,7 @@ func (NLBHandler *AwsNLBHandler) CreateTargetGroup(nlbReqInfo irs.NLBInfo) (*elb } cblogger.Debug("TargetGroup creation result") - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } + cblogger.Debug(result) return result, nil } @@ -244,9 +241,7 @@ func (NLBHandler *AwsNLBHandler) ExtractNlbSubnets(vpcId string) ([]*string, err return nil, err } - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } + cblogger.Debug(result) //서브넷 정보 추출 mapZone := map[string]string{} //AZ별 1개의 서브넷만 사용 가능하기 때문에 중복을 제거 함. (형식) mapZone["AZ"]="서브넷" @@ -528,9 +523,6 @@ func (NLBHandler *AwsNLBHandler) CreateNLB(nlbReqInfo irs.NLBInfo) (irs.NLBInfo, cblogger.Infof("[%s] NLB creation completed - LoadBalancerArn: [%s]", nlbReqInfo.IId.NameId, *result.LoadBalancers[0].LoadBalancerArn) cblogger.Debug(result) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } nlbReqInfo.IId.SystemId = *result.LoadBalancers[0].LoadBalancerArn //리스너 생성및 장애시 삭제 처리를 위해 Req에 LoadBalancerArn 정보를 셋팅함. @@ -555,9 +547,7 @@ func (NLBHandler *AwsNLBHandler) CreateNLB(nlbReqInfo irs.NLBInfo) (irs.NLBInfo, return irs.NLBInfo{}, errTargetGroup } - if cblogger.Level.String() == "debug" { - cblogger.Debug(targetGroup) - } + cblogger.Debug(targetGroup) //=================== // 타겟그룹에 VM 추가 @@ -602,9 +592,7 @@ func (NLBHandler *AwsNLBHandler) CreateNLB(nlbReqInfo irs.NLBInfo) (irs.NLBInfo, return irs.NLBInfo{}, errListener } - if cblogger.Level.String() == "debug" { - cblogger.Debug(listener) - } + cblogger.Debug(listener) //================================ // 가장 최신 정보로 정보를 갱신 함. @@ -645,9 +633,6 @@ func (NLBHandler *AwsNLBHandler) ListNLB() ([]*irs.NLBInfo, error) { callLogInfo.ElapsedTime = call.Elapsed(callLogStart) cblogger.Debug(result) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } if err != nil { callLogInfo.ErrorMSG = err.Error() @@ -742,9 +727,6 @@ func (NLBHandler *AwsNLBHandler) GetNLB(nlbIID irs.IID) (irs.NLBInfo, error) { result, err := NLBHandler.Client.DescribeLoadBalancers(input) callLogInfo.ElapsedTime = call.Elapsed(callLogStart) cblogger.Debug(result) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } if err != nil { callLogInfo.ErrorMSG = err.Error() @@ -810,9 +792,6 @@ func (NLBHandler *AwsNLBHandler) ExtractListenerInfo(nlbIID irs.IID) (irs.Listen } cblogger.Debug(resListener) - if cblogger.Level.String() == "debug" { - cblogger.Debug(resListener) - } if len(resListener.Listeners) > 0 { retListenerInfo := irs.ListenerInfo{ @@ -863,9 +842,6 @@ func (NLBHandler *AwsNLBHandler) ExtractVMGroupInfo(nlbIID irs.IID) (TargetGroup return TargetGroupInfo{}, err } cblogger.Debug(result) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } if len(result.TargetGroups) > 0 { retVMGroupInfo := irs.VMGroupInfo{ @@ -939,9 +915,6 @@ func (NLBHandler *AwsNLBHandler) ExtractHealthCheckerInfo(targetGroupArn string) } cblogger.Debug(result) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } return result.TargetHealthDescriptions, nil } @@ -1048,9 +1021,6 @@ func (NLBHandler *AwsNLBHandler) DeleteListener(listenerArn *string) (bool, erro cblogger.Infof("Listener[%s] deleted complate", listenerArn) cblogger.Debug(result) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } return true, nil } @@ -1080,9 +1050,6 @@ func (NLBHandler *AwsNLBHandler) DeleteTargetGroup(targetGroupArn *string) (bool cblogger.Infof("TargetGroup[%s] deleted complate", targetGroupArn) cblogger.Debug(result) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } return true, nil } @@ -1098,9 +1065,6 @@ func (NLBHandler *AwsNLBHandler) DeleteNLB(nlbIID irs.IID) (bool, error) { cblogger.Debug("NLB information to be deleted") cblogger.Debug(nlbInfo) - if cblogger.Level.String() == "debug" { - cblogger.Debug(nlbInfo) - } //========================= // Listener 삭제 @@ -1183,9 +1147,6 @@ func (NLBHandler *AwsNLBHandler) DeleteNLB(nlbIID irs.IID) (bool, error) { cblogger.Infof("NLB [%s] deleted successfully", nlbIID.SystemId) cblogger.Debug(result) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } return true, nil } @@ -1310,9 +1271,6 @@ func (NLBHandler *AwsNLBHandler) ChangeListener(nlbIID irs.IID, listener irs.Lis cblogger.Infof("Listener information modification completed") cblogger.Debug(result) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } //변경된 최종 리스너 정보를 리턴 함. /* @@ -1402,10 +1360,6 @@ func (NLBHandler *AwsNLBHandler) AddVMs(nlbIID irs.IID, vmIIDs *[]irs.IID) (irs. cblogger.Infof("Information of instances scheduled to be added to VM group (%s)", retTargetGroupInfo.VMGroup.CspID) cblogger.Info(input) - if cblogger.Level.String() == "debug" { - cblogger.Debug(input) - } - // logger for HisCall callogger := call.GetLogger("HISCALL") callLogInfo := call.CLOUDLOGSCHEMA{ @@ -1449,9 +1403,6 @@ func (NLBHandler *AwsNLBHandler) AddVMs(nlbIID irs.IID, vmIIDs *[]irs.IID) (irs. cblogger.Infof("Instances added to VM group (%s) successfully", retTargetGroupInfo.VMGroup.CspID) cblogger.Debug(result) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } //최신 정보 전달을 위해 다시 호출함. retTargetGroupInfo, errVMGroupInfo = NLBHandler.ExtractVMGroupInfo(nlbIID) @@ -1500,9 +1451,6 @@ func (NLBHandler *AwsNLBHandler) RemoveVMs(nlbIID irs.IID, vmIIDs *[]irs.IID) (b cblogger.Infof("Information of instances scheduled to be removed from VM group (%s)", retTargetGroupInfo.VMGroup.CspID) cblogger.Info(input) - if cblogger.Level.String() == "debug" { - cblogger.Debug(input) - } // logger for HisCall callogger := call.GetLogger("HISCALL") @@ -1541,9 +1489,6 @@ func (NLBHandler *AwsNLBHandler) RemoveVMs(nlbIID irs.IID, vmIIDs *[]irs.IID) (b cblogger.Infof("Instances successfully removed from VM group (%s)", retTargetGroupInfo.VMGroup.CspID) cblogger.Debug(result) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } return true, nil } @@ -1577,9 +1522,6 @@ func (NLBHandler *AwsNLBHandler) ExtractVMGroupHealthInfo(targetGroupArn string) } cblogger.Debug(result) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } retHealthInfo := irs.HealthInfo{} allVMs := []irs.IID{} @@ -1755,9 +1697,6 @@ func (NLBHandler *AwsNLBHandler) ChangeHealthCheckerInfo(nlbIID irs.IID, healthC cblogger.Info("Health information modification completed") cblogger.Debug(result) - if cblogger.Level.String() == "debug" { - cblogger.Debug(result) - } //최신 정보 조회 //최종 반영까지 시간이 걸리기 때문에 이전 정보를 수신할 확률이 높음. diff --git a/cloud-control-manager/cloud-driver/drivers/gcp/resources/NLBHandler.go b/cloud-control-manager/cloud-driver/drivers/gcp/resources/NLBHandler.go index 24fd6ac56..c38e2e928 100644 --- a/cloud-control-manager/cloud-driver/drivers/gcp/resources/NLBHandler.go +++ b/cloud-control-manager/cloud-driver/drivers/gcp/resources/NLBHandler.go @@ -4,14 +4,15 @@ import ( "context" "encoding/json" "errors" + "strconv" + "strings" + "time" + call "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/call-log" idrv "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/interfaces" irs "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/interfaces/resources" compute "google.golang.org/api/compute/v1" "google.golang.org/api/googleapi" - "strconv" - "strings" - "time" ) /* @@ -2913,9 +2914,7 @@ func (nlbHandler *GCPNLBHandler) getVmUrl(zoneID string, vmID irs.IID) (string, return "", err } callogger.Info(call.String(callLogInfo)) - if cblogger.Level.String() == "debug" { - cblogger.Debug(vm) - } + cblogger.Debug(vm) return vm.SelfLink, nil } diff --git a/cloud-control-manager/cloud-driver/drivers/gcp/resources/SecurityHandler.go b/cloud-control-manager/cloud-driver/drivers/gcp/resources/SecurityHandler.go index aafee85c3..5d0826faa 100644 --- a/cloud-control-manager/cloud-driver/drivers/gcp/resources/SecurityHandler.go +++ b/cloud-control-manager/cloud-driver/drivers/gcp/resources/SecurityHandler.go @@ -253,9 +253,8 @@ func (securityHandler *GCPSecurityHandler) CreateSecurity(securityReqInfo irs.Se } vNetInfo, errVnet := vNetworkHandler.GetVPC(securityReqInfo.VpcIID) - if cblogger.Level.String() == "debug" { - cblogger.Debug(vNetInfo) - } + cblogger.Debug(vNetInfo) + if errVnet != nil { cblogger.Error(errVnet) return irs.SecurityInfo{}, errVnet @@ -365,9 +364,7 @@ func (securityHandler *GCPSecurityHandler) CreateSecurity(securityReqInfo irs.Se cblogger.Info("Firewall policy to be created.", itemIndex, firewallDirection, reqEgressCount, reqIngressCount) cblogger.Debug(fireWall) - if cblogger.Level.String() == "debug" { - cblogger.Debug(fireWall) - } + addFilewallList = append(addFilewallList, fireWall) } diff --git a/cloud-control-manager/cloud-driver/drivers/gcp/resources/VMHandler.go b/cloud-control-manager/cloud-driver/drivers/gcp/resources/VMHandler.go index c124862c4..3ffce3be7 100644 --- a/cloud-control-manager/cloud-driver/drivers/gcp/resources/VMHandler.go +++ b/cloud-control-manager/cloud-driver/drivers/gcp/resources/VMHandler.go @@ -225,9 +225,8 @@ func (vmHandler *GCPVMHandler) StartVM(vmReqInfo irs.VMReqInfo) (irs.VMInfo, err //pubKey := "cb-user:" + keypairInfo.PublicKey pubKey = "cb-user:" + strings.TrimSpace(publicKey) + " " + "cb-user" cblogger.Debug("keypairInfo Information") - if cblogger.Level.String() == "debug" { - cblogger.Debug(keypairInfo) - } + cblogger.Debug(keypairInfo) + } // Security Group Tags @@ -422,9 +421,7 @@ func (vmHandler *GCPVMHandler) StartVM(vmReqInfo irs.VMReqInfo) (irs.VMInfo, err cblogger.Info("VM Creation Started") cblogger.Debug(instance) - if cblogger.Level.String() == "debug" { - cblogger.Debug(instance) - } + // logger for HisCall callogger := call.GetLogger("HISCALL") callLogInfo := call.CLOUDLOGSCHEMA{ @@ -471,9 +468,7 @@ func (vmHandler *GCPVMHandler) StartVM(vmReqInfo irs.VMReqInfo) (irs.VMInfo, err callLogInfo.ElapsedTime = call.Elapsed(callLogStart) cblogger.Info("VM creation request call completed.") cblogger.Debug(op) - if cblogger.Level.String() == "debug" { - cblogger.Debug(op) - } + callogger.Info(call.String(callLogInfo)) // check operation status, wait until operation is completed @@ -603,9 +598,8 @@ func (vmHandler *GCPVMHandler) SuspendVM(vmID irs.IID) (irs.VMStatus, error) { //inst, err := vmHandler.Client.Instances.Stop(projectID, zone, vmID.SystemId).Context(ctx).Do() inst, err := vmHandler.GCPInstanceStop(projectID, zone, vmID.SystemId) callLogInfo.ElapsedTime = call.Elapsed(callLogStart) - if cblogger.Level.String() == "debug" { - cblogger.Debug(inst) - } + cblogger.Debug(inst) + if err != nil { callLogInfo.ErrorMSG = err.Error() callogger.Info(call.String(callLogInfo)) @@ -648,9 +642,8 @@ func (vmHandler *GCPVMHandler) ResumeVM(vmID irs.IID) (irs.VMStatus, error) { callLogStart := call.Start() inst, err := vmHandler.Client.Instances.Start(projectID, zone, vmID.SystemId).Context(ctx).Do() callLogInfo.ElapsedTime = call.Elapsed(callLogStart) - if cblogger.Level.String() == "debug" { - cblogger.Debug(inst) - } + cblogger.Debug(inst) + if err != nil { callLogInfo.ErrorMSG = err.Error() callogger.Info(call.String(callLogInfo)) @@ -794,9 +787,8 @@ func (vmHandler *GCPVMHandler) TerminateVM(vmID irs.IID) (irs.VMStatus, error) { callLogStart := call.Start() inst, err := vmHandler.Client.Instances.Delete(projectID, zone, vmID.SystemId).Context(ctx).Do() callLogInfo.ElapsedTime = call.Elapsed(callLogStart) - if cblogger.Level.String() == "debug" { - cblogger.Debug(inst) - } + cblogger.Debug(inst) + if err != nil { callLogInfo.ErrorMSG = err.Error() callogger.Info(call.String(callLogInfo)) @@ -990,9 +982,7 @@ func (vmHandler *GCPVMHandler) GetVM(vmID irs.IID) (irs.VMInfo, error) { return irs.VMInfo{}, err } callogger.Info(call.String(callLogInfo)) - if cblogger.Level.String() == "debug" { - cblogger.Debug(vm) - } + cblogger.Debug(vm) vmInfo := vmHandler.mappingServerInfo(vm) return vmInfo, nil @@ -1038,9 +1028,8 @@ func (vmHandler *GCPVMHandler) GetVmById(vmID irs.IID) (irs.VMInfo, error) { if item.Instances != nil { for _, instance := range item.Instances { if strings.EqualFold(vmID.SystemId, instance.Name) { - if cblogger.Level.String() == "debug" { - cblogger.Debug(instance) - } + cblogger.Debug(instance) + vmInfo = vmHandler.mappingServerInfo(instance) foundVm = true break @@ -1081,10 +1070,7 @@ func (vmHandler *GCPVMHandler) GetVmById(vmID irs.IID) (irs.VMInfo, error) { func (vmHandler *GCPVMHandler) mappingServerInfo(server *compute.Instance) irs.VMInfo { cblogger.Debug("================Mapping=====================================") - if cblogger.Level.String() == "debug" { - cblogger.Debug(server) - } - cblogger.Info("server: ", server) + cblogger.Debug("server: ", server) //var gcpHanler *GCPVMHandler vpcArr := strings.Split(server.NetworkInterfaces[0].Network, "/") @@ -1239,9 +1225,7 @@ func (vmHandler *GCPVMHandler) getImageIID(server *compute.Instance) irs.IID { info, err := vmHandler.getDiskInfo(server.Disks[0].Source) cblogger.Infof("********************************** Disk Information ****************") - if cblogger.Level.String() == "debug" { - cblogger.Debug(info) - } + cblogger.Debug(info) if err != nil { cblogger.Error(err) return irs.IID{} @@ -1278,9 +1262,8 @@ func (vmHandler *GCPVMHandler) getDiskInfo(diskname string) (*compute.Disk, erro info, err := GetDiskInfo(vmHandler.Client, vmHandler.Credential, vmHandler.Region, result) cblogger.Infof("********************************** Disk Information ****************") - if cblogger.Level.String() == "debug" { - cblogger.Debug(info) - } + cblogger.Debug(info) + if err != nil { cblogger.Error(err) return &compute.Disk{}, err diff --git a/cloud-control-manager/cloud-driver/drivers/tencent/resources/VMHandler.go b/cloud-control-manager/cloud-driver/drivers/tencent/resources/VMHandler.go index 052fdb3c4..410463402 100644 --- a/cloud-control-manager/cloud-driver/drivers/tencent/resources/VMHandler.go +++ b/cloud-control-manager/cloud-driver/drivers/tencent/resources/VMHandler.go @@ -370,9 +370,8 @@ func (vmHandler *TencentVMHandler) StartVM(vmReqInfo irs.VMReqInfo) (irs.VMInfo, cblogger.Error(err) return irs.VMInfo{}, err } - if cblogger.Level.String() == "debug" { - cblogger.Debug(response) - } + cblogger.Debug(response) + callogger.Info(call.String(callLogInfo)) cblogger.Debug(response.ToJsonString())