@@ -2,6 +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 :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
538
639 def vim_shutdown ( force = false )
740 with_provider_object do |vim_host |
@@ -177,4 +210,11 @@ def thumbprint_sha1
177210 require 'VMwareWebService/esx_thumb_print'
178211 ESXThumbPrint . new ( ipaddress , authentication_userid , authentication_password ) . to_sha1
179212 end
213+
214+ private
215+
216+ def validate_active_with_power_state ( feature , expected_power_state )
217+ return unsupported_reason_add ( feature , _ ( "The Host is not connected to an active Provider" ) ) unless has_active_ems?
218+ return unsupported_reason_add ( feature , _ ( "The host is not powered '#{ expected_power_state } '" ) ) unless expected_power_state == power_state
219+ end
180220end
0 commit comments