lib/sisfc/data_center.rb
def add_vm(vm, component_name)
      @vms[component_name] ||= []
      @vm_type_count[vm.size] ||= 0

      raise 'Error! VM is already present!' if @vms[component_name].include? vm

      # defer availablility check to user specified procedure
      if @availability_check_proc
        return false unless @availability_check_proc.call(@vm_type_count)
      end

      # allocate VM
      @vms[component_name] << vm
      @vm_type_count[vm.size] += 1
    end
# returns false in case no more VMs can be allocated
returns false in case no more VMs can be allocated
returns false in case no more VMs can be allocated
def add_vm(vm, component_name)
      @vms[component_name] ||= []
      @vm_type_count[vm.size] ||= 0
      raise 'Error! VM is already present!' if @vms[component_name].include? vm
      if @availability_check_proc
        return false unless @availability_check_proc.call(@vm_type_count)
      end
      @vms[component_name] << vm
      @vm_type_count[vm.size] += 1
    end
def add_vm ( vm , component_name ) @vms [ component_name ] ||= [ ] @vm_type_count [ vm . size ] ||= 0 raise 'Error! VM is already present!' if @vms [ component_name ] . include? vm if @availability_check_proc return false unless @availability_check_proc . call ( @vm_type_count ) end @vms [ component_name ] << vm @vm_type_count [ vm . size ] += 1 end
returns false in case no more VMs can be allocated
returns false in case no more VMs can be allocated
# defer availablility check to user specified procedure # allocate VM
vm
component_name