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

Add VM group feature to request multiple VMs simply #413

Merged
merged 4 commits into from
Mar 15, 2021

Conversation

seokho-son
Copy link
Member

resolves #412

기존 MCIS 생성 API를 활용하여, Group 단위의 VM 생성 기능 제공

기존 MCIS 생성 API에서,
vm 요청 명세에 vmGroupSize 를 1 이상 입력하면,
(참고: vmGroupSize 를 명시하지 않거나 0으로 지정하면, 기존의 개별 vm 생성 방식과 동일하게 동작함)

TbVmGroupInfo 오브젝트가 생성되고, CB-TB가 지정된 숫자만큼 자동으로 vm을 생성함.
이때 vm의 이름은
vm 명세에 지정된 name에
postfix (-N) 를 추가하여 자동 생성.

요청 정보에 vmGroupSize 가 추가됨.

"vmGroupSize": "3",

[요청 예시]

	curl -H "${AUTH}" -sX POST http://$TumblebugServer/tumblebug/ns/$NS_ID/mcis -H 'Content-Type: application/json' -d \
		'{
			"name": "'${CONN_CONFIG[$INDEX,$REGION]}'-'${POSTFIX}'",
			"description": "Tumblebug Demo",
			"installMonAgent": "yes",
			"vm": [ {
				"vmGroupSize": "3",
				"name": "'${CONN_CONFIG[$INDEX,$REGION]}'-'${POSTFIX}'",
				"imageId": "'${CONN_CONFIG[$INDEX,$REGION]}'-'${POSTFIX}'",
				"vmUserAccount": "cb-user",
				"connectionName": "'${CONN_CONFIG[$INDEX,$REGION]}'",
				"sshKeyId": "'${CONN_CONFIG[$INDEX,$REGION]}'-'${POSTFIX}'",
				"specId": "'${CONN_CONFIG[$INDEX,$REGION]}'-'${POSTFIX}'",
				"securityGroupIds": [
					"'${CONN_CONFIG[$INDEX,$REGION]}'-'${POSTFIX}'"
				],
				"vNetId": "'${CONN_CONFIG[$INDEX,$REGION]}'-'${POSTFIX}'",
				"subnetId": "'${CONN_CONFIG[$INDEX,$REGION]}'-'${POSTFIX}'",
				"description": "description",
				"vmUserPassword": ""
			}
			]
		}' | json_pp || return 1

vm의 vmGroupId 항목이 MCIS 조회 정보에 추가됨

"vmGroupId" : "aws-ap-southeast-1-shson",

[MCIS 정보 조회 예시]

####################################################################
## 8. vm: Create MCIS
####################################################################
[Test for AWS]
{
   "status" : "Running-(3/3)",
   "targetAction" : "Create",
   "placement_algo" : "",
   "label" : "",
   "targetStatus" : "Running",
   "name" : "aws-ap-southeast-1-shson",
   "installMonAgent" : "yes",
   "id" : "aws-ap-southeast-1-shson",
   "description" : "Tumblebug Demo",
   "vm" : [
      {
         "location" : {
            "nativeRegion" : "ap-southeast-1",
            "latitude" : "1.3700",
            "briefAddr" : "Singapore",
            "cloudType" : "aws",
            "longitude" : "103.8000"
         },
         "vNetId" : "aws-ap-southeast-1-shson",
         "id" : "aws-ap-southeast-1-shson-0",
         "description" : "description",
         "publicDNS" : "",
         "vmUserAccount" : "",
         "vmGroupId" : "aws-ap-southeast-1-shson",
         "name" : "aws-ap-southeast-1-shson-0",
         "vmUserPassword" : "",
         "sshKeyId" : "aws-ap-southeast-1-shson",
         "monAgentStatus" : "notInstalled",
         "privateDNS" : "ip-192-168-1-221.ap-southeast-1.compute.internal",
         "securityGroupIds" : [
            "aws-ap-southeast-1-shson"
         ],
         "targetAction" : "None",
         "specId" : "aws-ap-southeast-1-shson",
         "publicIP" : "18.141.190.17",
         "vmBlockDisk" : "/dev/sda1",
         "region" : {
            "Zone" : "ap-southeast-1a",
            "Region" : "ap-southeast-1"
         },
         "connectionName" : "aws-ap-southeast-1",
         "cspViewVmDetail" : {
...
         },
         "subnetId" : "aws-ap-southeast-1-shson",
         "targetStatus" : "None",
         "privateIP" : "192.168.1.221",
         "vmBootDisk" : "/dev/sda1",
         "imageId" : "aws-ap-southeast-1-shson",
         "label" : "",
         "status" : "Running"
      },
      {
         "vmBootDisk" : "/dev/sda1",
         "privateIP" : "192.168.1.47",
         "targetStatus" : "None",
         "status" : "Running",
         "imageId" : "aws-ap-southeast-1-shson",
         "label" : "",
         "specId" : "aws-ap-southeast-1-shson",
         "subnetId" : "aws-ap-southeast-1-shson",
         "connectionName" : "aws-ap-southeast-1",
         "vmBlockDisk" : "/dev/sda1",
         "region" : {
            "Zone" : "ap-southeast-1a",
            "Region" : "ap-southeast-1"
         },
         "publicIP" : "54.169.242.59",
         "monAgentStatus" : "notInstalled",
         "privateDNS" : "ip-192-168-1-47.ap-southeast-1.compute.internal",
         "sshKeyId" : "aws-ap-southeast-1-shson",
         "vmUserPassword" : "",
         "name" : "aws-ap-southeast-1-shson-1",
         "vmGroupId" : "aws-ap-southeast-1-shson",
         "targetAction" : "None",
         "securityGroupIds" : [
            "aws-ap-southeast-1-shson"
         ],
         "location" : {
            "nativeRegion" : "ap-southeast-1",
            "briefAddr" : "Singapore",
            "longitude" : "103.8000",
            "cloudType" : "aws",
            "latitude" : "1.3700"
         },
         "vNetId" : "aws-ap-southeast-1-shson",
         "vmUserAccount" : "",
         "publicDNS" : "",
         "description" : "description",
         "id" : "aws-ap-southeast-1-shson-1"
      },
      {
         "name" : "aws-ap-southeast-1-shson-2",
         "vmUserPassword" : "",
         "vmGroupId" : "aws-ap-southeast-1-shson",
         "sshKeyId" : "aws-ap-southeast-1-shson",
         "monAgentStatus" : "notInstalled",
         "privateDNS" : "ip-192-168-1-50.ap-southeast-1.compute.internal",
         "targetAction" : "None",
         "securityGroupIds" : [
            "aws-ap-southeast-1-shson"
         ],
         "location" : {
            "briefAddr" : "Singapore",
            "cloudType" : "aws",
            "longitude" : "103.8000",
            "latitude" : "1.3700",
            "nativeRegion" : "ap-southeast-1"
         },
         "vNetId" : "aws-ap-southeast-1-shson",
         "publicDNS" : "",
         "description" : "description",
         "id" : "aws-ap-southeast-1-shson-2",
         "vmUserAccount" : "",
         "targetStatus" : "None",
         "privateIP" : "192.168.1.50",
         "vmBootDisk" : "/dev/sda1",
         "label" : "",
         "imageId" : "aws-ap-southeast-1-shson",
         "status" : "Running",
         "specId" : "aws-ap-southeast-1-shson",
...
         "connectionName" : "aws-ap-southeast-1",
         "region" : {
            "Zone" : "ap-southeast-1a",
            "Region" : "ap-southeast-1"
         },
         "vmBlockDisk" : "/dev/sda1",
         "publicIP" : "52.221.226.158",
         "subnetId" : "aws-ap-southeast-1-shson"
      }
   ]
}

Copy link
Member

@jihoon-seo jihoon-seo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me !!

@jihoon-seo jihoon-seo merged commit 85decb5 into cloud-barista:master Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add VM group feature to request multiple VMs simply
2 participants