Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
added create_vm description
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilien committed Jun 10, 2015
1 parent de85f16 commit 43ecaae
Show file tree
Hide file tree
Showing 2 changed files with 184 additions and 0 deletions.
99 changes: 99 additions & 0 deletions CPI/bosh_cpi.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,89 @@
}
}
}
},
"/create_vm": {
"post": {
"summary": "Create VM",
"tags": [
"method",
"required",
"cli",
"vm"
],
"externalDocs": {
"description": "Golang example",
"url": "https://github.com/cppforlife/bosh-warden-cpi/blob/master/action/create_vm.go"
},
"description": "Creates a new VM based on the stemcell. Created VM must be accessible on the provided networks.\nMake sure to properly delete created resources if VM cannot be successfully created.\nAgent communication\nFor the BOSH Agent to successfully start on the created VM, several communication \nsettings must be exposed which include network configuration, message bus location, \nagent id, etc. Each infrastructure might have a different way of exposing such settings. \nFor example AWS CPI uses instance user metadata and BOSH Registry. vSphere CPI uses CDROM \ndrive. Most CPIs choose to communicate with default BOSH Agent hence communication settings \nfollow certain format: BOSH Agent infrastructure settings\n",
"parameters": [
{
"name": "agent_id",
"in": "query",
"description": "id selected by the BOSH Director for the VM's agent\n",
"required": true,
"type": "string"
},
{
"name": "stemcell_cid",
"in": "query",
"description": "cloud ID of the stemcell to use as a base image for new VM\n",
"required": true,
"type": "string"
},
{
"name": "create_vm",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CreateVM"
}
}
],
"responses": {
"default": {
"description": "VM CID",
"schema": {
"$ref": "#/definitions/VMID"
}
}
}
}
}
},
"definitions": {
"CreateVM": {
"properties": {
"cloud_properties": {
"type": "array",
"description": "cloud properties hash extracted from the stemcell tarball\n",
"items": {
"$ref": "#/definitions/PropertyItem"
}
},
"networks": {
"type": "array",
"description": "networks hash that specifies which VM networks must be configured (e.g. {'net1': { ... }, 'net2': { ... }}\n",
"items": {
"$ref": "#/definitions/NetworkItem"
}
},
"disk_cids": {
"description": "array of disk_cids for each disk that created VM will most likely be attached; \nthey could be used to optimize VM placement so that disks are located nearby\n",
"type": "array",
"items": {
"$ref": "#/definitions/DiskCID"
}
},
"environment": {
"type": "array",
"description": "resource pool's env hash specified in deployment manifest\n",
"items": {
"$ref": "#/definitions/PropertyItem"
}
}
}
},
"PropertyItem": {
"properties": {
"name": {
Expand All @@ -97,9 +177,28 @@
}
}
},
"NetworkItem": {
"properties": {
"name": {
"type": "string",
"description": "The nework name."
},
"value": {
"type": "object",
"description": "The network value (TODO needs to be a hash).",
"$ref": "#/definitions/PropertyItem"
}
}
},
"StemcellID": {
"type": "string"
},
"VMID": {
"type": "string"
},
"DiskCID": {
"type": "string"
},
"Empty": {
"type": "string"
}
Expand Down
85 changes: 85 additions & 0 deletions CPI/bosh_cpi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,79 @@ paths:
schema:
$ref: '#/definitions/Empty'

/create_vm:
post:
summary: Create VM
tags:
- method
- required
- cli
- vm
externalDocs:
description: Golang example
url: https://github.com/cppforlife/bosh-warden-cpi/blob/master/action/create_vm.go
description: |
Creates a new VM based on the stemcell. Created VM must be accessible on the provided networks.
Make sure to properly delete created resources if VM cannot be successfully created.
Agent communication
For the BOSH Agent to successfully start on the created VM, several communication
settings must be exposed which include network configuration, message bus location,
agent id, etc. Each infrastructure might have a different way of exposing such settings.
For example AWS CPI uses instance user metadata and BOSH Registry. vSphere CPI uses CDROM
drive. Most CPIs choose to communicate with default BOSH Agent hence communication settings
follow certain format: BOSH Agent infrastructure settings
parameters:
- name: agent_id
in: query
description: |
id selected by the BOSH Director for the VM's agent
required: true
type: string
- name: stemcell_cid
in: query
description: |
cloud ID of the stemcell to use as a base image for new VM
required: true
type: string
- name: create_vm
in: body
required: true
schema:
$ref: '#/definitions/CreateVM'
responses:
default:
description: VM CID
schema:
$ref: '#/definitions/VMID'

definitions:
CreateVM:
properties:
cloud_properties:
type: array
description: |
cloud properties hash extracted from the stemcell tarball
items:
$ref: '#/definitions/PropertyItem'
networks:
type: array
description: |
networks hash that specifies which VM networks must be configured (e.g. {'net1': { ... }, 'net2': { ... }}
items:
$ref: '#/definitions/NetworkItem'
disk_cids:
description: |
array of disk_cids for each disk that created VM will most likely be attached;
they could be used to optimize VM placement so that disks are located nearby
type: array
items:
$ref: '#/definitions/DiskCID'
environment:
type: array
description: |
resource pool's env hash specified in deployment manifest
items:
$ref: '#/definitions/PropertyItem'
PropertyItem:
properties:
name:
Expand All @@ -78,7 +150,20 @@ definitions:
value:
type: string
description: The property value.
NetworkItem:
properties:
name:
type: string
description: The nework name.
value:
type: object
description: The network value.
$ref: '#/definitions/PropertyItem'
StemcellID:
type: string
VMID:
type: string
DiskCID:
type: string
Empty:
type: string

0 comments on commit 43ecaae

Please sign in to comment.