foreman_virt_who_configure 0.5.6 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_virt_who_configure/config_edit.js +20 -0
  3. data/app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb +8 -4
  4. data/app/helpers/foreman_virt_who_configure/configs_helper.rb +5 -5
  5. data/app/models/foreman_virt_who_configure/config.rb +39 -5
  6. data/app/models/foreman_virt_who_configure/output_generator.rb +31 -16
  7. data/app/views/foreman_virt_who_configure/api/v2/configs/main.json.rabl +2 -1
  8. data/app/views/foreman_virt_who_configure/configs/show.html.erb +5 -2
  9. data/app/views/foreman_virt_who_configure/configs/steps/_connection_form.erb +10 -4
  10. data/db/migrate/20210608100743_delete_rhevm_profiles.rb +5 -0
  11. data/db/migrate/20210910184516_add_ahv_to_config.rb +7 -0
  12. data/lib/foreman_virt_who_configure/version.rb +1 -1
  13. data/locale/action_names.rb +36 -26
  14. data/locale/ca/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  15. data/locale/ca/foreman_virt_who_configure.po +647 -0
  16. data/locale/cs_CZ/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  17. data/locale/cs_CZ/foreman_virt_who_configure.po +653 -0
  18. data/locale/de/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  19. data/locale/de/foreman_virt_who_configure.po +657 -0
  20. data/locale/en/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  21. data/locale/en/foreman_virt_who_configure.po +56 -47
  22. data/locale/en_GB/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  23. data/locale/en_GB/foreman_virt_who_configure.po +650 -0
  24. data/locale/es/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  25. data/locale/es/foreman_virt_who_configure.po +653 -0
  26. data/locale/foreman_virt_who_configure.pot +170 -165
  27. data/locale/fr/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  28. data/locale/fr/foreman_virt_who_configure.po +651 -0
  29. data/locale/gl/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  30. data/locale/gl/foreman_virt_who_configure.po +649 -0
  31. data/locale/it/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  32. data/locale/it/foreman_virt_who_configure.po +652 -0
  33. data/locale/ja/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  34. data/locale/ja/foreman_virt_who_configure.po +651 -0
  35. data/locale/ko/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  36. data/locale/ko/foreman_virt_who_configure.po +650 -0
  37. data/locale/nl_NL/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  38. data/locale/nl_NL/foreman_virt_who_configure.po +653 -0
  39. data/locale/pl/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  40. data/locale/pl/foreman_virt_who_configure.po +652 -0
  41. data/locale/pt_BR/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  42. data/locale/pt_BR/foreman_virt_who_configure.po +652 -0
  43. data/locale/ru/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  44. data/locale/ru/foreman_virt_who_configure.po +654 -0
  45. data/locale/sv_SE/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  46. data/locale/sv_SE/foreman_virt_who_configure.po +651 -0
  47. data/locale/zh_CN/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  48. data/locale/zh_CN/foreman_virt_who_configure.po +654 -0
  49. data/locale/zh_TW/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
  50. data/locale/zh_TW/foreman_virt_who_configure.po +651 -0
  51. data/test/functional/api/v2/configs_controller_test.rb +39 -1
  52. data/test/unit/output_generator_test.rb +29 -5
  53. metadata +41 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38a1caca71ecc26f921be69f4efe48943a0ac7b79a0b5a7cb2d99fe41bfc202f
4
- data.tar.gz: 000115561c5ad123da017fb662913cb3dbbe2e1113adf23cc73315735c906022
3
+ metadata.gz: ebe633c7a71e52d7c3147991e799004c5485395776abedd61f5864fac80a7714
4
+ data.tar.gz: a493b3989deffb1bb8e0da3ba3821e20c900f6da05505a0aef70621984658046
5
5
  SHA512:
6
- metadata.gz: e84d2ec1aa61e5f37e1354ece1ef2e04493623cd791d0b839f996270fa32bb652aaa96af7c365015f53638658a5064d6d13c14be61704f8a765208d190389e58
7
- data.tar.gz: 5c3d700fc5babc9d73a53c77aab32b5e92f896818fa9903efdcc5f1350c94c0c776cc27ba564bd2b0826298eef0952a7da90ccc2ab2ff24ba5f9444e50ab83f3
6
+ metadata.gz: f1c8df97b8a0b6b699dfb2a38f8a5715a609bdd92f119c2e6ece75e75fcd6002f54db833a32a79623f4b6d30a8cf663e9de4f6c8a82a79481de00c3d6ddb44ad
7
+ data.tar.gz: 541cf3ec422f78a999975f54a7f0d8c79d32166c7ce252050ef03ef944606d79ff8f6b8187d8f5b6b04b1db5630f6c97646350a649129a8bbd173dff72f138f2
@@ -35,7 +35,13 @@ function virt_who_update_hypervisor_fields() {
35
35
  element.closest('.form-group').toggle(selected_type == 'kubevirt');
36
36
  var element = $('#foreman_virt_who_configure_config_hypervisor_server');
37
37
  element.closest('.form-group').toggle(selected_type != 'kubevirt');
38
+ var element = $('#foreman_virt_who_configure_config_ahv_update_interval');
39
+ element.closest('.form-group').toggle(selected_type == 'ahv');
40
+ var element = $('#foreman_virt_who_configure_config_ahv_internal_debug');
41
+ element.closest('.form-group').toggle(selected_type == 'ahv');
38
42
  virt_who_update_listing_mode();
43
+ var element = $('#foreman_virt_who_configure_config_prism_flavor');
44
+ element.closest('.form-group').toggle(selected_type == 'ahv');
39
45
  }
40
46
 
41
47
  function virt_who_update_credentials_help() {
@@ -53,9 +59,23 @@ function virt_who_update_credentials_help() {
53
59
  });
54
60
  }
55
61
 
62
+ function virt_who_update_ahv_debug() {
63
+ var element = $('#foreman_virt_who_configure_config_ahv_internal_debug');
64
+ var element_debug = $('#foreman_virt_who_configure_config_debug');
65
+
66
+ element.mouseenter(function(){
67
+ var inline_help_popover_ahv = element.parents('.form-group').find('.help-inline a[rel=popover]');
68
+ var inline_help_popover_global = element_debug.parents('.form-group').find('.help-inline a[rel=popover]');
69
+ inline_help_popover_ahv.popover('show');
70
+ inline_help_popover_global.popover('show');
71
+ });
72
+ }
73
+
56
74
  $(document).ready(function () {
57
75
  virt_who_update_listing_mode();
58
76
  virt_who_update_hypervisor_fields();
77
+ virt_who_update_ahv_debug();
78
+
59
79
  $('#foreman_virt_who_configure_config_listing_mode').change(virt_who_update_listing_mode);
60
80
  $('#foreman_virt_who_configure_config_hypervisor_type').change(virt_who_update_credentials_help);
61
81
  $('#foreman_virt_who_configure_config_hypervisor_type').change(virt_who_update_hypervisor_fields);
@@ -47,14 +47,18 @@ module ForemanVirtWhoConfigure
47
47
  param :exclude_host_parents, String, :desc => N_("Applicable only for esx provider type. Hosts which parent (usually ComputeResource) name is specified in comma-separated list in this option will <b>NOT</b> be reported. Wildcards and regular expressions are supported, multiple records must be separated by comma. Put the value into the double-quotes if it contains special characters like comma. All new line characters will be removed in resulting configuration file, white spaces are removed from beginning and end."), :required => false
48
48
  param :hypervisor_id, Config::HYPERVISOR_IDS, :desc => N_("Specifies how the hypervisor will be identified."), :required => true
49
49
  param :hypervisor_type, Config::HYPERVISOR_TYPES.keys, :desc => N_("Hypervisor type"), :required => true
50
- param :hypervisor_server, String, :desc => N_("Fully qualified host name or IP address of the hypervisor"), :required => true
51
- param :hypervisor_username, String, :desc => N_("Account name by which virt-who is to connect to the hypervisor."), :required => true
52
- param :hypervisor_password, String, :desc => N_("Hypervisor password, required for all hypervisor types except for libvirt"), :required => false
53
- param :satellite_url, String, :desc => N_("Satellite server FQDN"), :required => true
50
+ param :hypervisor_server, String, :desc => N_("Fully qualified host name or IP address of the hypervisor"), :required => false
51
+ param :hypervisor_username, String, :desc => N_("Account name by which virt-who is to connect to the hypervisor."), :required => false
52
+ param :hypervisor_password, String, :desc => N_("Hypervisor password, required for all hypervisor types except for libvirt/kubevirt."), :required => false
53
+ param :satellite_url, String, :desc => N_("Foreman server FQDN"), :required => true
54
54
  param :debug, :bool, :desc => N_("Enable debugging output")
55
+ param :kubeconfig_path, String, :desc => N_('Configuration file containing details about how to connect to the cluster and authentication details.'), :required => false
55
56
  param :http_proxy_id, Integer, :desc => N_('HTTP proxy that should be used for communication between the server on which virt-who is running and the hypervisors and virtualization managers.')
56
57
  param :no_proxy, String, :desc => N_("Ignore proxy. A comma-separated list of hostnames or domains or ip addresses to ignore proxy settings for. Optionally this may be set to * to bypass proxy settings for all hostnames domains or ip addresses.")
57
58
  param :organization_id, Integer, :required => true, :desc => N_("Organization of the virt-who configuration") if ::SETTINGS[:organizations_enabled]
59
+ param :prism_flavor, Config::PRISM_FLAVORS.keys, :desc => N_("Select the Prism flavor you are connecting to"), :required => false
60
+ param :ahv_update_interval, Integer, :desc => N_("The frequency of VM-to-host mapping updates for AHV(in seconds)"), :required => false
61
+ param :ahv_internal_debug, :bool, :desc => N_("Option Enable debugging output is required to enable AHV internal debug. It provides extra AHV debug information when both options are enabled"), :required => false
58
62
  end
59
63
  end
60
64
 
@@ -3,20 +3,20 @@ module ForemanVirtWhoConfigure
3
3
  def hypervisor_server_help_data
4
4
  @hypervisor_server_help_data ||= {
5
5
  'esx' => _('VMware vCenter server’s fully qualified host name or IP address.'),
6
- 'rhevm' => _('Red Hat Virtualization Manager’s fully qualified host name or IP address. For example, <code>https://hostname:443/ovirt-engine/</code> for v4, <code>https://hostname_or_IP:443</code> for v3'),
7
6
  'hyperv' => _('Microsoft Hyper-V fully qualified host name or IP address.'),
8
7
  'libvirt' => _('Libvirt server’s fully qualified host name or IP address. You can also specify preferred schema, for example: <code>qemu+ssh://libvirt.example.com/system</code>. If you use SSH, make sure you setup root\'s SSH key on target host for a user specified at hypervisor username field'),
9
- 'kubevirt' => _('Container-native virtualization’s fully qualified host name or IP address. In order to connect to the cluster it is required to provide path to kubeconfig which contains connection details and authentication token.')
8
+ 'kubevirt' => _('Container-native virtualization’s fully qualified host name or IP address. In order to connect to the cluster it is required to provide path to kubeconfig which contains connection details and authentication token.'),
9
+ 'ahv' => _('Nutanix AHV’s IP address.')
10
10
  }
11
11
  end
12
12
 
13
13
  def hypervisor_username_help_data
14
14
  @hypervisor_username_help_data ||= {
15
- 'esx' => _('Account name by which virt-who is to connect to the hypervisor, in the format <code>domain_name\account_name</code>. Note that only a single backslash separates the values for domain_name and account_name. If you are using a domain account, and the global configuration file <code>/etc/sysconfig/virt-who</code>, then <b>two</b> backslashes are required. For further details, see <a href="https://access.redhat.com/solutions/1270223">Red Hat Knowledgebase solution How to use a windows domain account with virt-who</a> for more information.'),
16
- 'rhevm' => _('Account name by which virt-who is to connect to the Red Hat Enterprise Virtualization Manager instance. The username option requires input in the format username@domain.'),
15
+ 'esx' => _('Account name by which virt-who is to connect to the hypervisor, in the format <code>domain_name\account_name</code>. Note that only a single backslash separates the values for domain_name and account_name. If you are using a domain account, and the global configuration file <code>/etc/virt-who.conf</code>, then <b>two</b> backslashes are required. For further details, see <a href="https://access.redhat.com/solutions/1270223">Red Hat Knowledgebase solution How to use a windows domain account with virt-who</a> for more information.'),
17
16
  'hyperv' => _('Account name by which virt-who is to connect to the hypervisor. By default this is <code>Administrator</code>. To use an alternate account, create a user account and assign that account to the following groups (Windows 2012 Server): Hyper-V Administrators and Remote Management Users.'),
18
17
  'libvirt' => _('Account name by which virt-who is to connect to the hypervisor. Virt-who does not support password based authentication, you must manually setup SSH key, see <a href="https://access.redhat.com/solutions/1515983">Red Hat Knowledgebase solution How to configure virt-who for a KVM host</a> for more information.'),
19
- 'kubevirt' => ''
18
+ 'kubevirt' => '',
19
+ 'ahv' => _('Account name by which virt-who is to connect to Nutanix AHV.')
20
20
  }
21
21
  end
22
22
 
@@ -6,7 +6,8 @@ module ForemanVirtWhoConfigure
6
6
  :satellite_url, :http_proxy_id, :no_proxy, :name,
7
7
  # API parameter filtering_mode gets translated to listing_mode in the controller
8
8
  # We keep both params permitted for compatibility with 1.11
9
- :listing_mode, :filtering_mode, :filter_host_parents, :exclude_host_parents, :kubeconfig_path
9
+ :listing_mode, :filtering_mode, :filter_host_parents, :exclude_host_parents, :kubeconfig_path,
10
+ :prism_flavor, :ahv_update_interval, :ahv_internal_debug
10
11
  ]
11
12
  audited :except => [ :hypervisor_password, :last_report_at, :out_of_date_at ], :associations => []
12
13
  include Authorizable
@@ -31,10 +32,10 @@ module ForemanVirtWhoConfigure
31
32
 
32
33
  HYPERVISOR_TYPES = {
33
34
  'esx' => 'VMware vSphere / vCenter (esx)',
34
- 'rhevm' => 'Red Hat Virtualization Hypervisor (rhevm)',
35
35
  'hyperv' => 'Microsoft Hyper-V (hyperv)',
36
36
  'libvirt' => 'libvirt',
37
- 'kubevirt' => 'Container-native virtualization'
37
+ 'kubevirt' => 'Container-native virtualization',
38
+ 'ahv' => 'Nutanix AHV (ahv)'
38
39
  }
39
40
 
40
41
  HYPERVISOR_DEFAULT_TYPE = 'esx'
@@ -66,6 +67,15 @@ module ForemanVirtWhoConfigure
66
67
  }
67
68
  )
68
69
 
70
+ PRISM_FLAVORS = {
71
+ 'central' => N_('Prism Central'),
72
+ 'element' => N_('Prism Element')
73
+ }
74
+
75
+ AHV_VALID_OPTIONS = %w(prism_flavor ahv_update_interval ahv_internal_debug)
76
+ KUBEVIRT_VALID_OPTIONS = %w(kubeconfig_path)
77
+ KUBEVIRT_INVALID_OPTIONS = %w(hypervisor_server hypervisor_username)
78
+
69
79
  include Encryptable
70
80
  encrypts :hypervisor_password
71
81
 
@@ -98,11 +108,16 @@ module ForemanVirtWhoConfigure
98
108
  validates :hypervisor_password, :presence => true, :if => Proc.new { |c| c.hypervisor_type != 'libvirt' && c.hypervisor_type != 'kubevirt' }
99
109
  validates :hypervisor_username, :presence => true, :if => Proc.new { |c| c.hypervisor_type != 'kubevirt' }
100
110
  validates :hypervisor_server, :presence => true, :if => Proc.new { |c| c.hypervisor_type != 'kubevirt' }
111
+ validates :kubeconfig_path, :presence => true, :if => Proc.new { |c| c.hypervisor_type == 'kubevirt' }
101
112
  validates :hypervisor_type, :inclusion => HYPERVISOR_TYPES.keys
102
113
  validates :hypervisor_id, :inclusion => HYPERVISOR_IDS
103
114
  validates :interval, :inclusion => AVAILABLE_INTERVALS.keys.map(&:to_i)
104
115
  validates :listing_mode, :inclusion => FILTERING_MODES.keys.map(&:to_i)
116
+ validates :ahv_update_interval, numericality: { only_integer: true, allow_nil: true, greater_than: 0 }, :if => Proc.new { |c| c.hypervisor_type == 'ahv' }
117
+ validates :prism_flavor, :inclusion => {:in => PRISM_FLAVORS.keys, :message => "should be either central or element"}, :if => Proc.new { |c| c.hypervisor_type == 'ahv' }
105
118
  validate :validates_whitelist_blacklist
119
+ validate :validates_debug_settings, :if => Proc.new { |c| c.hypervisor_type == 'ahv' }
120
+ validate :validates_hypervisor_options
106
121
 
107
122
  def validates_whitelist_blacklist
108
123
  case listing_mode.to_i
@@ -117,6 +132,16 @@ module ForemanVirtWhoConfigure
117
132
  end
118
133
  end
119
134
 
135
+ def validates_debug_settings
136
+ if ahv_internal_debug && !debug
137
+ errors.add(:ahv_internal_debug, "Enable debugging output is required for Enable AHV debug")
138
+ end
139
+ end
140
+
141
+ def validates_hypervisor_options
142
+ invalid_fields.each { |f| errors.add(f, "Invalid option for hypervisor [#{hypervisor_type}]") if eval(f).present? }
143
+ end
144
+
120
145
  validates_lengths_from_database
121
146
 
122
147
  before_validation :remove_whitespaces
@@ -185,8 +210,6 @@ module ForemanVirtWhoConfigure
185
210
  # 'libvirt'
186
211
  # when Foreman::Model::Vmware
187
212
  # 'esx'
188
- # when Foreman::Model::Ovirt
189
- # 'rhevm'
190
213
  # else
191
214
  # raise 'unsupported compute resource type'
192
215
  # end
@@ -251,5 +274,16 @@ module ForemanVirtWhoConfigure
251
274
  def remove_whitespaces
252
275
  satellite_url.strip! if satellite_url.present?
253
276
  end
277
+
278
+ def invalid_fields
279
+ case hypervisor_type
280
+ when 'kubevirt'
281
+ KUBEVIRT_INVALID_OPTIONS + AHV_VALID_OPTIONS
282
+ when 'ahv'
283
+ KUBEVIRT_VALID_OPTIONS
284
+ else
285
+ KUBEVIRT_VALID_OPTIONS + AHV_VALID_OPTIONS
286
+ end
287
+ end
254
288
  end
255
289
  end
@@ -19,9 +19,9 @@ module ForemanVirtWhoConfigure
19
19
  ConfigurationResult.new(1, 'virt_who_too_old', N_('Newer version of virt-who is required, minimum version is %s') % MINIMUM_VIRT_WHO_VERSION),
20
20
  ConfigurationResult.new(2, 'virt_who_config_file_issue', N_('Unable to create virt-who config file')),
21
21
  ConfigurationResult.new(4, 'virt_who_sysconfig_file_issue', N_('Unable to create sysconfig file')),
22
- ConfigurationResult.new(8, 'virt_who_chkconfig_issue', N_('Unable to enable virt-who service using chkconfig')),
22
+ ConfigurationResult.new(8, 'virt_who_systemctl_issue', N_('Unable to enable virt-who service using systemctl')),
23
23
  ConfigurationResult.new(16, 'virt_who_service_issue', N_('Unable to start virt-who service, please see virt-who logs for more details')),
24
- ConfigurationResult.new(32, 'virt_who_installation', N_('Unable to install virt-who package, make sure the host is properly subscribed and has access to satellite-tools repository')),
24
+ ConfigurationResult.new(32, 'virt_who_installation', N_('Unable to install virt-who package, make sure the host is properly subscribed and has access to katello-host-tools repository')),
25
25
  ]
26
26
 
27
27
  attr_reader :config
@@ -51,6 +51,7 @@ module ForemanVirtWhoConfigure
51
51
  def virt_who_output(format = nil)
52
52
  kubeconfig = config.hypervisor_type == 'kubevirt' ? "\nkubeconfig=#{config.kubeconfig_path}" : ''
53
53
  result = ''
54
+ cr_password_base64 = Base64.strict_encode64("#{cr_password}")
54
55
  result += "#!/bin/bash\n" if format == :bash_script
55
56
  result += <<EOS
56
57
  heading() {
@@ -75,7 +76,7 @@ verify_minimal_version() {
75
76
  installed_version=`rpm -q --queryformat '%{VERSION}' virt-who`
76
77
 
77
78
  if version_lt $installed_version $minimal_version; then
78
- echo "virt-who $installed_version does not meet minimum requirements, please make sure this host is properly subscribed and has access to satellite-tools repository, minimal virt-who version is $minimal_version"
79
+ echo "virt-who $installed_version does not meet minimum requirements, please make sure this host is properly subscribed and has access to katello-host-tools repository, minimal virt-who version is $minimal_version"
79
80
  return 1
80
81
  else
81
82
  return 0
@@ -105,7 +106,7 @@ install_virt_who
105
106
 
106
107
  if verify_minimal_version; then
107
108
  step 2 "Encrypting password"
108
- cr_password=`virt-who-password --password '#{cr_password}' 2> /dev/null`
109
+ cr_password=`virt-who-password --password $(echo #{cr_password_base64}|base64 -d) 2> /dev/null`
109
110
  user_password=`virt-who-password --password '#{service_user_password}' 2> /dev/null`
110
111
 
111
112
  step 3 "Creating virt-who configuration"
@@ -116,26 +117,28 @@ if verify_minimal_version; then
116
117
  type=#{type}
117
118
  hypervisor_id=#{hypervisor_id}
118
119
  owner=#{owner}
119
- env=Library#{connection_details}#{filtering}
120
+ #{connection_details}#{filtering}
120
121
  rhsm_hostname=#{satellite_url}
121
122
  rhsm_username=#{service_user_username}
122
123
  rhsm_encrypted_password=$user_password
123
- rhsm_prefix=/rhsm#{kubeconfig}
124
+ rhsm_prefix=/rhsm#{kubeconfig}#{ahv_config_options}
124
125
  EOF
125
126
  if [ $? -ne 0 ]; then result_code=$(($result_code|#{error_code(:virt_who_config_file_issue)})); fi
126
127
 
127
128
  step 4 "Creating sysconfig virt-who configuration"
128
- cat > #{sysconfig_file_path} << EOF
129
+ cat > #{default_config_path} << EOF
129
130
  ### This configuration file is managed via the virt-who configure plugin
130
131
  ### manual edits will be deleted.
131
- VIRTWHO_DEBUG=#{config.debug? ? 1 : 0}
132
- VIRTWHO_INTERVAL=#{config.interval * 60}#{proxy_strings}
132
+ [global]
133
+ debug=#{config.debug? ? 1 : 0}
134
+ interval=#{config.interval * 60}#{proxy_strings}
135
+ oneshot=False
133
136
  EOF
134
137
  if [ $? -ne 0 ]; then result_code=$(($result_code|#{error_code(:virt_who_sysconfig_file_issue)})); fi
135
138
 
136
139
  step 5 "Enabling and restarting the virt-who service"
137
- chkconfig virt-who on || result_code=$(($result_code|#{error_code(:virt_who_chkconfig_issue)}))
138
- service virt-who restart || result_code=$(($result_code|#{error_code(:virt_who_service_issue)}))
140
+ systemctl enable virt-who || result_code=$(($result_code|#{error_code(:virt_who_systemctl_issue)}))
141
+ systemctl restart virt-who || result_code=$(($result_code|#{error_code(:virt_who_service_issue)}))
139
142
  else
140
143
  result_code=$(($result_code|#{error_code(:virt_who_too_old)}))
141
144
  fi
@@ -163,6 +166,18 @@ encrypted_password=$cr_password"
163
166
  end
164
167
  end
165
168
 
169
+ def ahv_config_options
170
+ if config.hypervisor_type == 'ahv'
171
+ prism_central = config.prism_flavor == "central"
172
+ update_interval = config.ahv_update_interval.present? ? "\nupdate_interval=#{config.ahv_update_interval}" : nil
173
+ internal_debug = config.ahv_internal_debug.present? ? "\ninternal_debug=#{config.ahv_internal_debug}" : nil
174
+
175
+ "\nprism_central=#{prism_central}#{internal_debug}#{update_interval}"
176
+ else
177
+ ""
178
+ end
179
+ end
180
+
166
181
  def error_handling
167
182
  CONFIGURATION_RESULTS.map do |result|
168
183
  "[ $(($result_code&#{result.code})) -ge 1 ] && echo '#{result.message}'"
@@ -196,8 +211,8 @@ encrypted_password=$cr_password"
196
211
  "/etc/virt-who.d/#{identifier}.conf"
197
212
  end
198
213
 
199
- def sysconfig_file_path
200
- '/etc/sysconfig/virt-who'
214
+ def default_config_path
215
+ '/etc/virt-who.conf'
201
216
  end
202
217
 
203
218
  def identifier
@@ -229,7 +244,7 @@ encrypted_password=$cr_password"
229
244
  case config.hypervisor_type
230
245
  when 'libvirt'
231
246
  config.hypervisor_password.blank? ? LIBVIRT_FAKE_PASSWORD : config.hypervisor_password
232
- when 'kubevirt'
247
+ when 'kubevirt'
233
248
  config.hypervisor_password.blank? ? KUBEVIRT_FAKE_PASSWORD : config.hypervisor_password
234
249
  else
235
250
  config.hypervisor_password
@@ -271,8 +286,8 @@ encrypted_password=$cr_password"
271
286
  def proxy_strings
272
287
  output = ''
273
288
  output << "\n#{proxy_type}=#{sanitize_proxy(proxy.full_url)}" if proxy.present?
274
- output << "\nNO_PROXY=#{sanitize_proxy(no_proxy)}" if no_proxy.present?
275
- output << "\nNO_PROXY=*" if !proxy.present? && !no_proxy.present?
289
+ output << "\nno_proxy=#{sanitize_proxy(no_proxy)}" if no_proxy.present?
290
+ output << "\nno_proxy=*" if !proxy.present? && !no_proxy.present?
276
291
  output
277
292
  end
278
293
 
@@ -9,7 +9,8 @@ end
9
9
  attributes :name, :interval, :organization_id, :whitelist, :blacklist, :hypervisor_id,
10
10
  :hypervisor_type, :hypervisor_server, :hypervisor_username, :debug,
11
11
  :satellite_url, :proxy, :no_proxy, :status, :last_report_at, :out_of_date_at,
12
- :filter_host_parents, :exclude_host_parents, :kubeconfig_path
12
+ :filter_host_parents, :exclude_host_parents, :kubeconfig_path,
13
+ :prism_flavor, :ahv_update_interval, :ahv_internal_debug
13
14
 
14
15
  child :http_proxy do
15
16
  attributes :id, :name, :url
@@ -37,7 +37,7 @@
37
37
  <%= config_attribute :hypervisor_server, @config.hypervisor_server %>
38
38
  <%= config_attribute :hypervisor_username, @config.hypervisor_username if @config.hypervisor_type != 'kubevirt' %>
39
39
  <%= config_attribute :interval, _(ForemanVirtWhoConfigure::Config::AVAILABLE_INTERVALS[@config.interval.to_s]) %>
40
- <%= config_attribute :satellite_url, @config.satellite_url, _('Satellite server FQDN')%>
40
+ <%= config_attribute :satellite_url, @config.satellite_url, _('Foreman server FQDN')%>
41
41
  <%= config_attribute :hypervisor_id, @config.hypervisor_id, _('Hypervisor ID') %>
42
42
  <%= config_attribute :listing_mode, _(ForemanVirtWhoConfigure::Config::FILTERING_MODES[@config.listing_mode.to_s]), _('Filtering') %>
43
43
  <% if @config.listing_mode == ForemanVirtWhoConfigure::Config::WHITELIST %>
@@ -52,6 +52,9 @@
52
52
  <%= config_attribute :http_proxy_id, @config.http_proxy.full_url, _('HTTP Proxy') if @config.http_proxy.present? %>
53
53
  <%= config_attribute :no_proxy, @config.no_proxy, _('Ignore Proxy') if @config.no_proxy.present? %>
54
54
  <%= config_attribute :kubeconfig_path, @config.kubeconfig_path if @config.hypervisor_type == 'kubevirt' %>
55
+ <%= config_attribute :prism_flavor, @config.prism_flavor if @config.hypervisor_type == 'ahv' %>
56
+ <%= config_attribute :ahv_update_interval, @config.ahv_update_interval if @config.hypervisor_type == 'ahv' %>
57
+ <%= config_attribute :ahv_internal_debug, checked_icon(@config.ahv_internal_debug) if @config.hypervisor_type == 'ahv' %>
55
58
  </div>
56
59
  </div>
57
60
  </div>
@@ -62,7 +65,7 @@
62
65
  <div class="form-group">
63
66
  <div class="row">
64
67
  <div class="col-md-6">
65
- <%= _("Use either hammer command or the script below to deploy this configuration. Both require root privileges. Run one of them on the target host which has access to Red Hat Satellite Tools repository and will run virt-who reporting, preferably Satellite host:") %>
68
+ <%= _("Use either hammer command or the script below to deploy this configuration. Both require root privileges. Run one of them on the target host which has access to katello-host-tools repository and will run virt-who reporting, preferably Foreman host:") %>
66
69
  </div>
67
70
  </div>
68
71
 
@@ -1,10 +1,10 @@
1
1
  <div id="config_connection">
2
- <%= text_f f, :satellite_url, inline_help_popover(_('Satellite Server’s fully-qualified host name, for example: satellite.example.com')).merge(:label => _('Satellite server FQDN')) %>
2
+ <%= text_f f, :satellite_url, inline_help_popover(_('Foreman server’s fully-qualified host name, for example: foreman.example.com')).merge(:label => _('Foreman server FQDN')) %>
3
3
  <%= select_f f, :hypervisor_id, ForemanVirtWhoConfigure::Config::HYPERVISOR_IDS, :to_s, :to_s, {}, { :label => _('Hypervisor ID') }.merge(
4
4
  inline_help_popover(_("Specifies that hypervisors will be identified by their <b>hostname</b>, <b>uuid</b> or <b>hwuuid</b>.
5
5
  Note that some virtualization backends don't have all of them implemented.
6
6
  Default is <b>hostname</b>, which provides more meaningful hypervisor
7
- names, but can cause duplicated hypervisor registrations if the host is renamed. To avoid that, you can use <b>uuid</b> instead. <b>hwuuid</b> is applicable to esx and rhevm only.
7
+ names, but can cause duplicated hypervisor registrations if the host is renamed. To avoid that, you can use <b>uuid</b> instead. <b>hwuuid</b> is applicable to esx only.
8
8
  This property is meant to be set up before the initial run of virt-who. Changing it later will result in duplicated entries in the subscription manager.").html_safe)) %>
9
9
  <%= selectable_f f, :listing_mode, ForemanVirtWhoConfigure::Config::FILTERING_MODES.map { |k,v| [_(v), k] }, {}, { :label => _('Filtering') }.merge(
10
10
  inline_help_popover(_("If you run a hybrid environment, with virtual machines running Red Hat Enterprise Linux and other operating systems, you may want to limit the scope of virt-who’s access to hosts. For example, if some hypervisors host only Microsoft Windows Server instances, there is no benefit in having those hypervisors reported by the virt-who agent."))) %>
@@ -13,13 +13,19 @@
13
13
 
14
14
  <%= textarea_f f, :blacklist, inline_help_popover(_('Hosts which uuid (or hostname or hwuuid, based on <code>hypervisor_id</code>) is specified in comma-separated list in this option will <b>NOT</b> be reported. Wildcards and regular expressions are supported, multiple records must be separated by comma. Put the value into the double-quotes if it contains special characters like comma. All new line characters will be removed in resulting configuration file, white spaces are removed from beginning and end.')).merge(:label => _('Exclude hosts')) %>
15
15
 
16
- <%= textarea_f f, :filter_host_parents, inline_help_popover(_('Only hosts which parent (usually ComputeResource) name is specified in comma-separated list in this option will be reported. Wildcards and regular expressions are supported, multiple records must be separated by comma. Put the value into the double-quotes if it contains special characters like comma. All new line characters will be removed in resulting configuration file, white spaces are removed from beginning and end.')).merge(:label => _('Filter host parents')) %>
16
+ <%= textarea_f f, :filter_host_parents, inline_help_popover(_('Only hosts which cluster ID is specified in comma-separated list in this option will be reported. PowerCLI command to find the domain names in VMware <code>Get-Cluster “ClusterName” | Select ID</code>. Wildcards and regular expressions are supported, multiple records must be separated by comma. Put the value into the double-quotes if it contains special characters like comma. All new line characters will be removed in resulting configuration file, white spaces are removed from beginning and end.')).merge(:label => _('Filter host parents')) %>
17
17
 
18
- <%= textarea_f f, :exclude_host_parents, inline_help_popover(_('Hosts which parent (usually ComputeResource) name is specified in comma-separated list in this option will <b>NOT</b> be reported. Wildcards and regular expressions are supported, multiple records must be separated by comma. Put the value into the double-quotes if it contains special characters like comma. All new line characters will be removed in resulting configuration file, white spaces are removed from beginning and end.')).merge(:label => _('Exclude host parents')) %>
18
+ <%= textarea_f f, :exclude_host_parents, inline_help_popover(_('Exclude hosts which cluster ID is specified in comma-separated list in this option will <b>NOT</b> be reported. PowerCLI command to find the domain names in VMware <code>Get-Cluster “ClusterName” | Select ID</code>. Wildcards and regular expressions are supported, multiple records must be separated by comma. Put the value into the double-quotes if it contains special characters like comma. All new line characters will be removed in resulting configuration file, white spaces are removed from beginning and end.')).merge(:label => _('Exclude host parents')) %>
19
19
 
20
20
  <%= checkbox_f f, :debug, { :label => _('Enable debugging output') }.merge(inline_help_popover(_("Different debug value can't be set per hypervisor, therefore it will affect all other deployed configurations on the host on which this configuration will be deployed."))) %>
21
21
  <%= select_f f, :http_proxy_id, HttpProxy.all, :id, :full_url, {:include_blank => true}, { :label => _('HTTP Proxy') }.merge(
22
22
  inline_help_popover(_('HTTP proxy that should be used for communication between the server on which virt-who is running and the hypervisors and virtualization managers. Leave this blank if no proxy is used.').html_safe)) %>
23
23
  <%= text_f f, :no_proxy, inline_help_popover(_('A comma-separated list of hostnames or domains or ip addresses to ignore proxy settings for. Optionally this may be set to <code>*</code> to bypass proxy settings for all hostnames domains or ip addresses.')).merge(:label => _('Ignore proxy')) %>
24
24
  <%= text_f f, :kubeconfig_path, inline_help_popover(_('Configuration file containing details about how to connect to the cluster and authentication details')).merge(:label => _('Path to kubeconfig file')) %>
25
+
26
+ <%= selectable_f f, :prism_flavor, {'' => 'Nothing selected'}.merge(ForemanVirtWhoConfigure::Config::PRISM_FLAVORS).map { |k,v| [_(v), k] },
27
+ {}, { label: _('Prism Flavor'), :required => true }.merge(
28
+ inline_help_popover(_("Select the Prism flavor you are connecting to"))) %>
29
+ <%= text_f f, :ahv_update_interval, inline_help_popover(_('The frequency of VM-to-host mapping updates for AHV(in seconds)')).merge(:label => _('AHV update interval')) %>
30
+ <%= checkbox_f f, :ahv_internal_debug, inline_help_popover(_('Option Enable debugging output is required to enable AHV internal debug. It provides extra AHV debug information when both options are enabled ')).merge(:label => _('Enable AHV debug')) %>
25
31
  </div>
@@ -0,0 +1,5 @@
1
+ class DeleteRhevmProfiles < ActiveRecord::Migration[6.0]
2
+ def change
3
+ ForemanVirtWhoConfigure::Config.where(:hypervisor_type => 'rhevm').destroy_all
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ class AddAhvToConfig < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_column :foreman_virt_who_configure_configs, :prism_flavor, :string, :null => true
4
+ add_column :foreman_virt_who_configure_configs, :ahv_update_interval, :integer, :null => true
5
+ add_column :foreman_virt_who_configure_configs, :ahv_internal_debug, :boolean, :null => true
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module ForemanVirtWhoConfigure
2
- VERSION = '0.5.6'.freeze
2
+ VERSION = '0.5.9'.freeze
3
3
  end
@@ -1,9 +1,30 @@
1
1
  # Autogenerated!
2
+ _("Action with sub plans")
3
+ _("Import facts")
4
+ _("Import Puppet classes")
5
+ _("Abstract async task")
2
6
  _("Create")
7
+ _("Delete Activation Key")
8
+ _("Update")
9
+ _("Generate host applicability")
10
+ _("Bulk generate applicability for hosts")
11
+ _("Generate repository applicability")
12
+ _("Synchronize smart proxy")
13
+ _("Sync capsule")
3
14
  _("Delete")
15
+ _("Errata mail")
16
+ _("Incremental Update of Content View Version(s) ")
17
+ _("Promote")
18
+ _("Promotion to Environment")
19
+ _("Publish")
20
+ _("Remove Versions and Associations")
21
+ _("Remove from Environment")
22
+ _("Remove Version")
4
23
  _("Export")
5
24
  _("Incremental Update")
25
+ _("Republish Version Repositories")
6
26
  _("Delete Lifecycle Environment")
27
+ _("Publish Lifecycle Environment Repositories")
7
28
  _("Attach subscriptions")
8
29
  _("Auto attach subscriptions")
9
30
  _("Destroy Content Host")
@@ -16,46 +37,35 @@ _("Remove package")
16
37
  _("Update package")
17
38
  _("Install package group")
18
39
  _("Remove package group")
19
- _("Register Host")
20
40
  _("Remove subscriptions")
21
- _("Unregister Host")
41
+ _("Update Content Overrides")
22
42
  _("Update for host")
43
+ _("Update release version for host")
23
44
  _("Package Profile Update")
24
- _("Auto-attach subscriptions")
45
+ _("Combined Profile Update")
25
46
  _("Destroy")
26
47
  _("Product Create")
27
48
  _("Delete Product")
28
49
  _("Reindex subscriptions")
29
- _("Update")
30
- _("Errata mail")
50
+ _("Update http proxy")
51
+ _("Delete Package Group")
52
+ _("Discover")
53
+ _("Fetch pxe files")
31
54
  _("Filtered index content")
32
55
  _("Upload into")
33
56
  _("Index content")
34
57
  _("Index errata")
58
+ _("Index module streams")
35
59
  _("Index package groups")
60
+ _("Instance update")
36
61
  _("Remove Content")
37
62
  _("Synchronize")
63
+ _("Update content urls")
64
+ _("Update http proxy details")
65
+ _("Update redhat repository")
38
66
  _("Upload errata into")
67
+ _("Create Package Group")
39
68
  _("Disable")
40
69
  _("Enable")
41
- _("Add Sync Plan Products")
42
- _("Update Sync Plan Products")
43
- _("Update Sync Plan")
44
- _("Remote action:")
45
- _("Report")
46
- _("Action with sub plans")
47
- _("Create architecture")
48
- _("Delete architecture")
49
- _("Update architecture")
50
- _("Import facts")
51
- _("Import Puppet classes")
52
- _("Abstract async task")
53
- _("Delete Activation Key")
54
- _("Configure capsule")
55
- _("Create repos")
56
- _("Synchronize capsule content")
57
- _("Promotion")
58
- _("Publish")
59
- _("Remove from Environment")
60
- _("Remove Version")
61
- _("Remove Versions and Associations")
70
+ _("Run Sync Plan:")
71
+ _("Report")