Class: VSphereCloud::FixedClusterPlacer

Inherits:
Object
  • Object
show all
Defined in:
lib/cloud/vsphere/fixed_cluster_placer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cluster, drs_rules) ⇒ FixedClusterPlacer

Returns a new instance of FixedClusterPlacer.



5
6
7
8
# File 'lib/cloud/vsphere/fixed_cluster_placer.rb', line 5

def initialize(cluster, drs_rules)
  @cluster = cluster
  @drs_rules = drs_rules
end

Instance Attribute Details

#drs_rulesObject (readonly)

Returns the value of attribute drs_rules.



3
4
5
# File 'lib/cloud/vsphere/fixed_cluster_placer.rb', line 3

def drs_rules
  @drs_rules
end

Instance Method Details

#pick_cluster_for_vm(memory, ephemeral, persistent) ⇒ Object



10
11
12
13
# File 'lib/cloud/vsphere/fixed_cluster_placer.rb', line 10

def pick_cluster_for_vm(memory, ephemeral, persistent)
  @cluster.allocate(memory)
  @cluster
end

#pick_ephemeral_datastore(cluster, disk_size_in_mb) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cloud/vsphere/fixed_cluster_placer.rb', line 15

def pick_ephemeral_datastore(cluster, disk_size_in_mb)
  datastore = cluster.pick_ephemeral(disk_size_in_mb)

  if datastore.nil?
    raise Bosh::Clouds::NoDiskSpace.new(
      "Not enough ephemeral disk space (#{disk_size_in_mb}MB) in cluster #{cluster.name}")
  end

  datastore.allocate(disk_size_in_mb)
  datastore
end

#pick_persistent_datastore(_, _) ⇒ Object

Raises:

  • (NotImplementedError)


27
28
29
# File 'lib/cloud/vsphere/fixed_cluster_placer.rb', line 27

def pick_persistent_datastore(_, _)
  raise NotImplementedError
end