@@ -2,6 +2,9 @@ class ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm < Man
2
2
include Operations
3
3
4
4
supports :capture
5
+ # leverages the logic of native_console
6
+ supports ( :console ) { unsupported_reason ( :native_console ) }
7
+ supports :vnc_console
5
8
supports :terminate
6
9
supports :reboot_guest do
7
10
_ ( "The VM is not powered on" ) unless current_state == "on"
@@ -20,22 +23,21 @@ class ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm < Man
20
23
supports_not :suspend
21
24
22
25
supports :publish do
23
- return _ ( "Publish not supported because VM is blank" ) if blank?
24
- return _ ( "Publish not supported because VM is orphaned" ) if orphaned?
25
- return _ ( "Publish not supported because VM is archived" ) if archived?
26
+ unsupported_reason ( :action )
26
27
end
27
28
28
29
# TODO: converge these all into console and use unsupported_reason(:console) for all
29
30
supports :html5_console do
30
- return _ ( "VM Console not supported because VM is not powered on" ) unless current_state == "on"
31
- return _ ( "VM Console not supported because VM is orphaned" ) if orphaned?
32
- return _ ( "VM Console not supported because VM is archived" ) if archived?
31
+ if current_state != "on"
32
+ _ ( "VM Console not supported because VM is not powered on" )
33
+ else
34
+ unsupported_reason ( :native_console )
35
+ end
33
36
end
34
37
supports :launch_html5_console
35
38
36
39
supports :native_console do
37
- return _ ( "VM Console not supported because VM is orphaned" ) if orphaned?
38
- return _ ( "VM Console not supported because VM is archived" ) if archived?
40
+ unsupported_reason ( :action )
39
41
end
40
42
41
43
supports :resize do
@@ -201,10 +203,6 @@ def self.calculate_power_state(raw_power_state)
201
203
end
202
204
end
203
205
204
- def console_supported? ( type )
205
- return true if type . upcase == 'VNC'
206
- end
207
-
208
206
def console_url
209
207
crn = ERB ::Util . url_encode ( ext_management_system . pcloud_crn . values . join ( ":" ) )
210
208
params = URI . encode_www_form ( :paneId => "manageiq" , :crn => crn )
0 commit comments