Skip to content

Commit

Permalink
separate vm store and datastore scan supports checks
Browse files Browse the repository at this point in the history
  • Loading branch information
nasarak_786@hotmail.com authored and nasark committed Dec 19, 2023
1 parent 999306b commit c4e086c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
11 changes: 2 additions & 9 deletions app/models/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,11 @@ class Storage < ApplicationRecord

SUPPORTED_STORAGE_TYPES = %w[VSAN VMFS NAS NFS NFS41 ISCSI DIR FCP CSVFS NTFS GLUSTERFS].freeze

supports :smartstate_analysis do
if !ext_management_system&.class&.supports?(:smartstate_analysis)
_("Smartstate Analysis cannot be performed on selected Datastore")
elsif !ext_management_system&.authentication_status_ok?
_("There are no EMSs with valid credentials for this Datastore")
elsif !storage_type_supported_for_ssa?
_("Smartstate Analysis unsupported for storage type %{store_type}" % {:store_type => store_type})
end
end

supports(:delete) { _("Only storage without VMs and Hosts can be removed") if vms_and_templates.any? || hosts.any? }

supports_not :smartstate_analysis

def to_s
name
end
Expand Down
16 changes: 4 additions & 12 deletions app/models/vm_scan/dispatcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,18 +246,10 @@ def get_eligible_proxies_for_job(job)
return []
end

if @vm.requires_storage_for_scan?
if @vm.storage.nil?
msg = "Vm [#{@vm.path}] is not located on a storage, aborting job [#{job.guid}]."
queue_signal(job, {:args => [:abort, msg, "error"]})
return []
else
unless @vm.storage.supports?(:smartstate_analysis)
msg = @vm.storage.unsupported_reason(:smartstate_analysis)
queue_signal(job, {:args => [:abort, msg, "error"]})
return []
end
end
unless @vm.supports?(:smartstate_analysis)
msg = @vm.unsupported_reason(:smartstate_analysis)
queue_signal(job, {:args => [:abort, msg, "error"]})
return []
end

vm_proxies, = Benchmark.realtime_block(:get_eligible_proxies_for_job__proxies4job) { @vm.proxies4job(job) }
Expand Down

0 comments on commit c4e086c

Please sign in to comment.