Module: Bosh::CloudV2

Includes:
CloudV1
Defined in:
lib/cloud_v2.rb

Overview

CPI - Cloud Provider Interface, used for interfacing with various IaaS APIs.

Key terms: Stemcell: template used for creating VMs (shouldn’t be powered on) VM: VM created from a stemcell with custom settings (networking and resources) Disk: volume that can be attached and detached from the VMs,

never attached to more than a single VM at one time

Instance Method Summary collapse

Methods included from CloudV1

#calculate_vm_cloud_properties, #create_disk, #create_network, #create_stemcell, #current_vm_id, #delete_disk, #delete_network, #delete_snapshot, #delete_stemcell, #delete_vm, #detach_disk, #get_disks, #has_disk?, #has_vm?, #info, #reboot_vm, #resize_disk, #set_disk_metadata, #set_vm_metadata, #snapshot_disk, #update_disk

Instance Method Details

#attach_disk(vm_id, disk_id) ⇒ Object

Attaches a disk Sample return value for attach_disk “/dev/sdd”

Parameters:

Returns:

  • (Object)

    hint for location of attached disk - varies by IaaS



92
93
94
# File 'lib/cloud_v2.rb', line 92

def attach_disk(vm_id, disk_id)
  not_implemented(:attach_disk)
end

#create_vm(agent_id, stemcell_id, resource_pool, networks, disk_locality, env) ⇒ Array

Creates a VM - creates (and powers on) a VM from a stemcell with the proper resources and on the specified network. When disk locality is present the VM will be placed near the provided disk so it won’t have to move when the disk is attached later.

Sample networking config:

{"network_a" =>
  {
    "netmask"          => "255.255.248.0",
    "ip"               => "172.30.41.40",
    "gateway"          => "172.30.40.1",
    "dns"              => ["172.30.22.153", "172.30.22.154"],
    "cloud_properties" => {"name" => "VLAN444"}
  }
}

Sample resource pool config (CPI specific):

{
  "ram"  => 512,
  "disk" => 512,
  "cpu"  => 1
}

or similar for EC2:

{"name" => "m1.small"}

Sample return value: [

"vm-cid-123",
{ # ... networks ...
  "private": {
    "type": "manual",
    "netmask": "255.255.255.0",
    "gateway": "10.230.13.1",
    "ip": "10.230.13.6",
    "default": [ "dns", "gateway" ],
    "cloud_properties": {
      "net_id": "d29fdb0d-44d8-4e04-818d-5b03888f8eaa"
    }
   },
  "public": {
    "type": "vip",
    "ip": "173.101.112.104",
    "cloud_properties": {}
  }
}

]

Parameters:

  • agent_id (String)

    UUID for the agent that will be used later on by the director to locate and talk to the agent

  • stemcell_id (String)

    stemcell id that was once returned by Bosh::CloudV1#create_stemcell

  • resource_pool (Hash)

    cloud specific properties describing the resources needed for this VM

  • networks (Hash)

    list of networks and their settings needed for this VM

  • disk_locality (String, Array)

    disk id(s) if known of the disk(s) that will be attached to this vm

  • env (Hash)

    environment that will be passed to this vm

Returns:

  • (Array)
    VM_ID, …networks…


80
81
82
# File 'lib/cloud_v2.rb', line 80

def create_vm(agent_id, stemcell_id, resource_pool, networks, disk_locality, env)
  not_implemented(:create_vm)
end