Skip to content

Commit 23b0ab4

Browse files
committed
Convert VMware Host operations to supports feature
1 parent 26c18e4 commit 23b0ab4

File tree

1 file changed

+33
-8
lines changed
  • app/models/manageiq/providers/vmware/infra_manager

1 file changed

+33
-8
lines changed

app/models/manageiq/providers/vmware/infra_manager/host_esx.rb

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,39 @@ class ManageIQ::Providers::Vmware::InfraManager::HostEsx < ManageIQ::Providers::
22
supports :refresh_advanced_settings
33
supports :refresh_firewall_rules
44
supports :refresh_logs
5-
supports :reboot { validate_active_with_power_state(:reboot, "on") }
6-
supports :shutdown { validate_active_with_power_state(:shutdown, "on") }
7-
supports :standby { validate_active_with_power_state(:standby, "on") }
8-
supports :enter_maint_mode { validate_active_with_power_state(:enter_maint_mode, "on") }
9-
supports :exit_maint_mode { validate_active_with_power_state(:exit_maint_mode, "maintenance") }
10-
supports :enable_vmotion { validate_active_with_power_state(:enable_vmotion, "on") }
11-
supports :disable_vmotion { validate_active_with_power_state(:disable_vmotion, "on") }
12-
supports :vmotion { validate_active_with_power_state(:vmotion, "on") }
5+
supports :start do
6+
unsupported_reason_add(:reboot, _("The Host is not connected to an active Provider")) unless has_active_ems?
7+
unsupported_reason_add(:reboot, _("The host is not in standby")) unless power_state == "standby"
8+
end
9+
supports :reboot do
10+
unsupported_reason_add(:reboot, _("The Host is not connected to an active Provider")) unless has_active_ems?
11+
unsupported_reason_add(:reboot, _("The host is not running")) unless power_state == "on"
12+
end
13+
supports :shutdown do
14+
unsupported_reason_add(:shutdown, _("The Host is not connected to an active Provider")) unless has_active_ems?
15+
unsupported_reason_add(:shutdown, _("The host is not running")) unless power_state == "on"
16+
end
17+
supports :standby do
18+
unsupported_reason_add(:standby, _("The Host is not connected to an active Provider")) unless has_active_ems?
19+
unsupported_reason_add(:standby, _("The host is not running")) unless power_state == "on"
20+
end
21+
supports :enter_maint_mode do
22+
unsupported_reason_add(:enter_maint_mode, _("The Host is not connected to an active Provider")) unless has_active_ems?
23+
unsupported_reason_add(:enter_maint_mode, _("The host is not running")) unless power_state == "on"
24+
end
25+
supports :exit_maint_mode do
26+
unsupported_reason_add(:exit_maint_mode, _("The Host is not connected to an active Provider")) unless has_active_ems?
27+
unsupported_reason_add(:exit_maint_mode, _("The host is not in maintenance mode")) unless power_state == "maintenance"
28+
end
29+
supports :enable_vmotion do
30+
validate_active_with_power_state(:enable_vmotion, "on")
31+
end
32+
supports :disable_vmotion do
33+
validate_active_with_power_state(:disable_vmotion, "on")
34+
end
35+
supports :vmotion_enabled do
36+
validate_active_with_power_state(:vmotion, "on")
37+
end
1338

1439
def vim_shutdown(force = false)
1540
with_provider_object do |vim_host|

0 commit comments

Comments
 (0)