Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #5197 Preallocated disk support for ovirt. #1568

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions app/models/compute_resources/foreman/model/ovirt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,13 @@ def create_interfaces(vm, attrs)
def create_volumes(vm, attrs)
#add volumes
volumes = nested_attributes_for :volumes, attrs
#The blocking true is a work-around for ovirt bug fixed in ovirt version 3.1.
volumes.map{ |vol| vm.add_volume({:bootable => 'false', :quota => ovirt_quota, :blocking => api_version.to_f < 3.1}.merge(vol)) if vol[:id].blank?}
volumes.map do |vol|
vol[:sparse] = "true"
vol[:format] = "raw" if vol[:preallocate] == "1"
vol[:sparse] = "false" if vol[:preallocate] == "1"
#The blocking true is a work-around for ovirt bug fixed in ovirt version 3.1.
vm.add_volume({:bootable => 'false', :quota => ovirt_quota, :blocking => api_version.to_f < 3.1}.merge(vol)) if vol[:id].blank?
end
vm.volumes.reload
end

Expand Down
3 changes: 3 additions & 0 deletions app/views/compute_resources_vms/form/ovirt/_volume.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
:help_inline=> remove_child_link("X", f, { :method => :'_delete', :title => _('remove volume'), :class => 'label label-danger' }) %>
<%= f.hidden_field :storage_domain if disabled %>
<%= f.hidden_field :id %>

<%= checkbox_f f, :preallocate, { :checked => true, :help_inline => _("Thick Provision the disk when creating"), :label => _('Preallocate Disk') } %>

<%= field(f, :bootable, :label => _('Bootable')) do
radio_button_f f, :bootable, {:disabled => disabled, :value=>'true', :checked => (f.object.bootable == 'true'), :onclick => 'bootable_radio(this)',
:text => _('Only one volume can be bootable')}
Expand Down