Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out orphaned hosts and cloud instances from list of running #17815

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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