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

I got an error when deleting vnet or subnet with force #1923

Closed
sykim-etri opened this issue Nov 14, 2024 · 4 comments · Fixed by #1929
Closed

I got an error when deleting vnet or subnet with force #1923

sykim-etri opened this issue Nov 14, 2024 · 4 comments · Fixed by #1929
Labels
bug Something isn't working

Comments

@sykim-etri
Copy link
Member

일부 자원 상태가 꼬여서 CSP와 CB-SP에서 삭제한 일부 자원(vnet, subnet)에 대해 force 옵션으로 삭제하고자 하는 경우 CB-SP가 없는 자원이라 error를 리턴하고 있는데, 이로 인해 CB-TB내 자원 객체를 삭제하지 못하는 상황이 발생하는 것으로 보입니다.

추가로 force 옵션에 대한 CB-SP와 CB-TB가 convention(?)이 현재 어떻게 되어 있을까요?
@powerkimhub @yunkon-kim @seokho-son

8:15AM INF src/api/rest/server/middlewares/zerologger.go:59 > request ID=1731572101508981182 Method=DELETE URI=/tumblebug/ns/ns01/resources/vNet/ns01-shared-aws-ap-northeast-2?action=force clientIP=129.254.180.180 latency=18.008594ms status=500
8:15AM INF src/core/resource/vnet.go:746 > DeleteVNet
8:15AM DBG src/core/resource/vnet.go:786 > subnetsKv: [{Key:/ns/ns01/resources/vNet/ns01-shared-aws-ap-northeast-2/subnet/ns01-shared-aws-ap-northeast-2 Value:{"resourceType":"subnet","id":"ns01-shared-aws-ap-northeast-2","uid":"csq8ifm3j7gdqdupv2o0","cspResourceName":"csq8ifm3j7gdqdupv2o0","cspResourceId":"subnet-0ee746a863db8fd23","name":"ns01-shared-aws-ap-northeast-2","connectionName":"aws-ap-northeast-2","connectionConfig":{"configName":"","providerName":"","driverName":"","credentialName":"","credentialHolder":"","regionZoneInfoName":"","regionZoneInfo":{"assignedRegion":"","assignedZone":""},"regionDetail":{"regionId":"","regionName":"","description":"","location":{"display":"","latitude":0,"longitude":0},"zones":null},"regionRepresentative":false,"verified":false},"cspVNetName":"csq8ifm3j7gdqdupv2ng","cspVNetId":"vpc-0b81508ee30b55273","status":"Deleting","ipv4_CIDR":"10.25.0.0/18","zone":"ap-northeast-2a","keyValueList":[{"key":"VpcId","value":"vpc-0b81508ee30b55273"},{"key":"MapPublicIpOnLaunch","value":"false"},{"key":"AvailableIpAddressCount","value":"16379"},{"key":"AvailabilityZone","value":"ap-northeast-2a"},{"key":"Status","value":"available"}],"description":""}} {Key:/ns/ns01/resources/vNet/ns01-shared-aws-ap-northeast-2/subnet/ns01-shared-aws-ap-northeast-2-01 Value:{"resourceType":"subnet","id":"ns01-shared-aws-ap-northeast-2-01","uid":"csq8ifm3j7gdqdupv2og","cspResourceName":"csq8ifm3j7gdqdupv2og","cspResourceId":"subnet-05bf9a84dfd9874b0","name":"ns01-shared-aws-ap-northeast-2-01","connectionName":"aws-ap-northeast-2","connectionConfig":{"configName":"","providerName":"","driverName":"","credentialName":"","credentialHolder":"","regionZoneInfoName":"","regionZoneInfo":{"assignedRegion":"","assignedZone":""},"regionDetail":{"regionId":"","regionName":"","description":"","location":{"display":"","latitude":0,"longitude":0},"zones":null},"regionRepresentative":false,"verified":false},"cspVNetName":"csq8ifm3j7gdqdupv2ng","cspVNetId":"vpc-0b81508ee30b55273","status":"Available","ipv4_CIDR":"10.25.64.0/18","zone":"ap-northeast-2b","keyValueList":[{"key":"VpcId","value":"vpc-0b81508ee30b55273"},{"key":"MapPublicIpOnLaunch","value":"false"},{"key":"AvailableIpAddressCount","value":"16379"},{"key":"AvailabilityZone","value":"ap-northeast-2b"},{"key":"Status","value":"available"}],"description":""}}]
8:15AM INF src/core/resource/subnet.go:610 > DeleteSubnet
8:15AM ERR src/core/resource/subnet.go:747 > error="[Error from: http://localhost:1024/spider/vpc/csq8ifm3j7gdqdupv2ng/subnet/csq8ifm3j7gdqdupv2o0?force=true] Status code: 500 Internal Server Error, Message: {\"message\":\"aws-ap-northeast-2, csq8ifm3j7gdqdupv2o0: does not exist!\"}\n"
8:15AM ERR src/core/resource/vnet.go:822 > error="[Error from: http://localhost:1024/spider/vpc/csq8ifm3j7gdqdupv2ng/subnet/csq8ifm3j7gdqdupv2o0?force=true] Status code: 500 Internal Server Error, Message: {\"message\":\"aws-ap-northeast-2, csq8ifm3j7gdqdupv2o0: does not exist!\"}\n"
8:15AM ERR src/api/rest/server/resource/vnet.go:215 > error="[Error from: http://localhost:1024/spider/vpc/csq8ifm3j7gdqdupv2ng/subnet/csq8ifm3j7gdqdupv2o0?force=true] Status code: 500 Internal Server Error, Message: {\"message\":\"aws-ap-northeast-2, csq8ifm3j7gdqdupv2o0: does not exist!\"}\n"

// API to delete a subnet
url := fmt.Sprintf("%s/vpc/%s/subnet/%s", model.SpiderRestUrl, subnetInfo.CspVNetName, subnetInfo.CspResourceName)
queryParams := ""
if action == ActionForce {
queryParams = "?force=true"
}
url += queryParams
var spResp spiderBooleanInfoResp
client := resty.New()
method := "DELETE"
err = common.ExecuteHttpRequest(
client,
method,
url,
nil,
common.SetUseBody(spReqt),
&spReqt,
&spResp,
common.MediumDuration,
)
if err != nil {
log.Error().Err(err).Msg("")
return emptyRet, err
}

@sykim-etri sykim-etri added the bug Something isn't working label Nov 14, 2024
@yunkon-kim
Copy link
Member

yunkon-kim commented Nov 14, 2024

@sykim-etri

말씀주신 내용을 이해한 바로는 #1808 와 유사한 현상이라고 생각됩니다. (혹시, 다른 부분이 있으면 알려주시기 바랍니다.)

이를 해결하기 위해 refine옵션을 활용하시면 될 것 같습니다. refine옵션으로 해결되지 않으면 알려주세요.

refine / force option 관련 Convention은 API docs를 참고하시기 바랍니다. :-)
Ref) https://cloud-barista.github.io/api/?url=https://converter.swagger.io/api/convert?url=https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/main/src/api/rest/docs/swagger.json#/%5BInfra%20Resource%5D%20Network%20Management/DelSubnet

@sykim-etri
Copy link
Member Author

sykim-etri commented Nov 14, 2024

예전에도 유사하게 문의를 드렸던 내용이긴 하네요.^^
force: delete subnet regardless of the status of info/resource in Spider/CSP로 기재되어 있어서 혼동이 있었던 것 같습니다.
해당 설명을 개선하는 것이 맞을지는 검토가 필요해 보입니다.

@yunkon-kim
Copy link
Member

@sykim-etri
force: delete a subnet on a CSP regardless of the current resource status (e.g., attempt to delete even if in use) 이렇게 수정하면 괜찮으시려나요?

@sykim-etri
Copy link
Member Author

sykim-etri commented Nov 18, 2024

@yunkon-kim refine 옵션으로 삭제가 되는 것으로 보입니다. 그런데 force 키워드가 먼가 상관없이 막 지울 것 같은 느낌이긴 합니다. 아무튼 가이드만 명확하다면 상관없을 것 같습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants