Class: Bosh::Deployer::InstanceManager::Vsphere

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/bosh/deployer/instance_manager/vsphere.rb

Defined Under Namespace

Classes: FakeRegistry

Instance Method Summary collapse

Constructor Details

#initialize(instance_manager, config, logger) ⇒ Vsphere

Returns a new instance of Vsphere.



8
9
10
11
12
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 8

def initialize(instance_manager, config, logger)
  @instance_manager = instance_manager
  @config = config
  @logger = logger
end

Instance Method Details

#check_dependenciesObject



35
36
37
38
39
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 35

def check_dependencies
  if Bosh::Common.which(%w[genisoimage mkisofs]).nil?
    err("either of 'genisoimage' or 'mkisofs' commands must be present")
  end
end

#disk_modelObject



17
18
19
20
21
22
23
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 17

def disk_model
  if @disk_model.nil?
    require 'cloud/vsphere'
    @disk_model = VSphereCloud::Models::Disk
  end
  @disk_model
end

#disk_size(cid) ⇒ Integer

Returns size in MiB.

Returns:

  • (Integer)

    size in MiB



55
56
57
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 55

def disk_size(cid)
  disk_model.first(uuid: cid).size
end

#persistent_disk_changed?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 59

def persistent_disk_changed?
  config.resources['persistent_disk'] != disk_size(instance_manager.state.disk_cid)
end

#remote_tunnelObject



14
15
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 14

def remote_tunnel
end

#startObject



41
42
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 41

def start
end

#stopObject



44
45
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 44

def stop
end

#update_spec(spec) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 25

def update_spec(spec)
  properties = spec.properties

  properties['vcenter'] =
    config.spec_properties['vcenter'] ||
      config.cloud_options['properties']['vcenters'].first.dup

  properties['vcenter']['address'] ||= properties['vcenter']['host']
end