Class: VSphereCloud::FixedClusterPlacer
- Inherits:
-
Object
- Object
- VSphereCloud::FixedClusterPlacer
- Defined in:
- lib/cloud/vsphere/fixed_cluster_placer.rb
Instance Attribute Summary collapse
-
#drs_rules ⇒ Object
readonly
Returns the value of attribute drs_rules.
Instance Method Summary collapse
-
#initialize(cluster, drs_rules) ⇒ FixedClusterPlacer
constructor
A new instance of FixedClusterPlacer.
- #pick_cluster_for_vm(memory, ephemeral, persistent) ⇒ Object
- #pick_ephemeral_datastore(cluster, disk_size_in_mb) ⇒ Object
- #pick_persistent_datastore(_, _) ⇒ Object
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_rules ⇒ Object (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
27 28 29 |
# File 'lib/cloud/vsphere/fixed_cluster_placer.rb', line 27 def pick_persistent_datastore(_, _) raise NotImplementedError end |