Browse Source

Always manage hugetlbfs mountpoint for libvirt

hugetlbfs mountpoint value should be set to the only correct value when huge
pages are enabled (other values are prohibited by apparmor) and removed when
huge pages are disabled

Change-Id: I84dd96c8268e1c8610a1f4788616441f0c0ebce0
Closes-bug: #1556083
tags/9.0
Sergey Kolekonov 4 years ago
parent
commit
b2e12dd096
2 changed files with 18 additions and 4 deletions
  1. +9
    -2
      deployment/puppet/openstack/manifests/compute.pp
  2. +9
    -2
      tests/noop/spec/hosts/roles/compute_spec.rb

+ 9
- 2
deployment/puppet/openstack/manifests/compute.pp View File

@@ -184,15 +184,22 @@ class openstack::compute (

if $::osfamily == 'Debian' {
if $use_huge_pages {
$qemu_hugepages_value = 'set KVM_HUGEPAGES 1'
$qemu_hugepages_value = 'set KVM_HUGEPAGES 1'
$libvirt_hugetlbfs_mount = 'set hugetlbfs_mount /run/hugepages/kvm'
} else {
$qemu_hugepages_value = 'rm KVM_HUGEPAGES'
$qemu_hugepages_value = 'rm KVM_HUGEPAGES'
$libvirt_hugetlbfs_mount = 'rm hugetlbfs_mount'
}
augeas { 'qemu_hugepages':
context => '/files/etc/default/qemu-kvm',
changes => $qemu_hugepages_value,
notify => Service['libvirt'],
}
augeas { 'libvirt_hugetlbfs_mount':
context => '/files/etc/libvirt/qemu.conf',
changes => $libvirt_hugetlbfs_mount,
notify => Service['libvirt'],
}

Augeas['qemu_hugepages'] ~> Service<| title == 'qemu-kvm'|>
Service<| title == 'qemu-kvm'|> -> Service<| title == 'libvirt'|>


+ 9
- 2
tests/noop/spec/hosts/roles/compute_spec.rb View File

@@ -156,9 +156,11 @@ describe manifest do

it 'should set up huge pages support for qemu-kvm' do
if enable_hugepages
qemu_hugepages_value = 'set KVM_HUGEPAGES 1'
qemu_hugepages_value = 'set KVM_HUGEPAGES 1'
libvirt_hugetlbfs_mount = 'set hugetlbfs_mount /run/hugepages/kvm'
else
qemu_hugepages_value = 'rm KVM_HUGEPAGES'
qemu_hugepages_value = 'rm KVM_HUGEPAGES'
libvirt_hugetlbfs_mount = 'rm hugetlbfs_mount'
end

if facts[:osfamily] == 'Debian'
@@ -167,6 +169,11 @@ describe manifest do
'changes' => qemu_hugepages_value,
).that_notifies('Service[libvirt]')

should contain_augeas('libvirt_hugetlbfs_mount').with(
'context' => '/files/etc/libvirt/qemu.conf',
'changes' => libvirt_hugetlbfs_mount,
).that_notifies('Service[libvirt]')

should contain_augeas('qemu_hugepages').that_notifies('Service[qemu-kvm]')
should contain_service('qemu-kvm').that_comes_before('Service[libvirt]')
end


Loading…
Cancel
Save