Skip to content

Commit ac92c26

Browse files
committed
Fixes #38266 - Remove oVirt & RHV code
1 parent 75dc400 commit ac92c26

File tree

53 files changed

+116
-13575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+116
-13575
lines changed

.github/workflows/foreman.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212
RAILS_ENV: test
1313
DATABASE_URL: postgresql://postgres:password@localhost/test
1414
DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: true
15-
BUNDLE_WITHOUT: "console:development:journald"
15+
BUNDLE_WITHOUT: 'console:development:journald'
1616

1717
concurrency:
1818
group: ${{ github.ref_name }}-${{ github.workflow }}
@@ -34,7 +34,7 @@ jobs:
3434
needs: setup_matrix
3535
runs-on: ubuntu-24.04
3636
env:
37-
BUNDLE_WITHOUT: assets:console:development:dynflow_sidekiq:ec2:journald:jsonp:libvirt:openid:openstack:ovirt:redis:service:telemetry:vmware
37+
BUNDLE_WITHOUT: assets:console:development:dynflow_sidekiq:ec2:journald:jsonp:libvirt:openid:openstack:redis:service:telemetry:vmware
3838
steps:
3939
- uses: actions/checkout@v4
4040
- name: Setup Ruby
@@ -46,7 +46,7 @@ jobs:
4646
run: bundle exec rubocop -P
4747

4848
tests:
49-
name: "${{ matrix.task }} - Ruby ${{ matrix.ruby }} and Node ${{ matrix.node }} on PostgreSQL ${{ matrix.postgresql }}"
49+
name: '${{ matrix.task }} - Ruby ${{ matrix.ruby }} and Node ${{ matrix.node }} on PostgreSQL ${{ matrix.postgresql }}'
5050
runs-on: ubuntu-24.04
5151
needs:
5252
- setup_matrix
@@ -77,9 +77,9 @@ jobs:
7777
- run: sudo apt-get -qq -y install build-essential libcurl4-openssl-dev zlib1g-dev libpq-dev libvirt-dev
7878
- name: generate artifact suffix
7979
run: echo "ARTIFACT_SUFFIX=$(echo 'ruby-${{ matrix.ruby }}-node-${{ matrix.node }}-pg-${{ matrix.postgresql }}-${{ matrix.task }}' | tr -cd '[:alnum:]-.')" >> "${GITHUB_ENV}"
80-
- name: "Check out Foreman"
80+
- name: 'Check out Foreman'
8181
uses: actions/checkout@v4
82-
- name: "Set up Ruby ${{ matrix.ruby }}"
82+
- name: 'Set up Ruby ${{ matrix.ruby }}'
8383
uses: ruby/setup-ruby@v1
8484
with:
8585
ruby-version: ${{ matrix.ruby }}
@@ -89,7 +89,7 @@ jobs:
8989
with:
9090
name: Gemfile-${{ env.ARTIFACT_SUFFIX }}.lock
9191
path: Gemfile.lock
92-
- name: "Set up Node ${{ matrix.node }}"
92+
- name: 'Set up Node ${{ matrix.node }}'
9393
uses: actions/setup-node@v4
9494
with:
9595
node-version: ${{ matrix.node }}

.rubocop_todo.yml

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ Layout/MultilineOperationIndentation:
5959
Layout/SpaceAroundMethodCallOperator:
6060
Exclude:
6161
- 'test/controllers/api/v2/hosts_controller_test.rb'
62-
- 'test/models/compute_resources/ovirt_test.rb'
6362

6463
# Offense count: 3321
6564
# Cop supports --auto-correct.

app/assets/config/manifest.js

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
// link compute_resource.js
1212
//= link compute_resources/libvirt/nic_info.js
13-
//= link compute_resources/ovirt/nic_info.js
14-
//= link compute_resources/ovirt/display.js
1513
//= link compute_resources/vmware/nic_info.js
1614
//= link host_edit.js
1715
//= link host_edit_interfaces.js

app/assets/javascripts/compute_resources/ovirt/display.js

-10
This file was deleted.

app/assets/javascripts/compute_resources/ovirt/nic_info.js

-3
This file was deleted.

app/assets/javascripts/host_edit.js

+62-45
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ var compute_resource_id = null;
33

44
$(document).on('ContentLoad', function() {
55
var searchParams = new URLSearchParams(window.location.search);
6-
if(searchParams.has('hostgroup_id')) {
6+
if (searchParams.has('hostgroup_id')) {
77
var param = searchParams.get('hostgroup_id');
8-
$('#host_hostgroup_id').val(param).trigger('change');
8+
$('#host_hostgroup_id')
9+
.val(param)
10+
.trigger('change');
911
}
1012
onHostEditLoad();
1113
const overrideButtons = document.querySelectorAll('[name=is_overridden_btn]');
@@ -39,17 +41,41 @@ $(document).on('ContentLoad', function() {
3941
$(document)
4042
.on('select2:select select2:unselecting', '.hostgroup-select', function(evt) {
4143
hostgroup_changed(evt.target);
42-
}).on('select2:select select2:unselecting', '.host-form-compute-resource-handle', function(evt) {
43-
computeResourceSelected(evt.target);
44-
}).on('select2:select select2:unselecting', '.host-taxonomy-select', function(evt) {
44+
})
45+
.on(
46+
'select2:select select2:unselecting',
47+
'.host-form-compute-resource-handle',
48+
function(evt) {
49+
computeResourceSelected(evt.target);
50+
}
51+
)
52+
.on('select2:select select2:unselecting', '.host-taxonomy-select', function(
53+
evt
54+
) {
4555
update_form(evt.target);
46-
}).on('select2:select select2:unselecting', '#host_architecture_id', function(evt) {
47-
architecture_selected(evt.target);
48-
}).on('select2:select select2:unselecting', '#hostgroup_architecture_id', function(evt) {
56+
})
57+
.on('select2:select select2:unselecting', '#host_architecture_id', function(
58+
evt
59+
) {
4960
architecture_selected(evt.target);
50-
}).on('select2:select select2:unselecting', '.host-architecture-os-select', function(evt) {
51-
os_selected(evt.target);
52-
}).on('select2:select select2:unselecting', '.host-os-media-select', function(evt) {
61+
})
62+
.on(
63+
'select2:select select2:unselecting',
64+
'#hostgroup_architecture_id',
65+
function(evt) {
66+
architecture_selected(evt.target);
67+
}
68+
)
69+
.on(
70+
'select2:select select2:unselecting',
71+
'.host-architecture-os-select',
72+
function(evt) {
73+
os_selected(evt.target);
74+
}
75+
)
76+
.on('select2:select select2:unselecting', '.host-os-media-select', function(
77+
evt
78+
) {
5379
medium_selected(evt.target);
5480
});
5581

@@ -207,14 +233,20 @@ function submit_with_all_params() {
207233
success: function(response, _responseStatus, jqXHR) {
208234
// workaround for redirecting to the new host details page
209235
if (!response.includes('id="main"')) {
210-
return tfm.nav.pushUrl(tfm.tools.foremanUrl(jqXHR.getResponseHeader('X-Request-Path')));
236+
return tfm.nav.pushUrl(
237+
tfm.tools.foremanUrl(jqXHR.getResponseHeader('X-Request-Path'))
238+
);
211239
}
212240

213241
$('#host-progress').hide();
214242
$('#content').replaceWith($('#content', response));
215243
$(document.body).trigger('ContentLoad');
216-
if ($("[data-history-url]").exists()) {
217-
history.pushState({}, 'Host show', $("[data-history-url]").data('history-url'));
244+
if ($('[data-history-url]').exists()) {
245+
history.pushState(
246+
{},
247+
'Host show',
248+
$('[data-history-url]').data('history-url')
249+
);
218250
}
219251
},
220252
error: function(response) {
@@ -275,7 +307,7 @@ function update_progress(data) {
275307
}
276308

277309
function update_default_compute_resource(hostgroup_id) {
278-
if(hostgroup_id) {
310+
if (hostgroup_id) {
279311
tfm.tools.showSpinner();
280312
$.ajax({
281313
type: 'get',
@@ -285,10 +317,10 @@ function update_default_compute_resource(hostgroup_id) {
285317
},
286318
success: function(response) {
287319
compute_resource_id = response['compute_resource_id'];
288-
}});
289-
}
290-
else {
291-
compute_resource_id = null
320+
},
321+
});
322+
} else {
323+
compute_resource_id = null;
292324
}
293325
}
294326

@@ -303,7 +335,6 @@ function hostgroup_changed(element) {
303335
}
304336
const hostgroup_id = element.value;
305337
update_default_compute_resource(hostgroup_id);
306-
307338
}
308339

309340
function handleHostgroupChangeEdit(element, host_id, host_changed) {
@@ -482,12 +513,6 @@ function update_provisioning_image() {
482513
if ($('#host_provision_method_image')[0].checked) {
483514
if ($('#provider').val() == 'Libvirt') {
484515
tfm.computeResource.libvirt.imageSelected(image_options);
485-
} else if ($('#provider').val() == 'Ovirt') {
486-
var template_select = $('#host_compute_attributes_template');
487-
if (template_select.length > 0) {
488-
template_select.val(image_options.val());
489-
tfm.computeResource.ovirt.templateSelected(image_options);
490-
}
491516
}
492517
}
493518
}
@@ -579,8 +604,8 @@ function onHostEditLoad() {
579604
$('#params-tab').on('shown', function() {
580605
mark_params_override();
581606
});
582-
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
583-
$('a[rel="popover"]').popover("destroy");
607+
$('a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
608+
$('a[rel="popover"]').popover('destroy');
584609
});
585610
if ($('#supports_update') && !$('#supports_update').data('supports-update'))
586611
disable_vm_form_fields();
@@ -598,8 +623,6 @@ function build_provision_method_selected() {
598623
$('div[id*=_provisioning]').hide();
599624
$('#network_provisioning').show();
600625
$('#image_selection select').attr('disabled', true);
601-
if ($('#provider').val() == 'Ovirt')
602-
$('#host_compute_attributes_template').select2('readonly',false);
603626
}
604627
$(document).on(
605628
'select2:select select2:unselecting',
@@ -615,13 +638,6 @@ function image_provision_method_selected() {
615638
image_options.attr('disabled', false);
616639
if ($('#provider').val() == 'Libvirt') {
617640
tfm.computeResource.libvirt.imageSelected(image_options);
618-
} else if ($('#provider').val() == 'Ovirt') {
619-
var template_options = $('#host_compute_attributes_template');
620-
if (template_options.length > 0) {
621-
template_options.select2('readonly',true);
622-
template_options.val(image_options.val());
623-
tfm.computeResource.ovirt.templateSelected(image_options);
624-
}
625641
}
626642
}
627643
$(document).on(
@@ -630,12 +646,16 @@ $(document).on(
630646
image_provision_method_selected
631647
);
632648

633-
$(document).on('select2:select select2:unselecting', '.interface_domain', function() {
649+
$(document).on(
650+
'select2:select select2:unselecting',
651+
'.interface_domain',
652+
function() {
634653
interface_domain_selected(this);
635654
clearIpField(this, '.interface_ip');
636655
clearIpField(this, '.interface_ip6');
637656
reload_host_params();
638-
});
657+
}
658+
);
639659

640660
function clearIpField(parent, childclass) {
641661
var ip_field = $(parent)
@@ -883,7 +903,7 @@ function selectRelatedNetwork(subnetElement) {
883903
var vlanId = subnet_select.find(':selected').attr('data-vlan_id');
884904
var network_select = subnet_select
885905
.closest('fieldset')
886-
.find('.vmware_network,.ovirt_network');
906+
.find('.vmware_network');
887907
var isVisible = subnet_select.closest('#interfaceModal').length > 0;
888908
var isPreSelected = network_select.find('option[selected]').length > 0;
889909

@@ -894,13 +914,10 @@ function selectRelatedNetwork(subnetElement) {
894914
var selected = null;
895915
// prefer a match of the vlanid bounded by non digits
896916
// this prevent vlanId=1 from matching "vlan100"
897-
var vlanidregex = new RegExp("(^|\\D)" + vlanId + "($|\\D)")
917+
var vlanidregex = new RegExp('(^|\\D)' + vlanId + '($|\\D)');
898918

899919
network_select.find('option').each(function(index, option) {
900-
if (
901-
selected === null &&
902-
vlanidregex.test($(option).text())
903-
) {
920+
if (selected === null && vlanidregex.test($(option).text())) {
904921
selected = option.value;
905922
}
906923
});

app/controllers/api/v2/compute_resources_controller.rb

+7-17
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ComputeResourcesController < V2::BaseController
88

99
before_action :find_resource, :only => [:show, :update, :destroy, :available_images, :associate,
1010
:available_virtual_machines, :available_clusters, :available_flavors, :available_folders,
11-
:available_networks, :available_vnic_profiles, :available_resource_pools, :available_security_groups, :available_storage_domains,
11+
:available_networks, :available_resource_pools, :available_security_groups, :available_storage_domains,
1212
:available_zones, :available_storage_pods, :storage_domain, :storage_pod, :refresh_cache, :power_vm, :show_vm, :destroy_vm]
1313

1414
api :GET, "/compute_resources/", N_("List all compute resources")
@@ -32,20 +32,17 @@ def show
3232
param :provider, String, :desc => N_("Providers include %{providers}") # values are defined in apipie initializer
3333
param :url, String, :desc => N_("URL for %{providers_requiring_url}")
3434
param :description, String
35-
param :user, String, :desc => N_("Username for oVirt, EC2, VMware, OpenStack. Access Key for EC2.")
36-
param :password, String, :desc => N_("Password for oVirt, EC2, VMware, OpenStack. Secret key for EC2")
37-
param :datacenter, String, :desc => N_("for oVirt, VMware Datacenter")
38-
param :ovirt_quota, String, :desc => N_("for oVirt only, ID or Name of quota to use")
39-
param :public_key, String, :desc => N_("for oVirt only")
35+
param :user, String, :desc => N_("Username for EC2, VMware, OpenStack. Access Key for EC2.")
36+
param :password, String, :desc => N_("Password for EC2, VMware, OpenStack. Secret key for EC2")
37+
param :datacenter, String, :desc => N_("for VMware Datacenter")
4038
param :region, String, :desc => N_("for AzureRm eg. 'eastus' and for EC2 only. Use '%s' for EC2 GovCloud region") % Foreman::Model::EC2::GOV_CLOUD_REGION
4139
param :tenant, String, :desc => N_("for OpenStack and AzureRm only")
4240
param :domain, String, :desc => N_("for OpenStack (v3) only")
4341
param :project_domain_name, String, :desc => N_("for OpenStack (v3) only")
4442
param :project_domain_id, String, :desc => N_("for OpenStack (v3) only")
4543
param :server, String, :desc => N_("for VMware")
4644
param :set_console_password, :bool, :desc => N_("for Libvirt and VMware only")
47-
param :display_type, %w(VNC SPICE), :desc => N_('for Libvirt and oVirt only')
48-
param :keyboard_layout, ComputeResource::ALLOWED_KEYBOARD_LAYOUTS, :desc => N_('for oVirt only')
45+
param :display_type, %w(VNC SPICE), :desc => N_('for Libvirt only')
4946
param :caching_enabled, :bool, :desc => N_('enable caching, for VMware only')
5047
param_group :taxonomies, ::Api::V2::BaseController
5148
end
@@ -63,7 +60,7 @@ def change_datacenter_to_uuid(datacenter)
6360

6461
def create
6562
begin
66-
if compute_resource_params["provider"].downcase == "ovirt" && !Foreman.is_uuid?(compute_resource_params[:datacenter])
63+
unless Foreman.is_uuid?(compute_resource_params[:datacenter])
6764
@compute_resource = ComputeResource.new_provider(compute_resource_params.except(:datacenter))
6865
params[:compute_resource][:datacenter] = change_datacenter_to_uuid(params[:compute_resource][:datacenter])
6966
end
@@ -146,13 +143,6 @@ def available_networks
146143
render :available_networks, :layout => 'api/v2/layouts/index_layout'
147144
end
148145

149-
api :GET, "/compute_resources/:id/available_vnic_profiles", N_("List available vnic profiles for a compute resource, for oVirt only")
150-
param :id, :identifier, :required => true
151-
def available_vnic_profiles
152-
@available_vnic_profiles = @compute_resource.vnic_profiles
153-
render :available_vnic_profiles, :layout => 'api/v2/layouts/index_layout'
154-
end
155-
156146
api :GET, "/compute_resources/:id/available_clusters/:cluster_id/available_resource_pools", N_("List resource pools for a compute resource cluster")
157147
param :id, :identifier, :required => true
158148
param :cluster_id, String, :required => true
@@ -302,7 +292,7 @@ def cluster_id
302292

303293
def action_permission
304294
case params[:action]
305-
when 'available_images', 'available_virtual_machines', 'available_clusters', 'available_flavors', 'available_folders', 'available_networks', 'available_vnic_profiles', 'available_resource_pools', 'available_security_groups', 'available_storage_domains', 'storage_domain', 'available_zones', 'associate', 'available_storage_pods', 'storage_pod', 'refresh_cache', 'show_vm', 'power_vm', 'destroy_vm'
295+
when 'available_images', 'available_virtual_machines', 'available_clusters', 'available_flavors', 'available_folders', 'available_networks', 'available_resource_pools', 'available_security_groups', 'available_storage_domains', 'storage_domain', 'available_zones', 'associate', 'available_storage_pods', 'storage_pod', 'refresh_cache', 'show_vm', 'power_vm', 'destroy_vm'
306296
:view
307297
else
308298
super

app/controllers/concerns/foreman/controller/parameters/compute_resource.rb

-8
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,6 @@ def compute_resource_params_filter
3232
:project_domain_name,
3333
:project_domain_id
3434

35-
# ovirt
36-
filter.permit :datacenter,
37-
:ovirt_quota,
38-
:keyboard_layout,
39-
:use_v4,
40-
:public_key,
41-
:uuid
42-
4335
# vmware
4436
filter.permit :datacenter,
4537
:pubkey_hash,

0 commit comments

Comments
 (0)