-node[:kernel][:modules].each_key do |modname|
- case modname
- when "cciss"
- tools_packages << "ssacli"
- status_packages["cciss-vol-status"] ||= []
- when "hpsa"
- tools_packages << "ssacli"
- status_packages["cciss-vol-status"] ||= []
- when "mptsas"
- tools_packages << "lsiutil"
- status_packages["mpt-status"] ||= []
- when "mpt2sas", "mpt3sas"
- tools_packages << "sas2ircu"
- status_packages["sas2ircu-status"] ||= []
- when "megaraid_mm"
- tools_packages << "megactl"
- status_packages["megaraid-status"] ||= []
- when "megaraid_sas"
- tools_packages << "megacli"
- status_packages["megaclisas-status"] ||= []
- when "aacraid"
- tools_packages << "arcconf"
- status_packages["aacraid-status"] ||= []
- when "arcmsr"
- tools_packages << "areca"
- end
-end
-
-node[:block_device].each do |name, attributes|
- next unless attributes[:vendor] == "HP" && attributes[:model] == "LOGICAL VOLUME"
-
- if name =~ /^cciss!(c[0-9]+)d[0-9]+$/
- status_packages["cciss-vol-status"] |= ["cciss/#{Regexp.last_match[1]}d0"]
- else
- Dir.glob("/sys/block/#{name}/device/scsi_generic/*").each do |sg|
- status_packages["cciss-vol-status"] |= [File.basename(sg)]
+if node[:virtualization][:role] != "guest" ||
+ (node[:virtualization][:system] != "lxc" &&
+ node[:virtualization][:system] != "lxd" &&
+ node[:virtualization][:system] != "openvz")
+
+ node[:kernel][:modules].each_key do |modname|
+ case modname
+ when "cciss"
+ tools_packages << "ssacli"
+ status_packages["cciss-vol-status"] ||= []
+ when "hpsa"
+ tools_packages << "ssacli"
+ status_packages["cciss-vol-status"] ||= []
+ when "mptsas"
+ tools_packages << "lsiutil"
+ status_packages["mpt-status"] ||= []
+ when "mpt2sas", "mpt3sas"
+ tools_packages << "sas2ircu"
+ status_packages["sas2ircu-status"] ||= []
+ when "megaraid_sas"
+ tools_packages << "megacli"
+ status_packages["megaclisas-status"] ||= []
+ when "aacraid"
+ tools_packages << "arcconf"
+ status_packages["aacraid-status"] ||= []
+ when "arcmsr"
+ tools_packages << "areca"
+ end
+ end
+
+ node[:block_device].each do |name, attributes|
+ next unless attributes[:vendor] == "HP" && attributes[:model] == "LOGICAL VOLUME"
+
+ if name =~ /^cciss!(c[0-9]+)d[0-9]+$/
+ status_packages["cciss-vol-status"] |= ["cciss/#{Regexp.last_match[1]}d0"]
+ else
+ Dir.glob("/sys/block/#{name}/device/scsi_generic/*").each do |sg|
+ status_packages["cciss-vol-status"] |= [File.basename(sg)]
+ end