foreman_virt_who_configure 0.5.4 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_virt_who_configure/config_edit.js +20 -0
- data/app/controllers/foreman_virt_who_configure/api/v2/configs_controller.rb +9 -5
- data/app/helpers/foreman_virt_who_configure/configs_helper.rb +5 -9
- data/app/models/foreman_virt_who_configure/config.rb +30 -7
- data/app/models/foreman_virt_who_configure/output_generator.rb +28 -14
- data/app/views/foreman_virt_who_configure/api/v2/configs/main.json.rabl +11 -1
- data/app/views/foreman_virt_who_configure/configs/show.html.erb +5 -2
- data/app/views/foreman_virt_who_configure/configs/steps/_connection_form.erb +8 -2
- data/db/migrate/20201211160234_add_foreign_key_proxy_id.rb +5 -0
- data/db/migrate/20210413165147_delete_xen_profiles.rb +5 -0
- data/db/migrate/20210608100743_delete_rhevm_profiles.rb +5 -0
- data/db/migrate/20210910184516_add_ahv_to_config.rb +7 -0
- data/lib/foreman_virt_who_configure/version.rb +1 -1
- data/locale/action_names.rb +36 -26
- data/locale/ca/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/ca/foreman_virt_who_configure.po +647 -0
- data/locale/cs_CZ/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/cs_CZ/foreman_virt_who_configure.po +653 -0
- data/locale/de/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/de/foreman_virt_who_configure.po +657 -0
- data/locale/en/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/en/foreman_virt_who_configure.po +56 -47
- data/locale/en_GB/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/en_GB/foreman_virt_who_configure.po +650 -0
- data/locale/es/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/es/foreman_virt_who_configure.po +653 -0
- data/locale/foreman_virt_who_configure.pot +170 -165
- data/locale/fr/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/fr/foreman_virt_who_configure.po +651 -0
- data/locale/gl/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/gl/foreman_virt_who_configure.po +649 -0
- data/locale/it/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/it/foreman_virt_who_configure.po +652 -0
- data/locale/ja/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/ja/foreman_virt_who_configure.po +651 -0
- data/locale/ko/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/ko/foreman_virt_who_configure.po +650 -0
- data/locale/nl_NL/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/nl_NL/foreman_virt_who_configure.po +653 -0
- data/locale/pl/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/pl/foreman_virt_who_configure.po +652 -0
- data/locale/pt_BR/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/pt_BR/foreman_virt_who_configure.po +652 -0
- data/locale/ru/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/ru/foreman_virt_who_configure.po +654 -0
- data/locale/sv_SE/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/sv_SE/foreman_virt_who_configure.po +651 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/zh_CN/foreman_virt_who_configure.po +654 -0
- data/locale/zh_TW/LC_MESSAGES/foreman_virt_who_configure.mo +0 -0
- data/locale/zh_TW/foreman_virt_who_configure.po +651 -0
- data/test/functional/api/v2/configs_controller_test.rb +43 -2
- data/test/unit/output_generator_test.rb +29 -5
- metadata +44 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4530753c078a8fb15731435042afcbc985207fe160b96d242e04ecfc9d2078f2
|
4
|
+
data.tar.gz: 8013fca41321555482fe77a5203d7558b7828cfe7989208c4121686aa8c5dc2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45f214c29a0c4e76fb92834bb6f5a124fbac03788e5e235da28dfe798be08d7a36c121d50e7e135bc5fb78a93ba6616784965e76ec6a1ea46949207c0c99e706
|
7
|
+
data.tar.gz: 3f66cb56f3efa3e59c016e40d22ff0f9aeff357be3901f2c7937e3eeef98bfb802d7ae762ec83f40030dc4211b2f6c81c134127d548b9dc8162f9a50016e04bf
|
@@ -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 =>
|
51
|
-
param :hypervisor_username, String, :desc => N_("Account name by which virt-who is to connect to the hypervisor."), :required =>
|
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_("
|
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 :
|
55
|
+
param :kubeconfig_path, String, :desc => N_('Configuration file containing details about how to connect to the cluster and authentication details.'), :required => false
|
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,24 +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
|
-
# 'vdsm' => 'Red Hat Enterprise Linux Hypervisor (vdsm)',
|
8
6
|
'hyperv' => _('Microsoft Hyper-V fully qualified host name or IP address.'),
|
9
|
-
'xen' => _('XenServer server’s fully qualified host name or IP address.'),
|
10
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'),
|
11
|
-
'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.')
|
12
10
|
}
|
13
11
|
end
|
14
12
|
|
15
13
|
def hypervisor_username_help_data
|
16
14
|
@hypervisor_username_help_data ||= {
|
17
|
-
'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/
|
18
|
-
'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.'),
|
19
|
-
# 'vdsm' => '',
|
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.'),
|
20
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.'),
|
21
|
-
'xen' => _('Account name by which virt-who is to connect to the hypervisor.'),
|
22
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.'),
|
23
|
-
'kubevirt' => ''
|
18
|
+
'kubevirt' => '',
|
19
|
+
'ahv' => _('Account name by which virt-who is to connect to Nutanix AHV.')
|
24
20
|
}
|
25
21
|
end
|
26
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,12 +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
|
-
# 'vdsm' => 'Red Hat Enterprise Linux Hypervisor (vdsm)',
|
36
35
|
'hyperv' => 'Microsoft Hyper-V (hyperv)',
|
37
|
-
'xen' => 'XenServer (xen)',
|
38
36
|
'libvirt' => 'libvirt',
|
39
|
-
'kubevirt' => 'Container-native virtualization'
|
37
|
+
'kubevirt' => 'Container-native virtualization',
|
38
|
+
'ahv' => 'Nutanix AHV (ahv)'
|
40
39
|
}
|
41
40
|
|
42
41
|
HYPERVISOR_DEFAULT_TYPE = 'esx'
|
@@ -68,6 +67,15 @@ module ForemanVirtWhoConfigure
|
|
68
67
|
}
|
69
68
|
)
|
70
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
|
+
|
71
79
|
include Encryptable
|
72
80
|
encrypts :hypervisor_password
|
73
81
|
|
@@ -100,11 +108,16 @@ module ForemanVirtWhoConfigure
|
|
100
108
|
validates :hypervisor_password, :presence => true, :if => Proc.new { |c| c.hypervisor_type != 'libvirt' && c.hypervisor_type != 'kubevirt' }
|
101
109
|
validates :hypervisor_username, :presence => true, :if => Proc.new { |c| c.hypervisor_type != 'kubevirt' }
|
102
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' }
|
103
112
|
validates :hypervisor_type, :inclusion => HYPERVISOR_TYPES.keys
|
104
113
|
validates :hypervisor_id, :inclusion => HYPERVISOR_IDS
|
105
114
|
validates :interval, :inclusion => AVAILABLE_INTERVALS.keys.map(&:to_i)
|
106
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' }
|
107
118
|
validate :validates_whitelist_blacklist
|
119
|
+
validate :validates_debug_settings, :if => Proc.new { |c| c.hypervisor_type == 'ahv' }
|
120
|
+
validate :validates_hypervisor_options
|
108
121
|
|
109
122
|
def validates_whitelist_blacklist
|
110
123
|
case listing_mode.to_i
|
@@ -119,6 +132,18 @@ module ForemanVirtWhoConfigure
|
|
119
132
|
end
|
120
133
|
end
|
121
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 = hypervisor_type == 'kubevirt' ? KUBEVIRT_INVALID_OPTIONS : KUBEVIRT_VALID_OPTIONS
|
143
|
+
invalid.concat(AHV_VALID_OPTIONS) unless hypervisor_type == 'ahv'
|
144
|
+
invalid.each { |f| errors.add(f, "Invalid option for hypervisor [#{hypervisor_type}]") if eval(f).present? }
|
145
|
+
end
|
146
|
+
|
122
147
|
validates_lengths_from_database
|
123
148
|
|
124
149
|
before_validation :remove_whitespaces
|
@@ -187,8 +212,6 @@ module ForemanVirtWhoConfigure
|
|
187
212
|
# 'libvirt'
|
188
213
|
# when Foreman::Model::Vmware
|
189
214
|
# 'esx'
|
190
|
-
# when Foreman::Model::Ovirt
|
191
|
-
# 'rhevm'
|
192
215
|
# else
|
193
216
|
# raise 'unsupported compute resource type'
|
194
217
|
# 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, '
|
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
|
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
|
@@ -75,7 +75,7 @@ verify_minimal_version() {
|
|
75
75
|
installed_version=`rpm -q --queryformat '%{VERSION}' virt-who`
|
76
76
|
|
77
77
|
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
|
78
|
+
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
79
|
return 1
|
80
80
|
else
|
81
81
|
return 0
|
@@ -120,22 +120,24 @@ env=Library#{connection_details}#{filtering}
|
|
120
120
|
rhsm_hostname=#{satellite_url}
|
121
121
|
rhsm_username=#{service_user_username}
|
122
122
|
rhsm_encrypted_password=$user_password
|
123
|
-
rhsm_prefix=/rhsm#{kubeconfig}
|
123
|
+
rhsm_prefix=/rhsm#{kubeconfig}#{ahv_config_options}
|
124
124
|
EOF
|
125
125
|
if [ $? -ne 0 ]; then result_code=$(($result_code|#{error_code(:virt_who_config_file_issue)})); fi
|
126
126
|
|
127
127
|
step 4 "Creating sysconfig virt-who configuration"
|
128
|
-
cat > #{
|
128
|
+
cat > #{default_config_path} << EOF
|
129
129
|
### This configuration file is managed via the virt-who configure plugin
|
130
130
|
### manual edits will be deleted.
|
131
|
-
|
132
|
-
|
131
|
+
[global]
|
132
|
+
debug=#{config.debug? ? 1 : 0}
|
133
|
+
interval=#{config.interval * 60}#{proxy_strings}
|
134
|
+
oneshot=False
|
133
135
|
EOF
|
134
136
|
if [ $? -ne 0 ]; then result_code=$(($result_code|#{error_code(:virt_who_sysconfig_file_issue)})); fi
|
135
137
|
|
136
138
|
step 5 "Enabling and restarting the virt-who service"
|
137
|
-
|
138
|
-
|
139
|
+
systemctl enable virt-who || result_code=$(($result_code|#{error_code(:virt_who_systemctl_issue)}))
|
140
|
+
systemctl restart virt-who || result_code=$(($result_code|#{error_code(:virt_who_service_issue)}))
|
139
141
|
else
|
140
142
|
result_code=$(($result_code|#{error_code(:virt_who_too_old)}))
|
141
143
|
fi
|
@@ -163,6 +165,18 @@ encrypted_password=$cr_password"
|
|
163
165
|
end
|
164
166
|
end
|
165
167
|
|
168
|
+
def ahv_config_options
|
169
|
+
if config.hypervisor_type == 'ahv'
|
170
|
+
prism_central = config.prism_flavor == "central"
|
171
|
+
update_interval = config.ahv_update_interval.present? ? "\nupdate_interval=#{config.ahv_update_interval}" : nil
|
172
|
+
internal_debug = config.ahv_internal_debug.present? ? "\ninternal_debug=#{config.ahv_internal_debug}" : nil
|
173
|
+
|
174
|
+
"\nprism_central=#{prism_central}#{internal_debug}#{update_interval}"
|
175
|
+
else
|
176
|
+
""
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
166
180
|
def error_handling
|
167
181
|
CONFIGURATION_RESULTS.map do |result|
|
168
182
|
"[ $(($result_code&#{result.code})) -ge 1 ] && echo '#{result.message}'"
|
@@ -196,8 +210,8 @@ encrypted_password=$cr_password"
|
|
196
210
|
"/etc/virt-who.d/#{identifier}.conf"
|
197
211
|
end
|
198
212
|
|
199
|
-
def
|
200
|
-
'/etc/
|
213
|
+
def default_config_path
|
214
|
+
'/etc/virt-who.conf'
|
201
215
|
end
|
202
216
|
|
203
217
|
def identifier
|
@@ -229,7 +243,7 @@ encrypted_password=$cr_password"
|
|
229
243
|
case config.hypervisor_type
|
230
244
|
when 'libvirt'
|
231
245
|
config.hypervisor_password.blank? ? LIBVIRT_FAKE_PASSWORD : config.hypervisor_password
|
232
|
-
when 'kubevirt'
|
246
|
+
when 'kubevirt'
|
233
247
|
config.hypervisor_password.blank? ? KUBEVIRT_FAKE_PASSWORD : config.hypervisor_password
|
234
248
|
else
|
235
249
|
config.hypervisor_password
|
@@ -271,8 +285,8 @@ encrypted_password=$cr_password"
|
|
271
285
|
def proxy_strings
|
272
286
|
output = ''
|
273
287
|
output << "\n#{proxy_type}=#{sanitize_proxy(proxy.full_url)}" if proxy.present?
|
274
|
-
output << "\
|
275
|
-
output << "\
|
288
|
+
output << "\nno_proxy=#{sanitize_proxy(no_proxy)}" if no_proxy.present?
|
289
|
+
output << "\nno_proxy=*" if !proxy.present? && !no_proxy.present?
|
276
290
|
output
|
277
291
|
end
|
278
292
|
|
@@ -2,8 +2,18 @@ object @config
|
|
2
2
|
|
3
3
|
extends "foreman_virt_who_configure/api/v2/configs/base"
|
4
4
|
|
5
|
+
glue :http_proxy do
|
6
|
+
attributes :url => :proxy
|
7
|
+
end
|
8
|
+
|
5
9
|
attributes :name, :interval, :organization_id, :whitelist, :blacklist, :hypervisor_id,
|
6
10
|
:hypervisor_type, :hypervisor_server, :hypervisor_username, :debug,
|
7
11
|
:satellite_url, :proxy, :no_proxy, :status, :last_report_at, :out_of_date_at,
|
8
|
-
:filter_host_parents, :exclude_host_parents
|
12
|
+
:filter_host_parents, :exclude_host_parents, :kubeconfig_path,
|
13
|
+
:prism_flavor, :ahv_update_interval, :ahv_internal_debug
|
14
|
+
|
15
|
+
child :http_proxy do
|
16
|
+
attributes :id, :name, :url
|
17
|
+
end
|
18
|
+
|
9
19
|
attributes :listing_mode => :filtering_mode
|
@@ -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, _('
|
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
|
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(_('
|
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
|
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."))) %>
|
@@ -22,4 +22,10 @@
|
|
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,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
|
data/locale/action_names.rb
CHANGED
@@ -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
|
-
_("
|
41
|
+
_("Update Content Overrides")
|
22
42
|
_("Update for host")
|
43
|
+
_("Update release version for host")
|
23
44
|
_("Package Profile Update")
|
24
|
-
_("
|
45
|
+
_("Combined Profile Update")
|
25
46
|
_("Destroy")
|
26
47
|
_("Product Create")
|
27
48
|
_("Delete Product")
|
28
49
|
_("Reindex subscriptions")
|
29
|
-
_("Update")
|
30
|
-
_("
|
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
|
-
_("
|
42
|
-
_("
|
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")
|
Binary file
|