From 45389226f2774d00f8e5761af47c12b534972bbd Mon Sep 17 00:00:00 2001 From: "nasarak_786@hotmail.com" Date: Wed, 11 Oct 2023 15:23:40 -0400 Subject: [PATCH] separate vm store and datastore scan supports checks --- app/models/storage.rb | 1 + app/models/vm_scan/dispatcher.rb | 16 ++++------------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/app/models/storage.rb b/app/models/storage.rb index 26facf53bbb4..56a67db2a001 100644 --- a/app/models/storage.rb +++ b/app/models/storage.rb @@ -82,6 +82,7 @@ class Storage < ApplicationRecord supports(:delete) { _("Only storage without VMs and Hosts can be removed") if vms_and_templates.any? || hosts.any? } + def to_s name end diff --git a/app/models/vm_scan/dispatcher.rb b/app/models/vm_scan/dispatcher.rb index 8f5ee2930560..3d05719f0ee0 100644 --- a/app/models/vm_scan/dispatcher.rb +++ b/app/models/vm_scan/dispatcher.rb @@ -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) }