-
Notifications
You must be signed in to change notification settings - Fork 3
delete Unnecessary Code #28
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
Open
wind5052
wants to merge
1
commit into
Dev
Choose a base branch
from
deleteUnnecessaryCode
base: Dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,5 @@ | ||
| package service | ||
| package service | ||
|
|
||
| //현재 미사용중 | ||
| //이거 인스턴스 생성할 때 라운드로빈으로 코어에 할당해주는애 아니었나? | ||
| //확인 필요 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -3,9 +3,6 @@ package structure | |||
| import ( | ||||
| "context" | ||||
| "database/sql" | ||||
| "fmt" | ||||
| "net" | ||||
| "strings" | ||||
| "time" | ||||
|
|
||||
| "github.com/easy-cloud-Knet/KWS_Control/util" | ||||
|
|
@@ -35,54 +32,6 @@ func (c *ControlContext) FindCoreByVmUUID(uuid UUID) *Core { | |||
| return &c.Cores[coreIdx] | ||||
| } | ||||
|
|
||||
| func (c *ControlContext) AssignInternalAddress() (string, error) { | ||||
| var usedIPs = make(map[string]bool) | ||||
|
|
||||
| // 1. 이미 사용된 IP들을 수집 | ||||
| for _, core := range c.Cores { | ||||
| for _, vm := range core.VMInfoIdx { | ||||
| usedIPs[vm.IP_VM] = true | ||||
| } | ||||
| } | ||||
|
|
||||
| // 2. 서브넷을 순회하며 IP를 생성 | ||||
| for _, cidr := range c.Config.VmInternalSubnets { | ||||
| _, ipnet, err := net.ParseCIDR(cidr) | ||||
| if err != nil { | ||||
| continue | ||||
| } | ||||
|
|
||||
| for ip := ipnet.IP.Mask(ipnet.Mask); ipnet.Contains(ip); incrementIP(ip) { | ||||
| ipStr := ip.String() | ||||
|
|
||||
| if ipStr == ipnet.IP.String() { | ||||
| continue | ||||
| } | ||||
|
|
||||
| if strings.HasPrefix(ipStr, "10.5.15.") { | ||||
| lastOctet := ip[3] | ||||
| if lastOctet <= 10 { | ||||
| continue | ||||
| } | ||||
| } | ||||
| if !usedIPs[ipStr] && ipStr != ipnet.IP.String() { | ||||
| return ipStr, nil | ||||
| } | ||||
| } | ||||
| } | ||||
|
|
||||
| return "", fmt.Errorf("no ip available for allocation") | ||||
| } | ||||
|
|
||||
| func incrementIP(ip net.IP) { | ||||
| for i := len(ip) - 1; i >= 0; i-- { | ||||
| ip[i]++ | ||||
| if ip[i] != 0 { | ||||
| break | ||||
| } | ||||
| } | ||||
| } | ||||
|
|
||||
| func (contextStructure *ControlContext) AddInstance(instanceInfo *VMInfo, coreIdx int) error { | ||||
| log := util.GetLogger() | ||||
| tx, err := contextStructure.DB.Begin() | ||||
|
|
@@ -117,6 +66,8 @@ func (contextStructure *ControlContext) AddInstance(instanceInfo *VMInfo, coreId | |||
| return tx.Commit() | ||||
| } | ||||
|
|
||||
| // 현재 미사용중 | ||||
| // 이건 미사용중이면 안되지않나? 인스턴스정보 DB에 업데이트 하는거같은데 | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. KWS_Control/structure/control_infra.go Line 48 in 544f118
<--- 이 친구랑 로직이 어느정도 겹치는 것 같은데 업데이트 전 db 스키마에서 쓰던 것인지, 확인하면 될 것 같아요 |
||||
| func (contextStructure *ControlContext) UpdateInstance(instanceInfo *VMInfo) error { | ||||
| log := util.GetLogger() | ||||
| tx, err := contextStructure.DB.Begin() | ||||
|
|
||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
서비스는 구현이 되어있을텐데, 현재 개발환경이 없어서 바로 가져다 쓸 수 있을지는 검증해봐야 됩니당.
그떄 알려드릴게요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#27 (comment)
<-- 여기 구현되어 있다고 하네요. 참고바랍니다