Skip to content

Commit

Permalink
Merge pull request #17815 from yrudman/filter-out-archived-hosts-from…
Browse files Browse the repository at this point in the history
…-list-of-running

Filter out orphaned hosts and cloud instances from list of running
  • Loading branch information
gtanzillo committed Aug 15, 2018
2 parents 1ef29e6 + f6dcd71 commit 5c20422
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
2 changes: 2 additions & 0 deletions app/models/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class Host < ApplicationRecord
virtual_delegate :annotation, :to => :hardware, :prefix => "v", :allow_nil => true
virtual_column :vmm_vendor_display, :type => :string
virtual_column :ipmi_enabled, :type => :boolean
virtual_column :archived, :type => :boolean

virtual_has_many :resource_pools, :uses => :all_relationships
virtual_has_many :miq_scsi_luns, :uses => {:hardware => {:storage_adapters => {:miq_scsi_targets => :miq_scsi_luns}}}
Expand Down Expand Up @@ -1768,6 +1769,7 @@ def read_only_storages
def archived?
ems_id.nil?
end
alias archived archived?

def normalized_state
return 'archived' if archived?
Expand Down
30 changes: 24 additions & 6 deletions db/fixtures/miq_searches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,28 @@
value: uat
search_type: default
db: Host
- attributes:
name: default_Status / Orhaned
description: Status / Orhaned
filter: !ruby/object:MiqExpression
exp:
"=":
field: Host-archived
value: "true"
search_type: default
db: Host
- attributes:
name: default_Status / Running
description: Status / Running
filter: !ruby/object:MiqExpression
exp:
INCLUDES:
field: Host-power_state
value: "on"
and:
- INCLUDES:
field: Host-power_state
value: "on"
- "=":
field: Host-archived
value: "false"
search_type: default
db: Host
- attributes:
Expand Down Expand Up @@ -943,9 +957,13 @@
description: Status / Running
filter: !ruby/object:MiqExpression
exp:
"=":
field: VmCloud-power_state
value: "on"
and:
- "=":
field: VmCloud-power_state
value: "on"
- "=":
field: VmCloud-archived
value: "false"
search_type: default
db: ManageIQ::Providers::CloudManager::Vm
- attributes:
Expand Down

0 comments on commit 5c20422

Please sign in to comment.