Skip to content

Commit

Permalink
Merge pull request #22738 from nasark/separate_datastore_and_vm_store…
Browse files Browse the repository at this point in the history
…_scans

Separate vm store and datastore smartstate scan supports checks

(cherry picked from commit 2d545d0)
  • Loading branch information
agrare authored and Fryguy committed Jan 5, 2024
1 parent adfada4 commit 094d78c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
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
4 changes: 3 additions & 1 deletion spec/models/vm_or_template_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,9 @@

context "#supports?(:smartstate_analysis)" do
it "returns true for VMware VM" do
vm = FactoryBot.create(:vm_vmware)
vm = FactoryBot.create(:vm_vmware,
:storage => storage)

allow(vm).to receive_messages(:archived? => false)
allow(vm).to receive_messages(:orphaned? => false)
expect(vm.supports?(:smartstate_analysis)).to eq(true)
Expand Down

0 comments on commit 094d78c

Please sign in to comment.