Skip to content

Commit

Permalink
Merge pull request #1336 from innodreamer/master
Browse files Browse the repository at this point in the history
[NCP Classic] Update VM Tagging feature
  • Loading branch information
powerkimhub authored Sep 20, 2024
2 parents 1740b5e + 7610b3d commit 0f18ddd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
4 changes: 4 additions & 0 deletions cloud-control-manager/cloud-driver/drivers/ncp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ ssh -i /private_key_경로/private_key_파일명(~~.pem) cb-user@VM의_public_ip
- Security Group 생성/삭제시에는 NCP console에서 생성/삭제하고, Cloud-Barista에서 생성, 조회, 삭제 요청시 console에서 생성한 그 'Security Group 이름을 그대로' 사용함.
- Console에서 생성시, 이름은 최소 6자/최대 30자의 소문자만 가능하고, 숫자, '-' 기호 사용 가능

​ O NCP Classic 서비스는 cloud-init script를 삭제하는 API를 지원하지 않아, 연동 드라이버 내부적으로 VM 생성시 생성하여 적용한 cloud-init script가 삭제되지 않고 남아있으니 console에서 삭제해야함.
- NCP Classic console : Server > 'Init Script' 메뉴에서 삭제 필요
- (참고) NCP VPC 플랫폼은 cloud-init script를 삭제하는 API를 지원하여 드라이버에서 VM 생성 후 cloud-init script를 삭제함.

​ O NCP Classic NLB 이용시 다음 사항을 주의해야함.
- NCP Classic NLB는 HTTP, HTTPS, TCP, SSL protocol만 지원함.
- Listener, VM Group, HealthChecker protocol이 동일해야함.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,17 +265,19 @@ func (vmHandler *NcpVMHandler) StartVM(vmReqInfo irs.VMReqInfo) (irs.VMInfo, err
time.Sleep(time.Second * 2)

// Create the Tag List on the VM
tagHandler := NcpTagHandler {
RegionInfo: vmHandler.RegionInfo,
VMClient: vmHandler.VMClient,
}
_, createErr := tagHandler.createVMTagList(runResult.ServerInstanceList[0].ServerInstanceNo, vmReqInfo.TagList)
if err != nil {
newErr := fmt.Errorf("Failed to Create the Tag List on the VM : [%v]", createErr)
cblogger.Error(newErr.Error())
return irs.VMInfo{}, newErr
if len(vmReqInfo.TagList) > 0 {
tagHandler := NcpTagHandler {
RegionInfo: vmHandler.RegionInfo,
VMClient: vmHandler.VMClient,
}
_, createErr := tagHandler.createVMTagList(runResult.ServerInstanceList[0].ServerInstanceNo, vmReqInfo.TagList)
if err != nil {
newErr := fmt.Errorf("Failed to Create the Tag List on the VM : [%v]", createErr)
cblogger.Error(newErr.Error())
return irs.VMInfo{}, newErr
}
}

// Get Created New VM Info
vmInfo, error := vmHandler.GetVM(newVMIID)
if error != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@ func init() {
}

type VPC struct {
IID IId `json:"IId"`
Cidr string `json:"IPv4_CIDR"`
Subnet_List []Subnet `json:"SubnetInfoList"`
KeyValue_List []KeyValue `json:"KeyValueList"`
IID IId `json:"IId"`
Cidr string `json:"IPv4_CIDR"`
Subnet_List []Subnet `json:"SubnetInfoList"`
KeyValue_List []KeyValue `json:"KeyValueList"`
}

type Subnet struct {
IID IId `json:"IId"`
Cidr string `json:"IPv4_CIDR"`
KeyValue_List []KeyValue `json:"KeyValueList"`
IID IId `json:"IId"`
Zone string `json:"Zone"`
Cidr string `json:"IPv4_CIDR"`
KeyValue_List []KeyValue `json:"KeyValueList"`
}

type KeyValue struct {
Expand Down Expand Up @@ -326,12 +327,13 @@ func (VPCHandler *NcpVPCHandler) CreateSubnet(subnetReqInfo irs.SubnetInfo) (irs

newSubnetInfo := irs.SubnetInfo{
IId: irs.IID{
NameId: subnetReqInfo.IId.NameId,
NameId: subnetReqInfo.IId.NameId,
// Note!! : subnetReqInfo.IId.NameId -> SystemId
SystemId: subnetReqInfo.IId.NameId,
SystemId: subnetReqInfo.IId.NameId,
},
IPv4_CIDR: subnetReqInfo.IPv4_CIDR,
KeyValueList: []irs.KeyValue{
Zone: subnetReqInfo.Zone,
IPv4_CIDR: subnetReqInfo.IPv4_CIDR,
KeyValueList: []irs.KeyValue{
{Key: "NCP-Subnet-info.", Value: "This Subnet info. is temporary."},
},
}
Expand All @@ -351,6 +353,7 @@ func (VPCHandler *NcpVPCHandler) MappingVPCInfo(vpcJSON VPC) (irs.VPCInfo, error
for i := 0; i < len(vpcJSON.Subnet_List); i++ {
subnetInfo.IId.NameId = vpcJSON.Subnet_List[i].IID.NameID
subnetInfo.IId.SystemId = vpcJSON.Subnet_List[i].IID.SystemID
subnetInfo.Zone = vpcJSON.Subnet_List[i].Zone
subnetInfo.IPv4_CIDR = vpcJSON.Subnet_List[i].Cidr

for j := 0; j < len(vpcJSON.Subnet_List[i].KeyValue_List); j++ {
Expand All @@ -369,7 +372,7 @@ func (VPCHandler *NcpVPCHandler) MappingVPCInfo(vpcJSON VPC) (irs.VPCInfo, error
}

vpcInfo := irs.VPCInfo{
//VPC 정보는 CB에서 파일로 관리되므로 SystemId는 NameId와 동일하게
// Since the VPC information is managed as a file, the systemID is the same as the nameID.
IId: irs.IID{NameId: vpcJSON.IID.NameID, SystemId: vpcJSON.IID.NameID},
IPv4_CIDR: vpcJSON.Cidr,
SubnetInfoList: subnetInfoList,
Expand Down

0 comments on commit 0f18ddd

Please sign in to comment.