Skip to content

Commit

Permalink
Add sysprep support for ovirt
Browse files Browse the repository at this point in the history
Add sysprep specification support for vm provisioning from template
for the oVirt provider.

Depends on: ManageIQ/manageiq#17636
Implements: https://bugzilla.redhat.com/show_bug.cgi?id=1553833
  • Loading branch information
Boris Odnopozov committed Aug 9, 2018
1 parent 28f314a commit 0ce0e6a
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 38 deletions.
12 changes: 11 additions & 1 deletion app/services/customize_fields_visibility_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@ def determine_visibility(platform, supports_customization_template, customize_fi
if supports_customization_template
field_names_to_edit += [
:addr_mode,
:sysprep_timezone,
:customization_template_id,
:customization_template_script,
:dns_servers,
:dns_suffixes,
:sysprep_domain_name,
:sysprpe_domain_admin,
:sysprep_domain_password,
:sysprep_computer_name,
:sysprep_locale_ui,
:sysprep_locale_input,
:sysprep_locale_system,
:sysprep_locale_user,
:sysprep_machine_object_ou,
:sysprep_product_key,
:gateway,
:hostname,
:ip_addr,
Expand All @@ -24,7 +35,6 @@ def determine_visibility(platform, supports_customization_template, customize_fi
:sysprep_upload_file,
:sysprep_upload_text,
:linux_host_name,
:sysprep_computer_name,
:ip_addr,
:subnet_mask,
:gateway,
Expand Down
5 changes: 4 additions & 1 deletion app/views/miq_request/_prov_field.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@
:sysprep_full_name, :sysprep_organization,
:sysprep_product_id, :sysprep_computer_name,
:sysprep_per_server_max_connections, :vm_description,
:vm_name, :wins_servers].include?(field)
:vm_name, :wins_servers, :sysprep_domain, :sysprep_timezone,
:sysprep_admin_password, :sysprep_product_key, :sysprep_locale_ui,
:sysprep_locale_input, :sysprep_locale_system, :sysprep_locale_user,
:sysprep_machine_object_ou].include?(field)
.col-md-8
- if @edit && field_hash[:display] == :edit && !@edit[:stamp_typ]
-# Allow editing of the text field
Expand Down
110 changes: 74 additions & 36 deletions app/views/shared/views/_prov_dialog.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -191,42 +191,80 @@
:keys => keys})
- if (@edit && @edit[:new] && @edit[:new][:sysprep_enabled] && @edit[:new][:sysprep_enabled][0] == "fields") || (@options && @options[:sysprep_enabled] && @options[:sysprep_enabled][0] == "fields")
- if wf.kind_of?(ManageIQ::Providers::Redhat::InfraManager::ProvisionWorkflow)
- keys = [:root_username, :root_password]
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("Credentials"),
:prefix => "/miq_request/",
:keys => keys})
- keys = [:addr_mode, :hostname, :ip_addr, :subnet_mask, :gateway]
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("IP Address Information"),
:prefix => "/miq_request/",
:keys => keys})
- keys = [:dns_servers, :dns_suffixes]
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("DNS"),
:prefix => "/miq_request/",
:keys => keys})
- keys = [:customization_template_id]
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("Customize Template"),
:prefix => "/miq_request/",
:keys => keys})
- show_customization_template_script = (@edit && @edit[:new] && @edit[:new][:customization_template_script]) || (@options && @options[:customization_template_script])
- keys = [show_customization_template_script ? :customization_template_script : nil].compact
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("Selected Template Contents"),
:prefix => "/miq_request/",
:keys => keys})
- if @edit[:new][:sysprep_enabled][1] == "Sysprep Specification"
- keys = [:sysprep_computer_name, :sysprep_organization, :sysprep_admin_password, :sysprep_product_key]
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("Computer Details"),
:prefix => "/miq_request/",
:keys => keys})
- keys = [:sysprep_domain, :sysprep_domain_admin, :sysprep_domain_password, :sysprep_machine_object_ou]
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("Domain Information"),
:prefix => "/miq_request/",
:keys => keys})
- keys = [:sysprep_timezone, :sysprep_locale_ui, :sysprep_locale_system, :sysprep_locale_input, :sysprep_locale_user]
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("Localization"),
:prefix => "/miq_request/",
:keys => keys})
- keys = [:customization_template_id]
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("Customize Template"),
:prefix => "/miq_request/",
:keys => keys})
- show_customization_template_script = (@edit && @edit[:new] && @edit[:new][:customization_template_script]) || (@options && @options[:customization_template_script])
- keys = [show_customization_template_script ? :customization_template_script : nil].compact
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("Selected Template Contents"),
:prefix => "/miq_request/",
:keys => keys})
- else
- keys = [:root_username, :root_password]
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("Credentials"),
:prefix => "/miq_request/",
:keys => keys})
- keys = [:addr_mode, :hostname, :ip_addr, :subnet_mask, :gateway]
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("IP Address Information"),
:prefix => "/miq_request/",
:keys => keys})
- keys = [:dns_servers, :dns_suffixes]
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("DNS"),
:prefix => "/miq_request/",
:keys => keys})
- keys = [:customization_template_id]
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("Customize Template"),
:prefix => "/miq_request/",
:keys => keys})
- show_customization_template_script = (@edit && @edit[:new] && @edit[:new][:customization_template_script]) || (@options && @options[:customization_template_script])
- keys = [show_customization_template_script ? :customization_template_script : nil].compact
= render(:partial => "/miq_request/prov_dialog_fieldset",
:locals => {:workflow => wf,
:dialog => dialog,
:label => _("Selected Template Contents"),
:prefix => "/miq_request/",
:keys => keys})
- else
- keys = [:sysprep_custom_spec, :sysprep_spec_override]
= render(:partial => "/miq_request/prov_dialog_fieldset",
Expand Down

0 comments on commit 0ce0e6a

Please sign in to comment.