Class: Libvirt::Spec::Domain::Memtune

Inherits:
Object
  • Object
show all
Defined in:
lib/libvirt/spec/domain/memtune.rb

Overview

Allows the modification of details regarding the memory tuneable parameters for this domain.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hard_limitObject

Returns the value of attribute hard_limit.



7
8
9
# File 'lib/libvirt/spec/domain/memtune.rb', line 7

def hard_limit
  @hard_limit
end

#min_guaranteeObject

Returns the value of attribute min_guarantee.



10
11
12
# File 'lib/libvirt/spec/domain/memtune.rb', line 10

def min_guarantee
  @min_guarantee
end

#soft_limitObject

Returns the value of attribute soft_limit.



8
9
10
# File 'lib/libvirt/spec/domain/memtune.rb', line 8

def soft_limit
  @soft_limit
end

#swap_hard_limitObject

Returns the value of attribute swap_hard_limit.



9
10
11
# File 'lib/libvirt/spec/domain/memtune.rb', line 9

def swap_hard_limit
  @swap_hard_limit
end

Instance Method Details

#to_xml(parent = Nokogiri::XML::Builder.new) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/libvirt/spec/domain/memtune.rb', line 12

def to_xml(parent=Nokogiri::XML::Builder.new)
  # If nothing has been modified, then don't do anything
  return if !hard_limit && !soft_limit &&
            !swap_hard_limit && !min_guarantee

  parent.memtune do |m|
    m.hard_limit hard_limit if hard_limit
    m.soft_limit soft_limit if soft_limit
    m.swap_hard_limit swap_hard_limit if swap_hard_limit
    m.min_guarantee min_guarantee if min_guarantee
  end

  parent.to_xml
end