Skip to content

Commit

Permalink
Fixes #36499 - correct configuration for libvirt
Browse files Browse the repository at this point in the history
  • Loading branch information
lfu committed Jun 12, 2023
1 parent b9fd4ef commit 54dd203
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ function virt_who_update_listing_mode() {
function virt_who_update_hypervisor_fields() {
selected_type = $('#foreman_virt_who_configure_config_hypervisor_type').val();
var element = $('#foreman_virt_who_configure_config_hypervisor_username');
element.closest('.form-group').toggle(selected_type != 'kubevirt');
element.closest('.form-group').toggle(selected_type != 'libvirt' && selected_type != 'kubevirt');
var element = $('#foreman_virt_who_configure_config_hypervisor_password');
element.closest('.form-group').toggle(selected_type != 'libvirt' && selected_type != 'kubevirt');
var element = $('#foreman_virt_who_configure_config_kubeconfig_path');
element.closest('.form-group').toggle(selected_type == 'kubevirt');
var element = $('#foreman_virt_who_configure_config_hypervisor_server');
element.closest('.form-group').toggle(selected_type != 'kubevirt');
element.closest('.form-group').toggle(selected_type != 'libvirt' && selected_type != 'kubevirt');
var element = $('#foreman_virt_who_configure_config_ahv_internal_debug');
element.closest('.form-group').toggle(selected_type == 'ahv');
virt_who_update_listing_mode();
Expand Down
4 changes: 2 additions & 2 deletions app/models/foreman_virt_who_configure/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ class Config < ActiveRecord::Base
:presence => true
validates :name, :uniqueness => { :scope => :organization_id }
validates :hypervisor_password, :presence => true, :if => Proc.new { |c| c.hypervisor_type != 'libvirt' && c.hypervisor_type != 'kubevirt' }
validates :hypervisor_username, :presence => true, :if => Proc.new { |c| c.hypervisor_type != 'kubevirt' }
validates :hypervisor_server, :presence => true, :if => Proc.new { |c| c.hypervisor_type != 'kubevirt' }
validates :hypervisor_username, :presence => true, :if => Proc.new { |c| c.hypervisor_type != 'libvirt' && c.hypervisor_type != 'kubevirt' }
validates :hypervisor_server, :presence => true, :if => Proc.new { |c| c.hypervisor_type != 'libvirt' && c.hypervisor_type != 'kubevirt' }
validates :kubeconfig_path, :presence => true, :if => Proc.new { |c| c.hypervisor_type == 'kubevirt' }
validates :hypervisor_type, :inclusion => HYPERVISOR_TYPES.keys
validates :hypervisor_id, :inclusion => HYPERVISOR_IDS
Expand Down
2 changes: 2 additions & 0 deletions app/models/foreman_virt_who_configure/output_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ def virt_who_output(format = nil)
def connection_details
if config.hypervisor_type == 'kubevirt'
""
elsif config.hypervisor_type == 'libvirt'
"\nserver=qemu:///system"
else
"\nserver=#{cr_server}
username=#{cr_username}
Expand Down

0 comments on commit 54dd203

Please sign in to comment.