Project

General

Profile

Revision 8d871e1b

Added by Daniel Lobato Garcia over 8 years ago

Fixes #8096 #8097: Improve cpuset cpushare form

View differences:

app/models/container.rb
13 13
      'Tty'          => tty,                    'Memory'       => memory,
14 14
      'Entrypoint'   => entrypoint.try(:split), 'Cmd'          => command.try(:split),
15 15
      'AttachStdout' => attach_stdout,          'AttachStdin'  => attach_stdin,
16
      'AttachStderr' => attach_stderr,          'CpuShares'    => cpu_shares, :cpuset => cpu_set }
16
      'AttachStderr' => attach_stderr,          'CpuShares'    => cpu_shares,
17
      'Cpuset'       => cpu_set }
17 18
  end
18 19

  
19 20
  def in_fog
app/models/foreman_docker/docker.rb
20 20
      super.merge(:mac => :mac)
21 21
    end
22 22

  
23
    # FIXME
24
    def max_cpu_count
25
      8
26
    end
27

  
28 23
    def max_memory
29 24
      16 * 1024 * 1024 * 1024
30 25
    end
app/views/containers/steps/configuration.html.erb
6 6
    <%= text_f f, :entrypoint, :size => 'col-md-4', :placeholder => '/bin/sh -c by default' %>
7 7
    <hr>
8 8
    <h3><%= _("Compute options") %></h3>
9
    <%= selectable_f f, :cpu_set, 1..f.object.compute_resource.max_cpu_count, { }, :class => "col-md-2", :label => _('Cores') %>
10
    <%= text_f f, :cpu_shares, :class => "col-md-2", :label => _('CPU shares') %>
11
    <%= selectable_f f, :memory, memory_options(f.object.compute_resource.max_memory), { }, :class => "col-md-2", :label => _('Memory') %>
9
    <%= text_f f, :cpu_set, :class => "col-md-2", :label => _('CPU sets'),
10
      :placeholder => '0-2,16 represents CPUs 0, 1, 2, and 16.',
11
      :help_block => link_to(_("learn more about CPU sets"), 'http://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-cpuset.html') %>
12
    <%= text_f f, :cpu_shares, :class => "col-md-2", :label => _('CPU shares'),
13
      :placeholder => 'relative share of CPU time in cgroup',
14
      :help_block => link_to(_("learn more about CPU shares"), 'http://docs.fedoraproject.org/en-US/Fedora/17/html/Resource_Management_Guide/sec-cpuset.html') %>
15
    <%= text_f f, :memory, :class => "col-md-2", :label => _('Memory'), :placeholder => '512m limits container memory usage to 512 MB' %>
12 16
    <%= render :partial => 'form_buttons' %>
13 17
  <% end %>
14 18
<% end %>

Also available in: Unified diff