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

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

Defined Under Namespace

Classes: FakeRegistry

Instance Method Summary collapse

Constructor Details

#initialize(instance_manager, logger) ⇒ Vsphere

Returns a new instance of Vsphere.



6
7
8
9
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 6

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

Instance Method Details

#check_dependenciesObject



32
33
34
35
36
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 32

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

#discover_bosh_ipObject



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

def discover_bosh_ip
  instance_manager.bosh_ip
end

#disk_modelObject



14
15
16
17
18
19
20
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 14

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



53
54
55
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 53

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

#persistent_disk_changed?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 57

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

#remote_tunnelObject



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

def remote_tunnel
end

#service_ipObject



48
49
50
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 48

def service_ip
  instance_manager.bosh_ip
end

#startObject



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

def start
end

#stopObject



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

def stop
end

#update_spec(spec) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/bosh/deployer/instance_manager/vsphere.rb', line 22

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