Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable VNC Console for VMs hosted on ESXi 6.5 or greater #355

Merged
merged 1 commit into from
Feb 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/helpers/application_helper/toolbar_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,10 @@ def disable_button(id)
return true if @gtl_type && id.starts_with?("view_") && id.ends_with?(@gtl_type) # GTL view buttons
return true if id == "view_dashboard" && (@showtype == "dashboard")
return true if id == "view_summary" && (@showtype != "dashboard")
if id == 'vm_vnc_console' && @record.vendor == 'vmware' &&
ExtManagementSystem.find_by(:id => @record.ems_id).api_version.to_f >= 6.5
return N_("VNC consoles are unsupported on VMware ESXi 6.5 and later.")
end

# need to add this here, since this button is on list view screen
if disable_new_iso_datastore?(id)
Expand Down
21 changes: 21 additions & 0 deletions spec/helpers/application_helper/toolbar_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,27 @@ def setup_firefox_with_linux
expect(subject).to include('cannot be performed on selected')
end
end

context "and id = vm_vnc_console" do
before :each do
@id = 'vm_vnc_console'
@record = FactoryGirl.create(:vm_vmware)
end

it "should not be available for vmware hosts with an api version greater or equal to 6.5" do
@ems = FactoryGirl.create(:ems_vmware, :api_version => '6.5')
allow(@record).to receive(:ems_id).and_return(@ems.id)
expect(subject).to include('VNC consoles are unsupported on VMware ESXi 6.5 and later.')
end

%w(5.1 5.5 6.0).each do |version|
it "should be available for vmware hosts with an api version #{version}" do
@ems = FactoryGirl.create(:ems_vmware, :api_version => version)
allow(@record).to receive(:ems_id).and_return(@ems.id)
expect(subject).to be(false)
end
end
end
end # end of Vm class

end # end of disable button
Expand Down