Adding back kvm_advance_timer service

On compute nodes with openstack-compute label, the
kvm_timer_advance_setup.service should be enabled.

The puppet service runs before kubelet.

Change-Id: I84d6c6234d4bd1c8c0c52f5735d7520377b2fe80
Partial-Bug: 1823751
Depends-On: https://review.opendev.org/#/c/672124
Signed-off-by: Al Bailey <Al.Bailey@windriver.com>
This commit is contained in:
Al Bailey 2019-07-22 13:37:15 -05:00
parent 38f50274e2
commit b6b8f645f7
4 changed files with 62 additions and 1 deletions

View File

@ -1,2 +1,2 @@
SRC_DIR="src"
TIS_PATCH_VER=91
TIS_PATCH_VER=92

View File

@ -351,6 +351,38 @@ class platform::compute::machine {
}
}
class platform::compute::kvm_timer_advance(
$enabled = False,
$vcpu_pin_set = undef
) {
if $enabled {
# include the declaration of the kubelet service
include ::platform::kubernetes::worker
file { '/etc/kvm-timer-advance/kvm-timer-advance.conf':
ensure => 'present',
replace => true,
content => template('platform/kvm_timer_advance.conf.erb')
}
-> service { 'kvm_timer_advance_setup':
ensure => 'running',
enable => true,
before => Service['kubelet'],
}
# A separate enable is required since we have modified the service resource
# to never enable/disable services in puppet.
-> exec { 'Enable kvm_timer_advance_setup':
command => '/usr/bin/systemctl enable kvm_timer_advance_setup.service',
}
} else {
# A disable is required since we have modified the service resource
# to never enable/disable services in puppet and stop has no effect.
exec { 'Disable kvm_timer_advance_setup':
command => '/usr/bin/systemctl disable kvm_timer_advance_setup.service',
}
}
}
class platform::compute {
Class[$name] -> Class['::platform::vswitch']
@ -362,4 +394,5 @@ class platform::compute {
require ::platform::compute::resctrl
require ::platform::compute::machine
require ::platform::compute::config
require ::platform::compute::kvm_timer_advance
}

View File

@ -0,0 +1,2 @@
[kvm-timer-advance]
vcpu_pin_set=<%= @vcpu_pin_set %>

View File

@ -68,6 +68,7 @@ class PlatformPuppet(base.BasePuppet):
config.update(self._get_host_tpm_config(host))
config.update(self._get_host_cpu_config(host))
config.update(self._get_host_memory_config(host))
config.update(self._get_kvm_timer_advance_config(host))
config.update(self._get_host_lldp_config(host))
return config
@ -718,6 +719,31 @@ class PlatformPuppet(base.BasePuppet):
return config
def _get_vcpu_pin_set(self, host):
vm_cpus = self._get_host_cpu_list(
host, function=constants.APPLICATION_FUNCTION, threads=True)
cpu_list = [c.cpu for c in vm_cpus]
return "\"%s\"" % utils.format_range_set(cpu_list)
# kvm-timer-advance only enabled on computes with openstack compute label
# vcpu_pin_set is only used when kvm-timer-advance is enabled
def _get_kvm_timer_advance_config(self, host):
kvm_timer_advance_enabled = False
vcpu_pin_set = None
if constants.WORKER in utils.get_personalities(host):
host_labels = self.dbapi.label_get_by_host(host.id)
if utils.has_openstack_compute(host_labels):
kvm_timer_advance_enabled = True
vcpu_pin_set = self._get_vcpu_pin_set(host)
return {
'platform::compute::kvm_timer_advance::enabled':
kvm_timer_advance_enabled,
'platform::compute::kvm_timer_advance::vcpu_pin_set':
vcpu_pin_set,
}
def _get_nfs_config(self, host):
# Calculate the optimal NFS r/w size based on the network mtu based