Module: Bosh::CloudV1
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
-
#attach_disk(vm_id, disk_id) ⇒ void
Attaches a disk.
-
#calculate_vm_cloud_properties(vm_properties) ⇒ Hash
Specify VM’s hardware resources can be used with #create_vm.
-
#create_disk(size, cloud_properties, vm_locality) ⇒ String
Creates a disk (possibly lazily) that will be attached later to a VM.
-
#create_network(network_definition) ⇒ Hash
Creates a network that will be used to place VMs on.
-
#create_stemcell(image_path, cloud_properties) ⇒ String
Creates a stemcell.
-
#create_vm(agent_id, stemcell_id, resource_pool, networks, disk_locality, env) ⇒ String
Creates a VM - creates (and powers on) a VM from a stemcell with the proper resources and on the specified network.
-
#current_vm_id ⇒ String
Get the vm_id of this host.
-
#delete_disk(disk_id) ⇒ void
Deletes a disk Will raise an exception if the disk is attached to a VM.
-
#delete_network(network_id) ⇒ void
Deletes network by given network_id.
-
#delete_snapshot(snapshot_id) ⇒ void
Delete a disk snapshot.
-
#delete_stemcell(stemcell_id) ⇒ void
Deletes a stemcell.
-
#delete_vm(vm_id) ⇒ void
Deletes a VM.
-
#detach_disk(vm_id, disk_id) ⇒ void
Detaches a disk.
-
#get_disks(vm_id) ⇒ array[String]
List the attached disks of the VM.
-
#has_disk?(disk_id) ⇒ Boolean
Checks if a disk exists.
-
#has_vm?(vm_id) ⇒ Boolean
Checks if a VM exists.
-
#info ⇒ Object
Information about cpi.
-
#reboot_vm(vm_id) ⇒ void
Reboots a VM.
-
#resize_disk(disk_id, new_size) ⇒ void
Resizes an existing disk.
-
#set_disk_metadata(disk_id, metadata) ⇒ void
Set metadata for a disk.
-
#set_vm_metadata(vm, metadata) ⇒ void
Set metadata for a VM.
-
#snapshot_disk(disk_id, metadata) ⇒ String
Take snapshot of disk.
-
#update_disk(disk_id, new_size, cloud_properties) ⇒ void
Updates an existing disk via the IaaS API.
Instance Method Details
#attach_disk(vm_id, disk_id) ⇒ void
This method returns an undefined value.
Attaches a disk
190 191 192 |
# File 'lib/cloud_v1.rb', line 190 def attach_disk(vm_id, disk_id) not_implemented(:attach_disk) end |
#calculate_vm_cloud_properties(vm_properties) ⇒ Hash
Specify VM’s hardware resources can be used with #create_vm
251 252 253 |
# File 'lib/cloud_v1.rb', line 251 def calculate_vm_cloud_properties(vm_properties) not_implemented(:calculate_vm_cloud_properties) end |
#create_disk(size, cloud_properties, vm_locality) ⇒ String
Creates a disk (possibly lazily) that will be attached later to a VM. When VM locality is specified the disk will be placed near the VM so it won’t have to move when it’s attached later.
172 173 174 |
# File 'lib/cloud_v1.rb', line 172 def create_disk(size, cloud_properties, vm_locality) not_implemented(:create_disk) end |
#create_network(network_definition) ⇒ Hash
Creates a network that will be used to place VMs on.
262 263 264 |
# File 'lib/cloud_v1.rb', line 262 def create_network(network_definition) not_implemented(:create_network) end |
#create_stemcell(image_path, cloud_properties) ⇒ String
Creates a stemcell
48 49 50 |
# File 'lib/cloud_v1.rb', line 48 def create_stemcell(image_path, cloud_properties) not_implemented(:create_stemcell) end |
#create_vm(agent_id, stemcell_id, resource_pool, networks, disk_locality, env) ⇒ String
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"}
96 97 98 |
# File 'lib/cloud_v1.rb', line 96 def create_vm(agent_id, stemcell_id, resource_pool, networks, disk_locality, env) not_implemented(:create_vm) end |
#current_vm_id ⇒ String
Get the vm_id of this host
37 38 39 |
# File 'lib/cloud_v1.rb', line 37 def current_vm_id not_implemented(:current_vm_id) end |
#delete_disk(disk_id) ⇒ void
This method returns an undefined value.
Deletes a disk Will raise an exception if the disk is attached to a VM
182 183 184 |
# File 'lib/cloud_v1.rb', line 182 def delete_disk(disk_id) not_implemented(:delete_disk) end |
#delete_network(network_id) ⇒ void
This method returns an undefined value.
Deletes network by given network_id
270 271 272 |
# File 'lib/cloud_v1.rb', line 270 def delete_network(network_id) not_implemented(:delete_network) end |
#delete_snapshot(snapshot_id) ⇒ void
This method returns an undefined value.
Delete a disk snapshot
205 206 207 |
# File 'lib/cloud_v1.rb', line 205 def delete_snapshot(snapshot_id) not_implemented(:delete_snapshot) end |
#delete_stemcell(stemcell_id) ⇒ void
This method returns an undefined value.
Deletes a stemcell
57 58 59 |
# File 'lib/cloud_v1.rb', line 57 def delete_stemcell(stemcell_id) not_implemented(:delete_stemcell) end |
#delete_vm(vm_id) ⇒ void
This method returns an undefined value.
Deletes a VM. If the VM has already been deleted, this call returns normally and has no effect.
105 106 107 |
# File 'lib/cloud_v1.rb', line 105 def delete_vm(vm_id) not_implemented(:delete_vm) end |
#detach_disk(vm_id, disk_id) ⇒ void
This method returns an undefined value.
Detaches a disk
213 214 215 |
# File 'lib/cloud_v1.rb', line 213 def detach_disk(vm_id, disk_id) not_implemented(:detach_disk) end |
#get_disks(vm_id) ⇒ array[String]
List the attached disks of the VM. other disk-related methods on the CPI
221 222 223 |
# File 'lib/cloud_v1.rb', line 221 def get_disks(vm_id) not_implemented(:get_disks) end |
#has_disk?(disk_id) ⇒ Boolean
Checks if a disk exists
123 124 125 |
# File 'lib/cloud_v1.rb', line 123 def has_disk?(disk_id) not_implemented(:has_disk?) end |
#has_vm?(vm_id) ⇒ Boolean
Checks if a VM exists
114 115 116 |
# File 'lib/cloud_v1.rb', line 114 def has_vm?(vm_id) not_implemented(:has_vm?) end |
#info ⇒ Object
Information about cpi
Sample info response:
{
"stemcell_formats" => ["aws-raw", "aws-light"],
"api_version" => <highest supported version>,
}
@return [Hash] information about cpi, currently supported stemcell formats; CPI api_version this cpi supports
29 30 31 |
# File 'lib/cloud_v1.rb', line 29 def info not_implemented(:info) end |
#reboot_vm(vm_id) ⇒ void
This method returns an undefined value.
Reboots a VM
133 134 135 |
# File 'lib/cloud_v1.rb', line 133 def reboot_vm(vm_id) not_implemented(:reboot_vm) end |
#resize_disk(disk_id, new_size) ⇒ void
This method returns an undefined value.
Resizes an existing disk
231 232 233 |
# File 'lib/cloud_v1.rb', line 231 def resize_disk(disk_id, new_size) not_implemented(:resize_disk) end |
#set_disk_metadata(disk_id, metadata) ⇒ void
This method returns an undefined value.
Set metadata for a disk
Optional. Implement to provide more information for the IaaS.
157 158 159 |
# File 'lib/cloud_v1.rb', line 157 def (disk_id, ) not_implemented(:set_disk_metadata) end |
#set_vm_metadata(vm, metadata) ⇒ void
This method returns an undefined value.
Set metadata for a VM
Optional. Implement to provide more information for the IaaS.
145 146 147 |
# File 'lib/cloud_v1.rb', line 145 def (vm, ) not_implemented(:set_vm_metadata) end |
#snapshot_disk(disk_id, metadata) ⇒ String
Take snapshot of disk
198 199 200 |
# File 'lib/cloud_v1.rb', line 198 def snapshot_disk(disk_id, ) not_implemented(:snapshot_disk) end |
#update_disk(disk_id, new_size, cloud_properties) ⇒ void
This method returns an undefined value.
Updates an existing disk via the IaaS API
243 244 245 |
# File 'lib/cloud_v1.rb', line 243 def update_disk(disk_id, new_size, cloud_properties) not_implemented(:update_disk) end |