diff --git a/app/models/manageiq/providers/ibm_cloud/power_virtual_servers/cloud_manager/vm.rb b/app/models/manageiq/providers/ibm_cloud/power_virtual_servers/cloud_manager/vm.rb index ab4e0ba51..794693d74 100644 --- a/app/models/manageiq/providers/ibm_cloud/power_virtual_servers/cloud_manager/vm.rb +++ b/app/models/manageiq/providers/ibm_cloud/power_virtual_servers/cloud_manager/vm.rb @@ -6,15 +6,15 @@ class ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm < Man supports(:console) { unsupported_reason(:native_console) } supports :terminate supports :reboot_guest do - unsupported_reason_add(:reboot_guest, _("The VM is not powered on")) unless current_state == "on" + _("The VM is not powered on") unless current_state == "on" end supports :reset do - unsupported_reason_add(:reset, _("The VM is not powered on")) unless current_state == "on" + _("The VM is not powered on") unless current_state == "on" end supports :snapshots supports :snapshot_create supports :revert_to_snapshot do - unsupported_reason_add(:revert_to_snapshot, _("Cannot revert to snapshot while VM is running")) unless current_state == "off" + _("Cannot revert to snapshot while VM is running") unless current_state == "off" end supports :remove_snapshot supports :remove_all_snapshots @@ -22,14 +22,17 @@ class ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm < Man supports_not :suspend supports :publish do - reason = _("Publish not supported because VM is blank") if blank? - reason ||= _("Publish not supported because VM is orphaned") if orphaned? - reason ||= _("Publish not supported because VM is archived") if archived? - unsupported_reason_add(:publish, reason) if reason + if blank? + _("Publish not supported because VM is blank") + elsif orphaned? + _("Publish not supported because VM is orphaned") + elsif archved? + _("Publish not supported because VM is archived") + end end supports :html5_console do - reason = _("VM Console not supported because VM is not powered on") unless current_state == "on" + unless current_state == "on" _("VM Console not supported because VM is not powered on") else unsupported_reason(:native_console) @@ -46,10 +49,15 @@ class ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::Vm < Man end supports :resize do - unsupported_reason_add(:resize, _('The VM is not powered off')) unless current_state == "off" - unsupported_reason_add(:resize, _('The VM is not connected to a provider')) unless ext_management_system - unsupported_reason_add(:resize, _('SAP VM resize not supported')) if flavor.kind_of?(ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::SAPProfile) + if current_state != "off" + _('The VM is not powered off') + elsif !ext_management_system + _('The VM is not connected to a provider') + elsif flavor.kind_of?(ManageIQ::Providers::IbmCloud::PowerVirtualServers::CloudManager::SAPProfile) + _('SAP VM resize not supported') + end end + supports :vnc_console def cloud_instance_id ext_management_system.uid_ems