Class: Bosh::Cloud
- Inherits:
-
Object
- Object
- Bosh::Cloud
- Defined in:
- lib/cloud.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
-
#attach_disk(vm_id, disk_id) ⇒ void
Attaches a disk.
-
#configure_networks(vm_id, networks) ⇒ void
Configures networking an existing VM.
-
#create_disk(size, vm_locality = nil) ⇒ String
Creates a disk (possibly lazily) that will be attached later to a VM.
-
#create_stemcell(image_path, cloud_properties) ⇒ String
Creates a stemcell.
-
#create_vm(agent_id, stemcell_id, resource_pool, networks, disk_locality = nil, env = nil) ⇒ 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_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_vm?(vm_id) ⇒ Boolean
Checks if a VM exists.
-
#initialize(options) ⇒ Cloud
constructor
Cloud initialization.
-
#reboot_vm(vm_id) ⇒ void
Reboots a VM.
-
#set_vm_metadata(vm, metadata) ⇒ void
Set metadata for a VM.
-
#snapshot_disk(disk_id, metadata = {}) ⇒ String
Take snapshot of disk.
-
#validate_deployment(old_manifest, new_manifest) ⇒ Object
Validates the deployment.
Constructor Details
#initialize(options) ⇒ Cloud
Cloud initialization
28 29 |
# File 'lib/cloud.rb', line 28 def initialize() end |
Instance Method Details
#attach_disk(vm_id, disk_id) ⇒ void
This method returns an undefined value.
Attaches a disk
178 179 180 |
# File 'lib/cloud.rb', line 178 def attach_disk(vm_id, disk_id) not_implemented(:attach_disk) end |
#configure_networks(vm_id, networks) ⇒ void
This method returns an undefined value.
Configures networking an existing VM.
147 148 149 |
# File 'lib/cloud.rb', line 147 def configure_networks(vm_id, networks) not_implemented(:configure_networks) end |
#create_disk(size, vm_locality = nil) ⇒ 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.
160 161 162 |
# File 'lib/cloud.rb', line 160 def create_disk(size, vm_locality = nil) not_implemented(:create_disk) end |
#create_stemcell(image_path, cloud_properties) ⇒ String
Creates a stemcell
46 47 48 |
# File 'lib/cloud.rb', line 46 def create_stemcell(image_path, cloud_properties) not_implemented(:create_stemcell) end |
#create_vm(agent_id, stemcell_id, resource_pool, networks, disk_locality = nil, env = nil) ⇒ 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"}
95 96 97 98 |
# File 'lib/cloud.rb', line 95 def create_vm(agent_id, stemcell_id, resource_pool, networks, disk_locality = nil, env = nil) not_implemented(:create_vm) end |
#current_vm_id ⇒ String
Get the vm_id of this host
35 36 37 |
# File 'lib/cloud.rb', line 35 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
170 171 172 |
# File 'lib/cloud.rb', line 170 def delete_disk(disk_id) not_implemented(:delete_disk) end |
#delete_snapshot(snapshot_id) ⇒ void
This method returns an undefined value.
Delete a disk snapshot
193 194 195 |
# File 'lib/cloud.rb', line 193 def delete_snapshot(snapshot_id) not_implemented(:delete_snapshot) end |
#delete_stemcell(stemcell_id) ⇒ void
This method returns an undefined value.
Deletes a stemcell
55 56 57 |
# File 'lib/cloud.rb', line 55 def delete_stemcell(stemcell_id) not_implemented(:delete_stemcell) end |
#delete_vm(vm_id) ⇒ void
This method returns an undefined value.
Deletes a VM
105 106 107 |
# File 'lib/cloud.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
201 202 203 |
# File 'lib/cloud.rb', line 201 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
209 210 211 |
# File 'lib/cloud.rb', line 209 def get_disks(vm_id) not_implemented(:get_disks) end |
#has_vm?(vm_id) ⇒ Boolean
Checks if a VM exists
114 115 116 |
# File 'lib/cloud.rb', line 114 def has_vm?(vm_id) not_implemented(:has_vm?) end |
#reboot_vm(vm_id) ⇒ void
This method returns an undefined value.
Reboots a VM
124 125 126 |
# File 'lib/cloud.rb', line 124 def reboot_vm(vm_id) not_implemented(:reboot_vm) 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.
136 137 138 |
# File 'lib/cloud.rb', line 136 def (vm, ) not_implemented(:set_vm_metadata) end |
#snapshot_disk(disk_id, metadata = {}) ⇒ String
Take snapshot of disk
186 187 188 |
# File 'lib/cloud.rb', line 186 def snapshot_disk(disk_id, ={}) not_implemented(:snapshot_disk) end |
#validate_deployment(old_manifest, new_manifest) ⇒ Object
Validates the deployment
215 216 217 |
# File 'lib/cloud.rb', line 215 def validate_deployment(old_manifest, new_manifest) not_implemented(:validate_deployment) end |