Class: Berta::Exclusions

Inherits:
Object
  • Object
show all
Defined in:
lib/berta/exclusions.rb

Overview

Class for Handeling berta exclusions

Constant Summary collapse

RESOURCE_STATES =

VM states that take resources

%w[SUSPENDED POWEROFF CLONING].freeze
ACTIVE_STATE =

Active state has some lcm states that should not expire

'ACTIVE'.freeze
NON_RESOURCE_ACTIVE_LCM_STATES =

LCM states in which active state shouldn’t expire

%w[EPILOG SHUTDOWN STOP UNDEPLOY FAILURE].freeze

Instance Method Summary collapse

Constructor Details

#initialize(ids, users, groups, clusters) ⇒ Exclusions

Constructs Exclusions object.

Parameters:

  • ids (Array<Numeric>)

    Ids of VM to exclude

  • users (Array<String>)

    User names to exclude

  • groups (Array<String>)

    Group names to exclude

  • clusters (Array<OpenNebula::Cluster>)

    Clusters to exclude



17
18
19
20
21
22
23
# File 'lib/berta/exclusions.rb', line 17

def initialize(ids, users, groups, clusters)
  @ids = ids
  @users = users
  @groups = groups
  @clusters = clusters
  log_exclusions
end

Instance Method Details

#filter!(vmhs) ⇒ Object

Filters out excluded vms, and vms that doesn’t take resources

Parameters:



28
29
30
31
32
33
34
35
36
# File 'lib/berta/exclusions.rb', line 28

def filter!(vmhs)
  filter_resources!(vmhs)
  filter_ids!(vmhs)
  filter_users!(vmhs)
  filter_groups!(vmhs)
  filter_clusters!(vmhs)
  logger.debug "After excluding: #{vmhs.map { |vmh| vmh.handle.id }}"
  vmhs
end